Completed
Pull Request — develop (#551)
by
unknown
09:20
created

Audio::getMimeType()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
dl 0
loc 14
ccs 0
cts 14
cp 0
rs 9.7998
c 0
b 0
f 0
cc 3
nc 3
nop 0
crap 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
 * @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\Shape\Drawing\File;
21
22
/**
23
 * Audio element
24
 */
25
class Audio extends Media
26
{
27
	
28
	public function __construct() {
29
		parent::__construct();
30
		
31
		// settings
32
		$this->setName('Audio')
33
		->setDescription('Audio')
34
		->setResizeProportional(false)
35
		->setHeight(60)
36
		->setWidth(60);
37
	}
38
	
39
	
40
	
41
	
42
	/**
43
	 * @return string
44
	 */
45
	public function getMimeType()
46
	{
47
		switch (strtolower($this->getExtension())) {
48
			case 'mp3':
49
				$mimetype = 'audio/mpeg';
50
				break;
51
			case 'wav':
52
				$mimetype = 'audio/vnd.wav';
53
				break;
54
			default:
55
				$mimetype = 'application/octet-stream';
56
		}
57
		return $mimetype;
58
	}
59
	
60
}
61