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

AbstractAnnotationReadable   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 4
dl 0
loc 30
c 0
b 0
f 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getCores() 0 11 2
A initResult() 0 4 1
A moveToNextLine() 0 6 1
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