Conditions | 6 |
Paths | 8 |
Total Lines | 22 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
7 | public function transform($origin) |
||
8 | { |
||
9 | preg_match_all('/(?<=^|,)[A-Z0-9-]+=("?).+?\1(?=,|$)/', $origin, $matches); |
||
10 | |||
11 | $result = $this->initResult(); |
||
12 | $parsed = false; |
||
13 | foreach ($matches[0] as $attr) { |
||
14 | list($name, $value) = explode('=', $attr); |
||
15 | foreach ($this->getAttributeM3u8s() as $property => $m3u8) { |
||
16 | if (null !== $result->$property || $m3u8->getName() !== $name) { |
||
17 | continue; |
||
18 | } |
||
19 | |||
20 | $result->$property = $m3u8->parse($value); |
||
21 | $parsed = true; |
||
22 | |||
23 | break; |
||
24 | } |
||
25 | } |
||
26 | |||
27 | return $parsed ? $result : null; |
||
28 | } |
||
29 | |||
48 |