Completed
Pull Request — master (#10)
by Amine
01:38
created
src/Template/TemplateLoader.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@
 block discarded – undo
69 69
      * or if many exists.
70 70
      *
71 71
      * @param  string $name
72
-     * @return Tarsana\Command\Interfaces\TemplateInterface
72
+     * @return TemplateInterface
73 73
      * @throws Tarsana\Command\Exceptions\TemplateNotFound
74 74
      * @throws Tarsana\Command\Exceptions\TemplateNameConflict
75 75
      */
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@
 block discarded – undo
73 73
      * @throws Tarsana\Command\Exceptions\TemplateNotFound
74 74
      * @throws Tarsana\Command\Exceptions\TemplateNameConflict
75 75
      */
76
-    public function load (string $name) : TemplateInterface
76
+    public function load(string $name) : TemplateInterface
77 77
     {
78 78
         $supportedExtensions = array_keys(self::$providers);
79 79
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -87,8 +87,9 @@
 block discarded – undo
87 87
         $found = [];
88 88
         foreach ($files as $file) {
89 89
             $ext = $file->extension();
90
-            if (!in_array($ext, $supportedExtensions))
91
-                continue;
90
+            if (!in_array($ext, $supportedExtensions)) {
91
+                            continue;
92
+            }
92 93
             $found[] = [
93 94
                 'name' => substr($file->path(), $fsPathLength),
94 95
                 'extension' => $ext
Please login to merge, or discard this patch.
src/Console/ExceptionPrinter.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@
 block discarded – undo
62 62
         }
63 63
         if ($s instanceof ArraySyntax) {
64 64
             if ($short) return 'array';
65
-            return $this->printSyntax($s->syntax()).$s->separator().'...';
65
+            return $this->printSyntax($s->syntax()) . $s->separator() . '...';
66 66
         }
67 67
         return (string) $s;
68 68
     }
Please login to merge, or discard this patch.
Braces   +18 added lines, -10 removed lines patch added patch discarded remove patch
@@ -18,8 +18,9 @@  discard block
 block discarded – undo
18 18
      */
19 19
     public function print(\Exception $e) : string
20 20
     {
21
-        if ($e instanceof ParseException)
22
-            return $this->printParseException($e);
21
+        if ($e instanceof ParseException) {
22
+                    return $this->printParseException($e);
23
+        }
23 24
 
24 25
         return "<error>{$e}</error>";
25 26
     }
@@ -36,10 +37,12 @@  discard block
 block discarded – undo
36 37
         $error  = '';
37 38
         if ($syntax instanceof ObjectSyntax) {
38 39
             $i = $e->extra();
39
-            if ($i['type'] == 'invalid-field')
40
-                $error = "{$i['field']} is invalid!";
41
-            if ($i['type'] == 'missing-field')
42
-                $error = "{$i['field']} is missing!";
40
+            if ($i['type'] == 'invalid-field') {
41
+                            $error = "{$i['field']} is invalid!";
42
+            }
43
+            if ($i['type'] == 'missing-field') {
44
+                            $error = "{$i['field']} is missing!";
45
+            }
43 46
             if ($i['type'] == 'additional-items') {
44 47
                 $items = implode($syntax->separator(), $i['items']);
45 48
                 $error = "additional items {$items}";
@@ -48,8 +51,9 @@  discard block
 block discarded – undo
48 51
         $syntax = $this->printSyntax($e->syntax());
49 52
 
50 53
         $output = "<reset>Failed to parse <warn>'{$e->input()}'</warn> as <info>{$syntax}</info>";
51
-        if ('' != $error)
52
-            $output .= " <error>{$error}</error>";
54
+        if ('' != $error) {
55
+                    $output .= " <error>{$error}</error>";
56
+        }
53 57
 
54 58
         $previous = $e->previous();
55 59
         if ($previous) {
@@ -62,11 +66,15 @@  discard block
 block discarded – undo
62 66
     protected function printSyntax(Syntax $s, bool $short = false) : string
63 67
     {
64 68
         if ($s instanceof ObjectSyntax) {
65
-            if ($short) return 'object';
69
+            if ($short) {
70
+                return 'object';
71
+            }
66 72
             return implode($s->separator(), array_keys($s->fields()));
67 73
         }
68 74
         if ($s instanceof ArraySyntax) {
69
-            if ($short) return 'array';
75
+            if ($short) {
76
+                return 'array';
77
+            }
70 78
             return $this->printSyntax($s->syntax()).$s->separator().'...';
71 79
         }
72 80
         return (string) $s;
Please login to merge, or discard this patch.
src/Console/Console.php 2 patches
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -41,24 +41,27 @@
 block discarded – undo
41 41
 
42 42
     public function stdin(ReaderInterface $in = null)
43 43
     {
44
-        if (null === $in)
45
-            return $this->in;
44
+        if (null === $in) {
45
+                    return $this->in;
46
+        }
46 47
         $this->in = $in;
47 48
         return $this;
48 49
     }
49 50
 
50 51
     public function stdout(WriterInterface $out = null)
51 52
     {
52
-        if (null === $out)
53
-            return $this->out;
53
+        if (null === $out) {
54
+                    return $this->out;
55
+        }
54 56
         $this->out = $out;
55 57
         return $this;
56 58
     }
57 59
 
58 60
     public function stderr(WriterInterface $err = null)
59 61
     {
60
-        if (null === $err)
61
-            return $this->err;
62
+        if (null === $err) {
63
+                    return $this->err;
64
+        }
62 65
         $this->err = $err;
63 66
         return $this;
64 67
     }
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,6 @@
 block discarded – undo
7 7
 use Tarsana\IO\Interfaces\Resource\Writer as WriterInterface;
8 8
 use Tarsana\IO\Resource\Reader;
9 9
 use Tarsana\IO\Resource\Writer;
10
-use Tarsana\Syntax\Syntax;
11 10
 
12 11
 class Console implements ConsoleInterface {
13 12
 
Please login to merge, or discard this patch.
src/Template/Twig/TwigTemplate.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
      */
17 17
     protected $data;
18 18
 
19
-    public function __construct ($twig)
19
+    public function __construct($twig)
20 20
     {
21 21
         $this->twig = $twig;
22 22
         $this->data = [];
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
      * @param  array $data
29 29
      * @return self
30 30
      */
31
-    public function bind (array $data) : TemplateInterface
31
+    public function bind(array $data) : TemplateInterface
32 32
     {
33 33
         $this->data = array_merge($this->data, $data);
34 34
         return $this;
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
      *
53 53
      * @return self
54 54
      */
55
-    public function clear () : TemplateInterface
55
+    public function clear() : TemplateInterface
56 56
     {
57 57
         $this->data = [];
58 58
         return $this;
Please login to merge, or discard this patch.
examples/RepeatCommand.php 3 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -7,13 +7,13 @@
 block discarded – undo
7 7
     protected function init ()
8 8
     {
9 9
         $this->name('Repeat')
10
-             ->version('1.0.0')
11
-             ->description('Repeats a word a number of times')
12
-             ->syntax('word: string, count: (number: 3)')
13
-             ->options(['--upper'])
14
-             ->describe('word', 'The word to repeat')
15
-             ->describe('count', 'The number of times to repeat the word')
16
-             ->describe('--upper', 'Converts the result to uppercase');
10
+                ->version('1.0.0')
11
+                ->description('Repeats a word a number of times')
12
+                ->syntax('word: string, count: (number: 3)')
13
+                ->options(['--upper'])
14
+                ->describe('word', 'The word to repeat')
15
+                ->describe('count', 'The number of times to repeat the word')
16
+                ->describe('--upper', 'Converts the result to uppercase');
17 17
     }
18 18
 
19 19
     protected function execute()
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@
 block discarded – undo
4 4
 
5 5
 class RepeatCommand extends Command {
6 6
 
7
-    protected function init ()
7
+    protected function init()
8 8
     {
9 9
         $this->name('Repeat')
10 10
              ->version('1.0.0')
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,8 +19,9 @@
 block discarded – undo
19 19
     protected function execute()
20 20
     {
21 21
         $result = str_repeat($this->args->word, $this->args->count);
22
-        if ($this->option('--upper'))
23
-            $result = strtoupper($result);
22
+        if ($this->option('--upper')) {
23
+                    $result = strtoupper($result);
24
+        }
24 25
         $this->console->line($result);
25 26
     }
26 27
 
Please login to merge, or discard this patch.
examples/RenderCommand.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -7,12 +7,12 @@
 block discarded – undo
7 7
     protected function init ()
8 8
     {
9 9
         $this->name('Render')
10
-             ->version('1.0.0')
11
-             ->description('Renders the hello template.')
12
-             ->syntax('name: (string:You)')
13
-             ->describe('name', 'Your name.')
14
-             ->templatesPath(TEMPLATES_PATH);
15
-             // this points to /tests/resources/templates
10
+                ->version('1.0.0')
11
+                ->description('Renders the hello template.')
12
+                ->syntax('name: (string:You)')
13
+                ->describe('name', 'Your name.')
14
+                ->templatesPath(TEMPLATES_PATH);
15
+                // this points to /tests/resources/templates
16 16
     }
17 17
 
18 18
     protected function execute()
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@
 block discarded – undo
4 4
 
5 5
 class RenderCommand extends Command {
6 6
 
7
-    protected function init ()
7
+    protected function init()
8 8
     {
9 9
         $this->name('Render')
10 10
              ->version('1.0.0')
Please login to merge, or discard this patch.
examples/ListCommand.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,8 +7,8 @@
 block discarded – undo
7 7
     protected function init ()
8 8
     {
9 9
         $this->name('List')
10
-             ->version('1.0.0-alpha')
11
-             ->description('Lists files and directories in the current directory.');
10
+                ->version('1.0.0-alpha')
11
+                ->description('Lists files and directories in the current directory.');
12 12
     }
13 13
 
14 14
     protected function execute()
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 
5 5
 class ListCommand extends Command {
6 6
 
7
-    protected function init ()
7
+    protected function init()
8 8
     {
9 9
         $this->name('List')
10 10
              ->version('1.0.0-alpha')
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 
14 14
     protected function execute()
15 15
     {
16
-        foreach($this->fs->find('*')->asArray() as $file) {
16
+        foreach ($this->fs->find('*')->asArray() as $file) {
17 17
             $this->console->line($file->name());
18 18
         }
19 19
     }
Please login to merge, or discard this patch.
examples/tests/ListCommandTest.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -9,16 +9,16 @@
 block discarded – undo
9 9
     public function test_it_list_files_and_directories()
10 10
     {
11 11
         $this->havingFile('demo.txt', 'Some text here!')
12
-             ->havingFile('doc.pdf')
13
-             ->havingDir('src')
14
-             ->command(new ListCommand)
15
-             ->printsExactly('demo.txt<br>doc.pdf<br>src<br>');
12
+                ->havingFile('doc.pdf')
13
+                ->havingDir('src')
14
+                ->command(new ListCommand)
15
+                ->printsExactly('demo.txt<br>doc.pdf<br>src<br>');
16 16
     }
17 17
 
18 18
     public function test_it_prints_nothing_when_no_files()
19 19
     {
20 20
         $this->command(new ListCommand)
21
-             ->printsExactly('');
21
+                ->printsExactly('');
22 22
     }
23 23
 
24 24
 }
Please login to merge, or discard this patch.
examples/tests/HelloWorldTest.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -9,15 +9,15 @@
 block discarded – undo
9 9
     public function test_it_prints_hello_world()
10 10
     {
11 11
         $this->withStdin("Amine\n")
12
-             ->command(new HelloWorld)
13
-             ->prints("Your name:")
14
-             ->prints("Hello Amine<br>");
12
+                ->command(new HelloWorld)
13
+                ->prints("Your name:")
14
+                ->prints("Hello Amine<br>");
15 15
     }
16 16
 
17 17
     public function test_it_shows_hello_world_version()
18 18
     {
19 19
         $this->command(new HelloWorld, ['--version'])
20
-             ->printsExactly("<info>Hello World</info> version <info>1.0.0-alpha</info><br>");
20
+                ->printsExactly("<info>Hello World</info> version <info>1.0.0-alpha</info><br>");
21 21
     }
22 22
 
23 23
 }
Please login to merge, or discard this patch.