Completed
Push — develop ( f101a1...f94113 )
by Chris
12s
created

AbstractContainer::dump()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 0
crap 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
            $component->readLines($lines);
20 1
        }
21 1
    }
22
23
    public function dump()
24
    {
25 1
        $lines = array_map(function (DumpableInterface $dumper) {
26 1
            return $dumper->dump();
27 1
        }, $this->getComponents());
28
29 1
        return implode("\n", array_filter($lines));
30
    }
31
32
    abstract protected function getComponents();
33
}
34