Completed
Pull Request — develop (#207)
by Franck
09:22
created

Media   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 4
c 3
b 0
f 0
lcom 0
cbo 1
dl 0
loc 24
ccs 15
cts 15
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getMimeType() 0 17 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 1
            default:
45 1
                $mimetype = 'application/octet-stream';
46 3
        }
47 3
        return $mimetype;
48
    }
49
}
50