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

DocBlockDriverFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 22
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A createDriver() 0 5 1
A __construct() 0 4 1
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