Completed
Pull Request — master (#10)
by Tomáš
31:42
created

Application   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 0%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A runCommand() 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\Application;
9
10
use Symfony\CS\Fixer;
11
use Symplify\MultiCodingStandard\PhpCsFixer\Application\Command\RunApplicationCommand;
12
use Symplify\MultiCodingStandard\PhpCsFixer\Factory\FixerSetFactory;
13
14
final class Application
15
{
16
    /**
17
     * @var Fixer
18
     */
19
    private $fixer;
20
21
    /**
22
     * @var FixerSetFactory
23
     */
24
    private $fixerSetFactory;
25
26
    public function __construct(Fixer $fixer, FixerSetFactory $fixerSetFactory)
27
    {
28
        $this->fixer = $fixer;
29
        $this->fixerSetFactory = $fixerSetFactory;
30
    }
31
32
    public function runCommand(RunApplicationCommand $command)
33
    {
34
        $fixers = $this->fixerSetFactory->createFromLevelsFixersAndExcludedFixers(
35
            $command->getFixerLevels(),
36
            $command->getFixers(),
37
            $command->getExcludeFixers()
38
        );
39
40
        $this->fixer->registerCustomFixers($fixers);
41
    }
42
}
43