1 | <?php |
||
7 | class PhpCsFixer implements ToolInterface |
||
8 | { |
||
9 | /** |
||
10 | * @var Undefined |
||
11 | */ |
||
12 | private $undefined; |
||
13 | /** |
||
14 | * @var Enabled |
||
15 | */ |
||
16 | private $enabled; |
||
17 | /** |
||
18 | * @var PhpCsFixerLevels |
||
19 | */ |
||
20 | private $levels; |
||
21 | /** |
||
22 | * @var PhpCsFixerOptions |
||
23 | */ |
||
24 | private $options; |
||
25 | |||
26 | /** |
||
27 | * PhpCsFixer constructor. |
||
28 | * |
||
29 | * @param Undefined $undefined |
||
30 | * @param Enabled $enabled |
||
31 | * @param PhpCsFixerLevels $levels |
||
32 | * @param PhpCsFixerOptions $options |
||
33 | */ |
||
34 | 6 | public function __construct( |
|
45 | |||
46 | /** |
||
47 | * @return bool |
||
48 | */ |
||
49 | 3 | public function isEnabled() |
|
53 | |||
54 | /** |
||
55 | * @return bool |
||
56 | */ |
||
57 | 2 | public function isUndefined() |
|
61 | |||
62 | /** |
||
63 | * @return PhpCsFixerLevels |
||
64 | */ |
||
65 | 3 | public function getLevels() |
|
69 | |||
70 | /** |
||
71 | * @param Enabled $enabled |
||
72 | * |
||
73 | * @return PhpCsFixer |
||
74 | */ |
||
75 | 2 | public function setEnabled(Enabled $enabled) |
|
76 | { |
||
77 | 2 | $levels = false === $enabled->value() ? |
|
78 | 1 | new PhpCsFixerLevels( |
|
79 | 1 | new Level(false), |
|
80 | 1 | new Level(false), |
|
81 | 1 | new Level(false), |
|
82 | 1 | new Level(false) |
|
83 | 2 | ) : $this->levels; |
|
84 | |||
85 | 2 | return new self( |
|
86 | 2 | new Undefined(false), |
|
87 | $enabled, |
||
88 | $levels, |
||
89 | 2 | $this->options |
|
90 | ); |
||
91 | } |
||
92 | |||
93 | /** |
||
94 | * @param PhpCsFixerLevels $levels |
||
95 | * |
||
96 | * @return PhpCsFixer |
||
97 | */ |
||
98 | 1 | public function addLevels(PhpCsFixerLevels $levels) |
|
99 | { |
||
100 | 1 | return new self( |
|
101 | 1 | $this->undefined, |
|
102 | 1 | $this->enabled, |
|
103 | $levels, |
||
104 | 1 | $this->options |
|
105 | ); |
||
106 | } |
||
107 | |||
108 | /** |
||
109 | * @return PhpCsFixerOptions |
||
110 | */ |
||
111 | 3 | public function getOptions() |
|
115 | |||
116 | /** |
||
117 | * @param PhpCsFixerOptions $options |
||
118 | * |
||
119 | * @return PhpCsFixer |
||
120 | */ |
||
121 | 1 | public function setOptions(PhpCsFixerOptions $options) |
|
130 | } |
||
131 |