Completed
Push — develop ( bd286b...3e7014 )
by Chris
01:03 queued 59s
created

AttributesValueTagTrait::extractAttributes()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 14
ccs 9
cts 9
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 8
nc 2
nop 1
crap 2
1
<?php
2
3
/*
4
 * This file is part of the PhpM3u8 package.
5
 *
6
 * (c) Chrisyue <http://chrisyue.com/>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Chrisyue\PhpM3u8\Tag;
13
14
trait AttributesValueTagTrait
15
{
16
    use SingleValueTagTrait;
17
18 1
    private static function extractAttributes($line)
19
    {
20 1
        $attrsText = self::extractValue($line);
21
22 1
        $attrs = explode(',', $attrsText);
23
24 1
        $attributes = [];
25 1
        foreach ($attrs as $attr) {
26 1
            list($key, $value) = explode('=', $attr);
27 1
            $attributes[$key] = trim($value);
28 1
        }
29
30 1
        return $attributes;
31
    }
32
}
33