@@ -75,8 +75,9 @@ |
||
75 | 75 | |
76 | 76 | $ss = S::syntax(); |
77 | 77 | |
78 | - if (!$ss->canParse($syntax)) |
|
79 | - throw new SyntaxBuilderException("Invalid Syntax: '{$syntax}'"); |
|
78 | + if (!$ss->canParse($syntax)) { |
|
79 | + throw new SyntaxBuilderException("Invalid Syntax: '{$syntax}'"); |
|
80 | + } |
|
80 | 81 | |
81 | 82 | return $ss->parse($syntax); |
82 | 83 | } |
@@ -19,8 +19,8 @@ |
||
19 | 19 | { |
20 | 20 | $c = $this->parent(); |
21 | 21 | $this->console |
22 | - ->green()->inline($c->name()) |
|
23 | - ->white()->inline(' version ') |
|
24 | - ->yellow()->out($c->version()); |
|
22 | + ->green()->inline($c->name()) |
|
23 | + ->white()->inline(' version ') |
|
24 | + ->yellow()->out($c->version()); |
|
25 | 25 | } |
26 | 26 | } |
@@ -35,15 +35,15 @@ discard block |
||
35 | 35 | $c = $this->console(); |
36 | 36 | |
37 | 37 | $c->br() |
38 | - ->green() |
|
39 | - ->inline($command->name() . ' ') |
|
40 | - ->yellow() |
|
41 | - ->out($command->version()) |
|
42 | - ->br() |
|
43 | - ->out($command->description()) |
|
44 | - ->br() |
|
45 | - ->yellow() |
|
46 | - ->inline('Arguments: '); |
|
38 | + ->green() |
|
39 | + ->inline($command->name() . ' ') |
|
40 | + ->yellow() |
|
41 | + ->out($command->version()) |
|
42 | + ->br() |
|
43 | + ->out($command->description()) |
|
44 | + ->br() |
|
45 | + ->yellow() |
|
46 | + ->inline('Arguments: '); |
|
47 | 47 | |
48 | 48 | $args = F\s(array_keys($command->syntax()->fields())) |
49 | 49 | ->then(F\join(' ')) |
@@ -67,9 +67,9 @@ discard block |
||
67 | 67 | ->get() * 2; |
68 | 68 | foreach ($command->subCommands() as $name => $cmd) { |
69 | 69 | $c->tab() |
70 | - ->padding($padding)->char(' ') |
|
71 | - ->label("<green>{$name}</green>") |
|
72 | - ->result($cmd->description()); |
|
70 | + ->padding($padding)->char(' ') |
|
71 | + ->label("<green>{$name}</green>") |
|
72 | + ->result($cmd->description()); |
|
73 | 73 | } |
74 | 74 | } |
75 | 75 | } |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | $c->out("(Required)"); |
87 | 87 | } else { |
88 | 88 | $c->inline("(default: ") |
89 | - ->white()->inline(json_encode($syntax->getDefault())) |
|
90 | - ->yellow()->out(" )"); |
|
89 | + ->white()->inline(json_encode($syntax->getDefault())) |
|
90 | + ->yellow()->out(" )"); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | if ($syntax instanceof ArraySyntax) { |
@@ -24,10 +24,11 @@ |
||
24 | 24 | protected function execute () |
25 | 25 | { |
26 | 26 | $command = trim($this->args->command); |
27 | - if (empty($command) || !$this->parent()->hasCommand($command)) |
|
28 | - $this->showHelpOf($this->parent); |
|
29 | - else |
|
30 | - $this->showHelpOf($this->parent->command($command)); |
|
27 | + if (empty($command) || !$this->parent()->hasCommand($command)) { |
|
28 | + $this->showHelpOf($this->parent); |
|
29 | + } else { |
|
30 | + $this->showHelpOf($this->parent->command($command)); |
|
31 | + } |
|
31 | 32 | } |
32 | 33 | |
33 | 34 | protected function showHelpOf (Command $command) |
@@ -63,8 +63,9 @@ |
||
63 | 63 | */ |
64 | 64 | public function fs (Filesystem $value = null) |
65 | 65 | { |
66 | - if (null === $value) |
|
67 | - return $this->fs; |
|
66 | + if (null === $value) { |
|
67 | + return $this->fs; |
|
68 | + } |
|
68 | 69 | $this->fs = $value; |
69 | 70 | return $this; |
70 | 71 | } |
@@ -328,7 +328,7 @@ |
||
328 | 328 | |
329 | 329 | else |
330 | 330 | $this->args($this->syntax()->parse($args)) |
331 | - ->execute(); |
|
331 | + ->execute(); |
|
332 | 332 | } |
333 | 333 | } catch (\Exception $e) { |
334 | 334 | $this->error( |
@@ -108,8 +108,9 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function name($value = null) |
110 | 110 | { |
111 | - if (null === $value) |
|
112 | - return $this->name; |
|
111 | + if (null === $value) { |
|
112 | + return $this->name; |
|
113 | + } |
|
113 | 114 | |
114 | 115 | $this->name = $value; |
115 | 116 | return $this; |
@@ -123,8 +124,9 @@ discard block |
||
123 | 124 | */ |
124 | 125 | public function description($value = null) |
125 | 126 | { |
126 | - if (null === $value) |
|
127 | - return $this->description; |
|
127 | + if (null === $value) { |
|
128 | + return $this->description; |
|
129 | + } |
|
128 | 130 | |
129 | 131 | $this->description = $value; |
130 | 132 | return $this; |
@@ -138,8 +140,9 @@ discard block |
||
138 | 140 | */ |
139 | 141 | public function version($value = null) |
140 | 142 | { |
141 | - if (null === $value) |
|
142 | - return $this->version; |
|
143 | + if (null === $value) { |
|
144 | + return $this->version; |
|
145 | + } |
|
143 | 146 | |
144 | 147 | $this->version = $value; |
145 | 148 | return $this; |
@@ -153,8 +156,9 @@ discard block |
||
153 | 156 | */ |
154 | 157 | public function console($value = null) |
155 | 158 | { |
156 | - if (null === $value) |
|
157 | - return $this->console; |
|
159 | + if (null === $value) { |
|
160 | + return $this->console; |
|
161 | + } |
|
158 | 162 | |
159 | 163 | $this->console = $value; |
160 | 164 | return $this; |
@@ -169,8 +173,9 @@ discard block |
||
169 | 173 | */ |
170 | 174 | public function syntax($value = null) |
171 | 175 | { |
172 | - if (null === $value) |
|
173 | - return $this->syntaxBuilder->get(); |
|
176 | + if (null === $value) { |
|
177 | + return $this->syntaxBuilder->get(); |
|
178 | + } |
|
174 | 179 | |
175 | 180 | $this->syntaxBuilder = SyntaxBuilder::of($value); |
176 | 181 | |
@@ -218,8 +223,9 @@ discard block |
||
218 | 223 | public function command($name, Command $cmd = null) |
219 | 224 | { |
220 | 225 | if (null === $cmd) { |
221 | - if (!$this->hasCommand($name)) |
|
222 | - throw new CommandNotFound("Command '{$this->name}' has no subcommand '{$name}'"); |
|
226 | + if (!$this->hasCommand($name)) { |
|
227 | + throw new CommandNotFound("Command '{$this->name}' has no subcommand '{$name}'"); |
|
228 | + } |
|
223 | 229 | return $this->subCommands[$name]; |
224 | 230 | } |
225 | 231 | |
@@ -245,8 +251,9 @@ discard block |
||
245 | 251 | */ |
246 | 252 | public function args($value = null) |
247 | 253 | { |
248 | - if (null === $value) |
|
249 | - return $this->args; |
|
254 | + if (null === $value) { |
|
255 | + return $this->args; |
|
256 | + } |
|
250 | 257 | |
251 | 258 | $this->args = $value; |
252 | 259 | return $this; |
@@ -346,8 +353,9 @@ discard block |
||
346 | 353 | */ |
347 | 354 | protected function template($name) |
348 | 355 | { |
349 | - if (null === $this->templateLoader) |
|
350 | - throw new NullPropertyAccess("The templatesLoader is not initialized; Please set it before trying to load a template !"); |
|
356 | + if (null === $this->templateLoader) { |
|
357 | + throw new NullPropertyAccess("The templatesLoader is not initialized; Please set it before trying to load a template !"); |
|
358 | + } |
|
351 | 359 | |
352 | 360 | return $this->templateLoader->load($name); |
353 | 361 | } |