Completed
Push — master ( 2de74b...31cc6d )
by Amine
02:41
created
src/Templates/TwigTemplate.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
      */
22 22
     protected $data;
23 23
 
24
-    public function __construct (\Twig_TemplateInterface $twig)
24
+    public function __construct(\Twig_TemplateInterface $twig)
25 25
     {
26 26
         $this->twig = $twig;
27 27
         $this->data = [];
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      * @param  array $data
34 34
      * @return self
35 35
      */
36
-    public function bind ($data)
36
+    public function bind($data)
37 37
     {
38 38
         $this->data = array_merge($this->data, $data);
39 39
         return $this;
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
      *
58 58
      * @return self
59 59
      */
60
-    public function clean ()
60
+    public function clean()
61 61
     {
62 62
         $this->data = [];
63 63
     }
Please login to merge, or discard this patch.
src/Environment.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@
 block discarded – undo
73 73
     public function command($name, $value = null)
74 74
     {
75 75
         if (null === $value) {
76
-            if (! $this->hasCommand($name)) {
76
+            if (!$this->hasCommand($name)) {
77 77
                 throw new EnvironmentException("Unable to find the command '{$name}'");
78 78
             }
79 79
             return $this->store->get($name);
Please login to merge, or discard this patch.
src/Syntax/SyntaxBuilder.php 2 patches
Spacing   +6 added lines, -7 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     {
42 42
         if (is_string($syntax)) {
43 43
             $syntax = self::syntaxFromString($syntax);
44
-        } else if (! ($syntax instanceof ObjectSyntax)) {
44
+        } else if (!($syntax instanceof ObjectSyntax)) {
45 45
             throw new SyntaxBuilderException("The command syntax should be an insatnce of ObjectSyntax");
46 46
         }
47 47
 
@@ -65,11 +65,11 @@  discard block
 block discarded – undo
65 65
      * @return Tarsana\Syntax\Syntax
66 66
      * @throws Tarsana\Command\Exceptions\SyntaxBuilderException
67 67
      */
68
-    protected static function syntaxFromString ($value)
68
+    protected static function syntaxFromString($value)
69 69
     {
70 70
         $syntax = F\s($value)->then(        // "first name" [#age]
71
-            F\chunks('(){}[]""', ' '),      // ["first name", [#age]]
72
-            F\join(','),                    // "first name",[#age]
71
+            F\chunks('(){}[]""', ' '), // ["first name", [#age]]
72
+            F\join(','), // "first name",[#age]
73 73
             F\prepend('{ ,'), F\append('}') // { ,"first name",[#age]}
74 74
         )->get();
75 75
 
@@ -111,8 +111,7 @@  discard block
 block discarded – undo
111 111
      */
112 112
     protected function field(Syntax $syntax, $names)
113 113
     {
114
-        return empty($names) ? $syntax :
115
-            $this->field(
114
+        return empty($names) ? $syntax : $this->field(
116 115
                 $this->ensureObject($syntax)->field(F\head($names)),
117 116
                 F\tail($names)
118 117
             );
@@ -131,7 +130,7 @@  discard block
 block discarded – undo
131 130
         while ($syntax instanceof ArraySyntax) {
132 131
             $syntax = $syntax->itemSyntax();
133 132
         }
134
-        if (! ($syntax instanceof ObjectSyntax)) {
133
+        if (!($syntax instanceof ObjectSyntax)) {
135 134
             throw new SyntaxBuilderException("Could not retreive field of non object syntax '{$syntax}'");
136 135
         }
137 136
         return $syntax;
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -75,8 +75,9 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Commands/VersionCommand.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 
8 8
 class VersionCommand extends SubCommand {
9 9
 
10
-    protected function init ()
10
+    protected function init()
11 11
     {
12 12
         $this
13 13
             ->name('Version')
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
             ->description('Shows the version of the command');
16 16
     }
17 17
 
18
-    protected function execute ()
18
+    protected function execute()
19 19
     {
20 20
         $c = $this->parent();
21 21
         $this->console
Please login to merge, or discard this patch.
src/Commands/HelpCommand.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 
13 13
 class HelpCommand extends SubCommand {
14 14
 
15
-    protected function init ()
15
+    protected function init()
16 16
     {
17 17
         $this
18 18
             ->name('Help')
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
             ->syntax('[command]');
22 22
     }
23 23
 
24
-    protected function execute ()
24
+    protected function execute()
25 25
     {
26 26
         $command = trim($this->args->command);
27 27
         if (empty($command) || !$this->parent()->hasCommand($command))
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
             $this->showHelpOf($this->parent->command($command));
31 31
     }
32 32
 
33
-    protected function showHelpOf (Command $command)
33
+    protected function showHelpOf(Command $command)
34 34
     {
35 35
         $c = $this->console();
36 36
 
Please login to merge, or discard this patch.
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,10 +24,11 @@
 block discarded – undo
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)
Please login to merge, or discard this patch.
src/Utils/Store.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
     public function store($name, $value)
72 72
     {
73 73
         // Validates the name
74
-        if (! is_string($name)) {
74
+        if (!is_string($name)) {
75 75
             $this->error('The name must be a string');
76 76
         }
77 77
         if ($this->contains($name)) {
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 
81 81
         // Validates the value
82 82
         if (is_string($value)) {
83
-            if (! class_exists($value)) {
83
+            if (!class_exists($value)) {
84 84
                 $this->error("Trying to store an unknow class '{$value}'");
85 85
             }
86 86
             if ($value != $this->type && !is_subclass_of($value, $this->type)) {
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
      */
121 121
     public function get($name)
122 122
     {
123
-        if (! $this->contains($name)) {
123
+        if (!$this->contains($name)) {
124 124
             $this->error("The element with name '{$name}' is missing");
125 125
         }
126 126
 
Please login to merge, or discard this patch.
src/TemplateLoader.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
      * @param  Tarsana\IO\Filesystem|void $value
62 62
      * @return Tarsana\IO\Filesystem|self
63 63
      */
64
-    public function fs (Filesystem $value = null)
64
+    public function fs(Filesystem $value = null)
65 65
     {
66 66
         if (null === $value)
67 67
             return $this->fs;
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      * @throws Tarsana\Command\Exceptions\TemplateNotFound
82 82
      * @throws Tarsana\Command\Exceptions\TemplateNameConflict
83 83
      */
84
-    public function load ($name)
84
+    public function load($name)
85 85
     {
86 86
         $suportedExtensions = array_keys(self::$providers);
87 87
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -63,8 +63,9 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Command.php 2 patches
Braces   +33 added lines, -24 removed lines patch added patch discarded remove patch
@@ -109,8 +109,9 @@  discard block
 block discarded – undo
109 109
      */
110 110
     public function name ($value = null)
111 111
     {
112
-        if (null === $value)
113
-            return $this->name;
112
+        if (null === $value) {
113
+                    return $this->name;
114
+        }
114 115
 
115 116
         $this->name = $value;
116 117
         return $this;
@@ -124,8 +125,9 @@  discard block
 block discarded – undo
124 125
      */
125 126
     public function description ($value = null)
126 127
     {
127
-        if (null === $value)
128
-            return $this->description;
128
+        if (null === $value) {
129
+                    return $this->description;
130
+        }
129 131
 
130 132
         $this->description = $value;
131 133
         return $this;
@@ -139,8 +141,9 @@  discard block
 block discarded – undo
139 141
      */
140 142
     public function version ($value = null)
141 143
     {
142
-        if (null === $value)
143
-            return $this->version;
144
+        if (null === $value) {
145
+                    return $this->version;
146
+        }
144 147
 
145 148
         $this->version = $value;
146 149
         return $this;
@@ -154,8 +157,9 @@  discard block
 block discarded – undo
154 157
      */
155 158
     public function console ($value = null)
156 159
     {
157
-        if (null === $value)
158
-            return $this->console;
160
+        if (null === $value) {
161
+                    return $this->console;
162
+        }
159 163
 
160 164
         $this->console = $value;
161 165
         return $this;
@@ -170,8 +174,9 @@  discard block
 block discarded – undo
170 174
      */
171 175
     public function syntax ($value = null)
172 176
     {
173
-        if (null === $value)
174
-            return $this->syntaxBuilder->get();
177
+        if (null === $value) {
178
+                    return $this->syntaxBuilder->get();
179
+        }
175 180
 
176 181
         $this->syntaxBuilder = SyntaxBuilder::of($value);
177 182
 
@@ -219,8 +224,9 @@  discard block
 block discarded – undo
219 224
     public function command ($name, Command $cmd = null)
220 225
     {
221 226
         if (null === $cmd) {
222
-            if (!$this->hasCommand($name))
223
-                throw new CommandNotFound("Command '{$this->name}' has no subcommand '{$name}'");
227
+            if (!$this->hasCommand($name)) {
228
+                            throw new CommandNotFound("Command '{$this->name}' has no subcommand '{$name}'");
229
+            }
224 230
             return $this->subCommands[$name];
225 231
         }
226 232
 
@@ -246,8 +252,9 @@  discard block
 block discarded – undo
246 252
      */
247 253
     public function args($value = null)
248 254
     {
249
-        if (null === $value)
250
-            return $this->args;
255
+        if (null === $value) {
256
+                    return $this->args;
257
+        }
251 258
 
252 259
         $this->args = $value;
253 260
         return $this;
@@ -307,10 +314,12 @@  discard block
 block discarded – undo
307 314
     {
308 315
         try {
309 316
 
310
-            if (null === $args)
311
-                $args = $this->consoleArguments();
312
-            if (null === $console)
313
-                $console = new CLImate;
317
+            if (null === $args) {
318
+                            $args = $this->consoleArguments();
319
+            }
320
+            if (null === $console) {
321
+                            $console = new CLImate;
322
+            }
314 323
 
315 324
             $firstArg = F\head(F\split(' ', $args));
316 325
             if ($this->hasCommand($firstArg)) {
@@ -324,11 +333,10 @@  discard block
 block discarded – undo
324 333
                         ->then(F\join(PHP_EOL))
325 334
                         ->get();
326 335
                     $this->error($errors);
327
-                }
328
-
329
-                else
330
-                    $this->args($this->syntax()->parse($args))
336
+                } else {
337
+                                    $this->args($this->syntax()->parse($args))
331 338
                          ->execute();
339
+                }
332 340
             }
333 341
         } catch (\Exception $e) {
334 342
             $this->error(
@@ -347,8 +355,9 @@  discard block
 block discarded – undo
347 355
      */
348 356
     protected function template($name)
349 357
     {
350
-        if (null === $this->templateLoader)
351
-            throw new NullPropertyAccess("The templatesLoader is not initialized; Please set it before trying to load a template !");
358
+        if (null === $this->templateLoader) {
359
+                    throw new NullPropertyAccess("The templatesLoader is not initialized; Please set it before trying to load a template !");
360
+        }
352 361
 
353 362
         return $this->templateLoader->load($name);
354 363
     }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
                 $this->command($firstArg)->run($args, $console);
318 318
             } else {
319 319
                 $this->console($console);
320
-                if (! $this->syntax()->canParse($args)) {
320
+                if (!$this->syntax()->canParse($args)) {
321 321
                     $errors = F\s($this->syntax()->checkParse($args))
322 322
                         ->then(F\append("Invalid arguments: '{$args}' for command '{$this->name}'"))
323 323
                         ->then(F\join(PHP_EOL))
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
      */
376 376
     protected function addDefaultSubCommands()
377 377
     {
378
-        if (! ($this instanceof HelpCommand) && ! ($this instanceof VersionCommand)) {
378
+        if (!($this instanceof HelpCommand) && !($this instanceof VersionCommand)) {
379 379
             $this->command('--version', new VersionCommand($this));
380 380
             $this->command('--help', new HelpCommand($this));
381 381
         }
Please login to merge, or discard this patch.