Completed
Push — develop ( ee07eb...86946f )
by Franck
11s
created

Media::getMimeType()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 17
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 13
CRAP Score 4

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 17
ccs 13
cts 13
cp 1
rs 9.2
cc 4
eloc 14
nc 4
nop 0
crap 4
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
 * @link        https://github.com/PHPOffice/PHPPresentation
14
 * @copyright   2009-2015 PHPPresentation contributors
15
 * @license     http://www.gnu.org/licenses/lgpl.txt LGPL version 3
16
 */
17
18
namespace PhpOffice\PhpPresentation\Shape;
19
20
use PhpOffice\PhpPresentation\ComparableInterface;
21
use PhpOffice\PhpPresentation\Shape\Drawing\File;
22
23
/**
24
 * Media element
25
 */
26
class Media extends File implements ComparableInterface
27
{
28
29
    /**
30
     * @return string
31
     */
32 3
    public function getMimeType()
33
    {
34 3
        switch (strtolower($this->getExtension())) {
35 3
            case 'mp4':
36 1
                $mimetype = 'video/mp4';
37 1
                break;
38 3
            case 'ogv':
39 3
                $mimetype = 'video/ogg';
40 3
                break;
41 1
            case 'wmv':
42 1
                $mimetype = 'video/x-ms-wmv';
43 1
                break;
44
            default:
45 1
                $mimetype = 'application/octet-stream';
46
        }
47 3
        return $mimetype;
48
    }
49
}
50