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

AttributesValueTagTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 19
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A extractAttributes() 0 14 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