Conditions | 5 |
Paths | 4 |
Total Lines | 17 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php |
||
13 | 60 | public function __construct($value) |
|
14 | { |
||
15 | 60 | parent::__construct($value); |
|
16 | |||
17 | 60 | if ($this->type === '*') { |
|
18 | 2 | $this->type = '*/*'; |
|
19 | 2 | } |
|
20 | |||
21 | 60 | $parts = explode('/', $this->type); |
|
22 | |||
23 | 60 | if (count($parts) !== 2 || !$parts[0] || !$parts[1]) { |
|
24 | 5 | throw new InvalidMediaType(); |
|
25 | } |
||
26 | |||
27 | 58 | $this->basePart = $parts[0]; |
|
28 | 58 | $this->subPart = $parts[1]; |
|
29 | 58 | } |
|
30 | |||
47 |