Completed
Pull Request — master (#1289)
by Johannes
13:58
created

DocBlockDriverFactory::createDriver()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 5
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace JMS\Serializer\Metadata\Driver;
6
7
use Doctrine\Common\Annotations\Reader;
8
use JMS\Serializer\Builder\DriverFactoryInterface;
9
use JMS\Serializer\Type\ParserInterface;
10
use Metadata\Driver\DriverInterface;
11
12
class DocBlockDriverFactory implements DriverFactoryInterface
13
{
14
    /**
15
     * @var DriverFactoryInterface
16
     */
17
    private $driverFactoryToDecorate;
18
    /**
19
     * @var ParserInterface|null
20
     */
21
    private $typeParser;
22
23
    public function __construct(DriverFactoryInterface $driverFactoryToDecorate, ?ParserInterface $typeParser = null)
24
    {
25
        $this->driverFactoryToDecorate = $driverFactoryToDecorate;
26
        $this->typeParser = $typeParser;
27
    }
28
29
    public function createDriver(array $metadataDirs, Reader $annotationReader): DriverInterface
30
    {
31
        $driver = $this->driverFactoryToDecorate->createDriver($metadataDirs, $annotationReader);
32
33
        return new DocBlockDriver($driver, $this->typeParser);
34
    }
35
}
36