Completed
Pull Request — develop (#27)
by Chris
02:25
created

ParentChildParser::supports()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace Chrisyue\PhpM3u8\Parser;
4
5
use Chrisyue\PhpM3u8\Line\LineInterface;
6
use Chrisyue\PhpM3u8\Parser\ParsersInterface;
7
use Chrisyue\PhpM3u8\DataAccessor\DataAccessorInterface;
8
use Chrisyue\PhpM3u8\Parser\Strategy\StrategyInterface;
9
10
class ParentChildParser extends ParentParser implements ChildParserInterface
11
{
12
    private $repeatable;
13
14
    public function __construct(
15
        ParsersInterface $parsers,
16
        DataAccessorInterface $dataAccessor,
17
        StrategyInterface $strategy,
18
        $repeatable
19
    ) {
20
        $this->repeatable = $repeatable;
21
        parent::__construct($parsers, $dataAccessor, $strategy);
22
    }
23
24
    public function supports(LineInterface $line)
25
    {
26
        return null !== $this->getParsers()->getKeyForLine($line);
27
    }
28
29
    public function isRepeatable()
30
    {
31
        return $this->repeatable;
32
    }
33
}
34