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

ConfigurationResolverFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 3
dl 0
loc 34
ccs 10
cts 10
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A create() 0 10 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