Completed
Pull Request — develop (#27)
by Chris
12:16
created

AbstractAnnotationReadable::getCores()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
c 0
b 0
f 0
rs 9.4285
cc 2
eloc 6
nc 2
nop 0
1
<?php
2
3
namespace Chrisyue\PhpM3u8\M3u8\Core;
4
5
use Chrisyue\PhpM3u8\M3u8\OptionsTrait;
6
7
abstract class AbstractAnnotationReadable extends AbstractParentCore
8
{
9
    use OptionsTrait;
10
11
    private $cores;
12
13
    protected function getCores()
14
    {
15
        if (null === $this->cores) {
16
            $this->cores = $this->options['reader']->read($this->options['class'], ChildCoreInterface::class);
17
            uasort($this->cores, function (ChildCoreInterface $core, ChildCoreInterface $core2) {
18
                return $core->getSequence() > $core2->getSequence();
19
            });
20
        }
21
22
        return $this->cores;
23
    }
24
25
    protected function initResult()
26
    {
27
        return new $this->options['class']();
28
    }
29
30
    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...
31
    {
32
        $this->getStream()->next();
33
34
        return $this->getStream()->valid();
35
    }
36
}
37