Completed
Push — master ( fe5f39...abd96b )
by Tomáš
05:18 queued 02:13
created

FixerFactory::createFixersFromFiles()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 11
ccs 7
cts 7
cp 1
rs 9.4285
cc 3
eloc 7
nc 3
nop 1
crap 3
1
<?php
2
3
/*
4
 * This file is part of Symplify
5
 * Copyright (c) 2016 Tomas Votruba (http://tomasvotruba.cz).
6
 */
7
8
namespace Symplify\MultiCodingStandard\PhpCsFixer\Fixer;
9
10
use Symfony\CS\FixerInterface;
11
12
final class FixerFactory
13
{
14
    /**
15
     * @param string[] $files
16
     * @return FixerInterface[]
17
     */
18 1
    public function createFixersFromFiles(array $files)
19
    {
20 1
        $fixers = [];
21 1
        foreach ($files as $file) {
22 1
            $relativeNamespace = $file->getRelativePath();
0 ignored issues
show
Bug introduced by
The method getRelativePath cannot be called on $file (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
23 1
            $class = 'Symfony\\CS\\Fixer\\' . ($relativeNamespace ? $relativeNamespace . '\\' : '') . $file->getBasename('.php');
0 ignored issues
show
Bug introduced by
The method getBasename cannot be called on $file (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
24 1
            $fixers[] = new $class;
25
        }
26
27 1
        return $fixers;
28
    }
29
}
30