DefaultDriverFactory::createDriver()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 2
dl 0
loc 13
rs 9.8333
c 0
b 0
f 0
1
<?php
2
3
namespace Novaway\Component\OpenGraph\Builder;
4
5
use Doctrine\Common\Annotations\Reader;
6
use Metadata\Driver\DriverChain;
7
use Metadata\Driver\FileLocator;
8
use Novaway\Component\OpenGraph\Metadata\Driver\AnnotationDriver;
9
use Novaway\Component\OpenGraph\Metadata\Driver\YamlDriver;
10
11
class DefaultDriverFactory
12
{
13
    /**
14
     * Create driver
15
     *
16
     * @param array  $metadataDirs
0 ignored issues
show
Bug introduced by
There is no parameter named $metadataDirs. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
17
     * @param Reader $annotationReader
18
     * @return DefaultDriverFactory
19
     */
20
    public function createDriver(array $metadataDirectories, Reader $annotationReader)
21
    {
22
        if (!empty($metadataDirectories)) {
23
            $fileLocator = new FileLocator($metadataDirectories);
24
25
            return new DriverChain([
26
                new YamlDriver($fileLocator),
27
                new AnnotationDriver($annotationReader),
28
            ]);
29
        }
30
31
        return new AnnotationDriver($annotationReader);
32
    }
33
}
34