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

ConfigurationResolverFactory::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 7
ccs 4
cts 4
cp 1
rs 9.4285
cc 1
eloc 5
nc 1
nop 2
crap 1
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;
9
10
use Symfony\CS\ConfigurationResolver;
11
use Symplify\MultiCodingStandard\Contract\PhpCsFixer\FileSystem\FixerFileSystemInterface;
12
use Symplify\MultiCodingStandard\PhpCsFixer\Fixer\FixerFactory;
13
14
final class ConfigurationResolverFactory
15
{
16
    /**
17
     * @var FixerFileSystemInterface
18
     */
19
    private $fixerFileSystem;
20
21
    /**
22
     * @var FixerFactory
23
     */
24
    private $fixerFactory;
25
26 1
    public function __construct(
27
        FixerFileSystemInterface $fixerFileSystem,
28
        FixerFactory $fixerFactory
29
    ) {
30 1
        $this->fixerFileSystem = $fixerFileSystem;
31 1
        $this->fixerFactory = $fixerFactory;
32 1
    }
33
34
    /**
35
     * @return ConfigurationResolver
36
     */
37 1
    public function create()
38
    {
39 1
        $allFixerFiles = $this->fixerFileSystem->findAllFixers();
40 1
        $allFixerObjects = $this->fixerFactory->createFixersFromFiles($allFixerFiles);
41
42 1
        $configurationResolver = new ConfigurationResolver();
43 1
        $configurationResolver->setAllFixers($allFixerObjects);
44
45 1
        return $configurationResolver;
46
    }
47
}
48