Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
12 / 12
Media
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
5
100.00% covered (success)
100.00%
12 / 12
 getMimeType
100.00% covered (success)
100.00%
1 / 1
5
100.00% covered (success)
100.00%
12 / 12
1<?php
2/**
3 * This file is part of PHPPresentation - A pure PHP library for reading and writing
4 * presentations documents.
5 *
6 * PHPPresentation is free software distributed under the terms of the GNU Lesser
7 * General Public License version 3 as published by the Free Software Foundation.
8 *
9 * For the full copyright and license information, please read the LICENSE
10 * file that was distributed with this source code. For the full list of
11 * contributors, visit https://github.com/PHPOffice/PHPPresentation/contributors.
12 *
13 * @see        https://github.com/PHPOffice/PHPPresentation
14 *
15 * @copyright   2009-2015 PHPPresentation contributors
16 * @license     http://www.gnu.org/licenses/lgpl.txt LGPL version 3
17 */
18
19declare(strict_types=1);
20
21namespace PhpOffice\PhpPresentation\Shape;
22
23use PhpOffice\PhpPresentation\ComparableInterface;
24use PhpOffice\PhpPresentation\Shape\Drawing\File;
25
26/**
27 * Media element.
28 */
29class Media extends File implements ComparableInterface
30{
31    public function getMimeType(): string
32    {
33        switch (strtolower($this->getExtension())) {
34            case 'mp4':
35                $mimetype = 'video/mp4';
36                break;
37            case 'ogv':
38                $mimetype = 'video/ogg';
39                break;
40            case 'wmv':
41                $mimetype = 'video/x-ms-wmv';
42                break;
43            default:
44                $mimetype = 'application/octet-stream';
45        }
46
47        return $mimetype;
48    }
49}