AbstractContainer   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 24
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A readLines() 0 10 3
A dump() 0 8 1
getComponents() 0 1 ?
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;
13
14
abstract class AbstractContainer implements DumpableInterface
15
{
16 1
    public function readLines(array &$lines)
17
    {
18 1
        foreach ($this->getComponents() as $component) {
19 1
            if (empty($lines)) {
20 1
                break;
21
            }
22
23 1
            $component->readLines($lines);
24 1
        }
25 1
    }
26
27
    public function dump()
28
    {
29 1
        $lines = array_map(function (DumpableInterface $dumper) {
30 1
            return $dumper->dump();
31 1
        }, $this->getComponents());
32
33 1
        return implode("\n", array_filter($lines));
34
    }
35
36
    abstract protected function getComponents();
37
}
38