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

AbstractParentAnnotReadableFactory   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A initParsers() 0 12 3
1
<?php
2
3
namespace Chrisyue\PhpM3u8\PdFactory;
4
5
use Chrisyue\PhpM3u8\Parser\ParsersInterface;
6
use Chrisyue\PhpM3u8\PropertyReader\PropertyReaderInterface;
7
use Chrisyue\PhpM3u8\PropertyReader\PropertyReaderAwareInterface;
8
use Chrisyue\PhpM3u8\PropertyReader\PropertyReaderAwareTrait;
9
10
abstract class AbstractParentAnnotReadableFactory implements PdFactoryInterface, PropertyReaderAwareInterface
11
{
12
    use PropertyReaderAwareTrait;
13
14
    public function initParsers(ParsersInterface $parsers, $class)
15
    {
16
        foreach ($this->reader->read($class, PdFactoryInterface::class) as $key => $factory) {
17
            if ($factory instanceof PropertyReaderAwareInterface) {
18
                $factory->setReader($this->reader);
19
            }
20
21
            $parsers->set($key, $factory->createParser());
22
        }
23
24
        return $parsers;
25
    }
26
}
27