Completed
Pull Request — develop (#27)
by Chris
10:31
created

AbstractAnnotationReadable::initResult()   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
c 0
b 0
f 0
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Chrisyue\PhpM3u8\M3u8\Core;
4
5
use Chrisyue\PhpM3u8\Stream\StreamInterface;
6
use Chrisyue\PhpM3u8\M3u8\M3u8Interface;
7
use Chrisyue\PhpM3u8\ReaderAwareInterface;
8
use Chrisyue\PhpM3u8\M3u8\OptionsTrait;
9
10
abstract class AbstractAnnotationReadable extends AbstractParentCore
11
{
12
    use OptionsTrait;
13
14
    private $cores;
15
16
    protected function getCores()
17
    {
18
        if (null === $this->cores) {
19
            $this->cores = $this->options['reader']->read($this->options['class'], ChildCoreInterface::class);
20
            uasort($this->cores, function(ChildCoreInterface $core, ChildCoreInterface $core2) {
21
                return $core->getSequence() > $core2->getSequence();
22
            });
23
        }
24
25
        return $this->cores;
26
    }
27
28
    protected function initResult()
29
    {
30
        return new $this->options['class'];
31
    }
32
33
    private function moveToNextLine()
0 ignored issues
show
Bug introduced by
Consider using a different method name as you override a private method of the parent class.

Overwriting private methods is generally fine as long as you also use private visibility. It might still be preferable for understandability to use a different method name.

Loading history...
Unused Code introduced by
This method is not used, and could be removed.
Loading history...
34
    {
35
        $this->getStream()->next();
36
37
        return $this->getStream()->valid();
38
    }
39
}
40