Launcher   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 5
Bugs 1 Features 2
Metric Value
wmc 3
c 5
b 1
f 2
lcom 0
cbo 4
dl 0
loc 43
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A main() 0 5 1
A run() 0 7 1
A setup() 0 10 1
1
<?php
2
3
namespace Matks\PHPMakeUp;
4
5
use Matks\PHPMakeUp\File\FileManager;
6
use Matks\PHPMakeUp\LineAlignment\LineAligner;
7
use Matks\PHPMakeUp\UseSorting\UseSortingManager;
8
9
/**
10
 * PHPMakeUp Launcher
11
 *
12
 * This class setups the PHPMakeUp tool
13
 */
14
class Launcher
15
{
16
17
    /**
18
     * Main
19
     *
20
     * @param string $filepath
21
     */
22
    public static function main($filepath)
23
    {
24
        $launcher = new Launcher();
25
        $launcher->run((string) $filepath);
26
    }
27
28
    /**
29
     * Run
30
     *
31
     * @param string $filepath
32
     */
33
    public function run($filepath)
34
    {
35
        $phpCleaner = $this->setup();
36
        $phpCleaner->clean($filepath);
37
38
        die(0);
0 ignored issues
show
Coding Style Compatibility introduced by
The method run() contains an exit expression.

An exit expression should only be used in rare cases. For example, if you write a short command line script.

In most cases however, using an exit expression makes the code untestable and often causes incompatibilities with other libraries. Thus, unless you are absolutely sure it is required here, we recommend to refactor your code to avoid its usage.

Loading history...
39
    }
40
41
    /**
42
     * Construct PHPCleaner instance with its dependencies
43
     *
44
     * @return PHPCleaner
45
     */
46
    private function setup()
47
    {
48
        $fileManager       = new FileManager();
49
        $lineAligner       = new LineAligner($fileManager);
50
        $useSortingManager = new UseSortingManager($fileManager);
51
52
        $phpCleaner = new phpCleaner($lineAligner, $useSortingManager);
53
54
        return $phpCleaner;
55
    }
56
}
57