Passed
Pull Request — master (#656)
by Abdul Malik
11:30 queued 05:15
created
src/Distribution/src/Resolver/ExpirationAwareResolver.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@
 block discarded – undo
102 102
      */
103 103
     private function resolveExpirationInterval($expiration): DateInterval
104 104
     {
105
-        if ($expiration === null) {
105
+        if ($expiration === null){
106 106
             return $this->expiration;
107 107
         }
108 108
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -102,7 +102,8 @@
 block discarded – undo
102 102
      */
103 103
     private function resolveExpirationInterval($expiration): DateInterval
104 104
     {
105
-        if ($expiration === null) {
105
+        if ($expiration === null)
106
+        {
106 107
             return $this->expiration;
107 108
         }
108 109
 
Please login to merge, or discard this patch.
src/Distribution/src/Internal/DateTimeIntervalFactory.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -44,11 +44,11 @@  discard block
 block discarded – undo
44 44
      */
45 45
     public function create($duration): DateInterval
46 46
     {
47
-        try {
47
+        try{
48 48
             return $this->createOrFail($duration);
49
-        } catch (InvalidArgumentException $e) {
49
+        }catch (InvalidArgumentException $e){
50 50
             throw $e;
51
-        } catch (Throwable $e) {
51
+        }catch (Throwable $e){
52 52
             throw new InvalidArgumentException($e->getMessage(), (int)$e->getCode(), $e);
53 53
         }
54 54
     }
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
      */
70 70
     private function createOrFail($duration): DateInterval
71 71
     {
72
-        switch (true) {
72
+        switch (true){
73 73
             case $duration instanceof DateInterval:
74 74
                 return $duration;
75 75
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
                 return new DateInterval($duration);
81 81
 
82 82
             case \is_int($duration):
83
-                return new DateInterval('PT' . $duration . 'S');
83
+                return new DateInterval('PT'.$duration.'S');
84 84
 
85 85
             case $duration === null:
86 86
                 return new DateInterval('PT0S');
Please login to merge, or discard this patch.
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -44,11 +44,16 @@  discard block
 block discarded – undo
44 44
      */
45 45
     public function create($duration): DateInterval
46 46
     {
47
-        try {
47
+        try
48
+        {
48 49
             return $this->createOrFail($duration);
49
-        } catch (InvalidArgumentException $e) {
50
+        }
51
+        catch (InvalidArgumentException $e)
52
+        {
50 53
             throw $e;
51
-        } catch (Throwable $e) {
54
+        }
55
+        catch (Throwable $e)
56
+        {
52 57
             throw new InvalidArgumentException($e->getMessage(), (int)$e->getCode(), $e);
53 58
         }
54 59
     }
@@ -69,7 +74,8 @@  discard block
 block discarded – undo
69 74
      */
70 75
     private function createOrFail($duration): DateInterval
71 76
     {
72
-        switch (true) {
77
+        switch (true)
78
+        {
73 79
             case $duration instanceof DateInterval:
74 80
                 return $duration;
75 81
 
Please login to merge, or discard this patch.
src/Pagination/src/Paginator.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -92,11 +92,11 @@  discard block
 block discarded – undo
92 92
      */
93 93
     public function getPage(): int
94 94
     {
95
-        if ($this->pageNumber < 1) {
95
+        if ($this->pageNumber < 1){
96 96
             return 1;
97 97
         }
98 98
 
99
-        if ($this->pageNumber > $this->countPages) {
99
+        if ($this->pageNumber > $this->countPages){
100 100
             return $this->countPages;
101 101
         }
102 102
 
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
     public function paginate(PaginableInterface $target): PaginatorInterface
118 118
     {
119 119
         $paginator = clone $this;
120
-        if ($target instanceof Countable && $paginator->count === 0) {
120
+        if ($target instanceof Countable && $paginator->count === 0){
121 121
             $paginator->setCount($target->count());
122 122
         }
123 123
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
      */
146 146
     public function countDisplayed(): int
147 147
     {
148
-        if ($this->getPage() == $this->countPages) {
148
+        if ($this->getPage() == $this->countPages){
149 149
             return $this->count - $this->getOffset();
150 150
         }
151 151
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
      */
166 166
     public function nextPage()
167 167
     {
168
-        if ($this->getPage() != $this->countPages) {
168
+        if ($this->getPage() != $this->countPages){
169 169
             return $this->getPage() + 1;
170 170
         }
171 171
 
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
      */
178 178
     public function previousPage()
179 179
     {
180
-        if ($this->getPage() > 1) {
180
+        if ($this->getPage() > 1){
181 181
             return $this->getPage() - 1;
182 182
         }
183 183
 
@@ -192,9 +192,9 @@  discard block
 block discarded – undo
192 192
     private function setCount(int $count): self
193 193
     {
194 194
         $this->count = max($count, 0);
195
-        if ($this->count > 0) {
195
+        if ($this->count > 0){
196 196
             $this->countPages = (int)ceil($this->count / $this->limit);
197
-        } else {
197
+        }else{
198 198
             $this->countPages = 1;
199 199
         }
200 200
 
Please login to merge, or discard this patch.
Braces   +17 added lines, -8 removed lines patch added patch discarded remove patch
@@ -92,11 +92,13 @@  discard block
 block discarded – undo
92 92
      */
93 93
     public function getPage(): int
94 94
     {
95
-        if ($this->pageNumber < 1) {
95
+        if ($this->pageNumber < 1)
96
+        {
96 97
             return 1;
97 98
         }
98 99
 
99
-        if ($this->pageNumber > $this->countPages) {
100
+        if ($this->pageNumber > $this->countPages)
101
+        {
100 102
             return $this->countPages;
101 103
         }
102 104
 
@@ -117,7 +119,8 @@  discard block
 block discarded – undo
117 119
     public function paginate(PaginableInterface $target): PaginatorInterface
118 120
     {
119 121
         $paginator = clone $this;
120
-        if ($target instanceof Countable && $paginator->count === 0) {
122
+        if ($target instanceof Countable && $paginator->count === 0)
123
+        {
121 124
             $paginator->setCount($target->count());
122 125
         }
123 126
 
@@ -145,7 +148,8 @@  discard block
 block discarded – undo
145 148
      */
146 149
     public function countDisplayed(): int
147 150
     {
148
-        if ($this->getPage() == $this->countPages) {
151
+        if ($this->getPage() == $this->countPages)
152
+        {
149 153
             return $this->count - $this->getOffset();
150 154
         }
151 155
 
@@ -165,7 +169,8 @@  discard block
 block discarded – undo
165 169
      */
166 170
     public function nextPage()
167 171
     {
168
-        if ($this->getPage() != $this->countPages) {
172
+        if ($this->getPage() != $this->countPages)
173
+        {
169 174
             return $this->getPage() + 1;
170 175
         }
171 176
 
@@ -177,7 +182,8 @@  discard block
 block discarded – undo
177 182
      */
178 183
     public function previousPage()
179 184
     {
180
-        if ($this->getPage() > 1) {
185
+        if ($this->getPage() > 1)
186
+        {
181 187
             return $this->getPage() - 1;
182 188
         }
183 189
 
@@ -192,9 +198,12 @@  discard block
 block discarded – undo
192 198
     private function setCount(int $count): self
193 199
     {
194 200
         $this->count = max($count, 0);
195
-        if ($this->count > 0) {
201
+        if ($this->count > 0)
202
+        {
196 203
             $this->countPages = (int)ceil($this->count / $this->limit);
197
-        } else {
204
+        }
205
+        else
206
+        {
198 207
             $this->countPages = 1;
199 208
         }
200 209
 
Please login to merge, or discard this patch.
src/Tokenizer/src/AbstractLocator.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -48,10 +48,10 @@  discard block
 block discarded – undo
48 48
      */
49 49
     protected function availableReflections(): Generator
50 50
     {
51
-        foreach ($this->finder->getIterator() as $file) {
51
+        foreach ($this->finder->getIterator() as $file){
52 52
             $reflection = new ReflectionFile((string)$file);
53 53
 
54
-            if ($reflection->hasIncludes()) {
54
+            if ($reflection->hasIncludes()){
55 55
                 // We are not analyzing files which has includes, it's not safe to require such reflections
56 56
                 $this->getLogger()->warning(
57 57
                     sprintf('File `%s` has includes and excluded from analysis', $file),
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
      */
78 78
     protected function classReflection(string $class): ReflectionClass
79 79
     {
80
-        $loader = static function ($class) {
81
-            if ($class === LocatorException::class) {
80
+        $loader = static function ($class){
81
+            if ($class === LocatorException::class){
82 82
                 return;
83 83
             }
84 84
 
@@ -88,12 +88,12 @@  discard block
 block discarded – undo
88 88
         //To suspend class dependency exception
89 89
         spl_autoload_register($loader);
90 90
 
91
-        try {
91
+        try{
92 92
             //In some cases reflection can thrown an exception if class invalid or can not be loaded,
93 93
             //we are going to handle such exception and convert it soft exception
94 94
             return new ReflectionClass($class);
95
-        } catch (Throwable $e) {
96
-            if ($e instanceof LocatorException && $e->getPrevious() != null) {
95
+        }catch (Throwable $e){
96
+            if ($e instanceof LocatorException && $e->getPrevious() != null){
97 97
                 $e = $e->getPrevious();
98 98
             }
99 99
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
             );
110 110
 
111 111
             throw new LocatorException($e->getMessage(), $e->getCode(), $e);
112
-        } finally {
112
+        }finally{
113 113
             spl_autoload_unregister($loader);
114 114
         }
115 115
     }
@@ -125,13 +125,13 @@  discard block
 block discarded – undo
125 125
     {
126 126
         $traits = [];
127 127
 
128
-        do {
128
+        do{
129 129
             $traits = \array_merge(\class_uses($class), $traits);
130 130
             $class = \get_parent_class($class);
131
-        } while ($class !== false);
131
+        }while ($class !== false);
132 132
 
133 133
         //Traits from traits
134
-        foreach (\array_flip($traits) as $trait) {
134
+        foreach (\array_flip($traits) as $trait){
135 135
             $traits = \array_merge(\class_uses($trait), $traits);
136 136
         }
137 137
 
Please login to merge, or discard this patch.
Braces   +22 added lines, -10 removed lines patch added patch discarded remove patch
@@ -48,10 +48,12 @@  discard block
 block discarded – undo
48 48
      */
49 49
     protected function availableReflections(): Generator
50 50
     {
51
-        foreach ($this->finder->getIterator() as $file) {
51
+        foreach ($this->finder->getIterator() as $file)
52
+        {
52 53
             $reflection = new ReflectionFile((string)$file);
53 54
 
54
-            if ($reflection->hasIncludes()) {
55
+            if ($reflection->hasIncludes())
56
+            {
55 57
                 // We are not analyzing files which has includes, it's not safe to require such reflections
56 58
                 $this->getLogger()->warning(
57 59
                     sprintf('File `%s` has includes and excluded from analysis', $file),
@@ -77,8 +79,10 @@  discard block
 block discarded – undo
77 79
      */
78 80
     protected function classReflection(string $class): ReflectionClass
79 81
     {
80
-        $loader = static function ($class) {
81
-            if ($class === LocatorException::class) {
82
+        $loader = static function ($class)
83
+        {
84
+            if ($class === LocatorException::class)
85
+            {
82 86
                 return;
83 87
             }
84 88
 
@@ -88,12 +92,16 @@  discard block
 block discarded – undo
88 92
         //To suspend class dependency exception
89 93
         spl_autoload_register($loader);
90 94
 
91
-        try {
95
+        try
96
+        {
92 97
             //In some cases reflection can thrown an exception if class invalid or can not be loaded,
93 98
             //we are going to handle such exception and convert it soft exception
94 99
             return new ReflectionClass($class);
95
-        } catch (Throwable $e) {
96
-            if ($e instanceof LocatorException && $e->getPrevious() != null) {
100
+        }
101
+        catch (Throwable $e)
102
+        {
103
+            if ($e instanceof LocatorException && $e->getPrevious() != null)
104
+            {
97 105
                 $e = $e->getPrevious();
98 106
             }
99 107
 
@@ -109,7 +117,9 @@  discard block
 block discarded – undo
109 117
             );
110 118
 
111 119
             throw new LocatorException($e->getMessage(), $e->getCode(), $e);
112
-        } finally {
120
+        }
121
+        finally
122
+        {
113 123
             spl_autoload_unregister($loader);
114 124
         }
115 125
     }
@@ -125,13 +135,15 @@  discard block
 block discarded – undo
125 135
     {
126 136
         $traits = [];
127 137
 
128
-        do {
138
+        do
139
+        {
129 140
             $traits = \array_merge(\class_uses($class), $traits);
130 141
             $class = \get_parent_class($class);
131 142
         } while ($class !== false);
132 143
 
133 144
         //Traits from traits
134
-        foreach (\array_flip($traits) as $trait) {
145
+        foreach (\array_flip($traits) as $trait)
146
+        {
135 147
             $traits = \array_merge(\class_uses($trait), $traits);
136 148
         }
137 149
 
Please login to merge, or discard this patch.
src/Tokenizer/src/InvocationLocator.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -32,8 +32,8 @@  discard block
 block discarded – undo
32 32
     public function getInvocations(ReflectionFunctionAbstract $function): array
33 33
     {
34 34
         $result = [];
35
-        foreach ($this->availableInvocations($function->getName()) as $invocation) {
36
-            if ($this->isTargeted($invocation, $function)) {
35
+        foreach ($this->availableInvocations($function->getName()) as $invocation){
36
+            if ($this->isTargeted($invocation, $function)){
37 37
                 $result[] = $invocation;
38 38
             }
39 39
         }
@@ -50,12 +50,12 @@  discard block
 block discarded – undo
50 50
     protected function availableInvocations(string $signature = ''): Generator
51 51
     {
52 52
         $signature = strtolower(trim($signature, '\\'));
53
-        foreach ($this->availableReflections() as $reflection) {
54
-            foreach ($reflection->getInvocations() as $invocation) {
53
+        foreach ($this->availableReflections() as $reflection){
54
+            foreach ($reflection->getInvocations() as $invocation){
55 55
                 if (
56 56
                     !empty($signature)
57 57
                     && strtolower(trim($invocation->getName(), '\\')) != $signature
58
-                ) {
58
+                ){
59 59
                     continue;
60 60
                 }
61 61
 
@@ -66,13 +66,13 @@  discard block
 block discarded – undo
66 66
 
67 67
     protected function isTargeted(ReflectionInvocation $invocation, ReflectionFunctionAbstract $function): bool
68 68
     {
69
-        if ($function instanceof ReflectionFunction) {
69
+        if ($function instanceof ReflectionFunction){
70 70
             return !$invocation->isMethod();
71 71
         }
72 72
 
73
-        try {
73
+        try{
74 74
             $reflection = $this->classReflection($invocation->getClass());
75
-        } catch (LocatorException $e) {
75
+        }catch (LocatorException $e){
76 76
             return false;
77 77
         }
78 78
 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
          */
82 82
         $target = $function->getDeclaringClass();
83 83
 
84
-        if ($target->isTrait()) {
84
+        if ($target->isTrait()){
85 85
             //Let's compare traits
86 86
             return in_array($target->getName(), $this->fetchTraits($invocation->getClass()));
87 87
         }
Please login to merge, or discard this patch.
Braces   +17 added lines, -8 removed lines patch added patch discarded remove patch
@@ -32,8 +32,10 @@  discard block
 block discarded – undo
32 32
     public function getInvocations(ReflectionFunctionAbstract $function): array
33 33
     {
34 34
         $result = [];
35
-        foreach ($this->availableInvocations($function->getName()) as $invocation) {
36
-            if ($this->isTargeted($invocation, $function)) {
35
+        foreach ($this->availableInvocations($function->getName()) as $invocation)
36
+        {
37
+            if ($this->isTargeted($invocation, $function))
38
+            {
37 39
                 $result[] = $invocation;
38 40
             }
39 41
         }
@@ -50,8 +52,10 @@  discard block
 block discarded – undo
50 52
     protected function availableInvocations(string $signature = ''): Generator
51 53
     {
52 54
         $signature = strtolower(trim($signature, '\\'));
53
-        foreach ($this->availableReflections() as $reflection) {
54
-            foreach ($reflection->getInvocations() as $invocation) {
55
+        foreach ($this->availableReflections() as $reflection)
56
+        {
57
+            foreach ($reflection->getInvocations() as $invocation)
58
+            {
55 59
                 if (
56 60
                     !empty($signature)
57 61
                     && strtolower(trim($invocation->getName(), '\\')) != $signature
@@ -66,13 +70,17 @@  discard block
 block discarded – undo
66 70
 
67 71
     protected function isTargeted(ReflectionInvocation $invocation, ReflectionFunctionAbstract $function): bool
68 72
     {
69
-        if ($function instanceof ReflectionFunction) {
73
+        if ($function instanceof ReflectionFunction)
74
+        {
70 75
             return !$invocation->isMethod();
71 76
         }
72 77
 
73
-        try {
78
+        try
79
+        {
74 80
             $reflection = $this->classReflection($invocation->getClass());
75
-        } catch (LocatorException $e) {
81
+        }
82
+        catch (LocatorException $e)
83
+        {
76 84
             return false;
77 85
         }
78 86
 
@@ -81,7 +89,8 @@  discard block
 block discarded – undo
81 89
          */
82 90
         $target = $function->getDeclaringClass();
83 91
 
84
-        if ($target->isTrait()) {
92
+        if ($target->isTrait())
93
+        {
85 94
             //Let's compare traits
86 95
             return in_array($target->getName(), $this->fetchTraits($invocation->getClass()));
87 96
         }
Please login to merge, or discard this patch.
src/Tokenizer/src/ClassLocator.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -24,20 +24,20 @@  discard block
 block discarded – undo
24 24
      */
25 25
     public function getClasses($target = null): array
26 26
     {
27
-        if (!empty($target) && (is_object($target) || is_string($target))) {
27
+        if (!empty($target) && (is_object($target) || is_string($target))){
28 28
             $target = new ReflectionClass($target);
29 29
         }
30 30
 
31 31
         $result = [];
32
-        foreach ($this->availableClasses() as $class) {
33
-            try {
32
+        foreach ($this->availableClasses() as $class){
33
+            try{
34 34
                 $reflection = $this->classReflection($class);
35
-            } catch (LocatorException $e) {
35
+            }catch (LocatorException $e){
36 36
                 //Ignoring
37 37
                 continue;
38 38
             }
39 39
 
40
-            if (!$this->isTargeted($reflection, $target) || $reflection->isInterface()) {
40
+            if (!$this->isTargeted($reflection, $target) || $reflection->isInterface()){
41 41
                 continue;
42 42
             }
43 43
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
     {
55 55
         $classes = [];
56 56
 
57
-        foreach ($this->availableReflections() as $reflection) {
57
+        foreach ($this->availableReflections() as $reflection){
58 58
             $classes = array_merge($classes, $reflection->getClasses());
59 59
         }
60 60
 
@@ -68,11 +68,11 @@  discard block
 block discarded – undo
68 68
      */
69 69
     protected function isTargeted(ReflectionClass $class, ReflectionClass $target = null): bool
70 70
     {
71
-        if (empty($target)) {
71
+        if (empty($target)){
72 72
             return true;
73 73
         }
74 74
 
75
-        if (!$target->isTrait()) {
75
+        if (!$target->isTrait()){
76 76
             //Target is interface or class
77 77
             return $class->isSubclassOf($target) || $class->getName() == $target->getName();
78 78
         }
Please login to merge, or discard this patch.
Braces   +17 added lines, -8 removed lines patch added patch discarded remove patch
@@ -24,20 +24,26 @@  discard block
 block discarded – undo
24 24
      */
25 25
     public function getClasses($target = null): array
26 26
     {
27
-        if (!empty($target) && (is_object($target) || is_string($target))) {
27
+        if (!empty($target) && (is_object($target) || is_string($target)))
28
+        {
28 29
             $target = new ReflectionClass($target);
29 30
         }
30 31
 
31 32
         $result = [];
32
-        foreach ($this->availableClasses() as $class) {
33
-            try {
33
+        foreach ($this->availableClasses() as $class)
34
+        {
35
+            try
36
+            {
34 37
                 $reflection = $this->classReflection($class);
35
-            } catch (LocatorException $e) {
38
+            }
39
+            catch (LocatorException $e)
40
+            {
36 41
                 //Ignoring
37 42
                 continue;
38 43
             }
39 44
 
40
-            if (!$this->isTargeted($reflection, $target) || $reflection->isInterface()) {
45
+            if (!$this->isTargeted($reflection, $target) || $reflection->isInterface())
46
+            {
41 47
                 continue;
42 48
             }
43 49
 
@@ -54,7 +60,8 @@  discard block
 block discarded – undo
54 60
     {
55 61
         $classes = [];
56 62
 
57
-        foreach ($this->availableReflections() as $reflection) {
63
+        foreach ($this->availableReflections() as $reflection)
64
+        {
58 65
             $classes = array_merge($classes, $reflection->getClasses());
59 66
         }
60 67
 
@@ -68,11 +75,13 @@  discard block
 block discarded – undo
68 75
      */
69 76
     protected function isTargeted(ReflectionClass $class, ReflectionClass $target = null): bool
70 77
     {
71
-        if (empty($target)) {
78
+        if (empty($target))
79
+        {
72 80
             return true;
73 81
         }
74 82
 
75
-        if (!$target->isTrait()) {
83
+        if (!$target->isTrait())
84
+        {
76 85
             //Target is interface or class
77 86
             return $class->isSubclassOf($target) || $class->getName() == $target->getName();
78 87
         }
Please login to merge, or discard this patch.
src/Tokenizer/src/Reflection/ReflectionArgument.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
     /**
22 22
      * Argument types.
23 23
      */
24
-    public const CONSTANT   = 'constant';   //Scalar constant and not variable.
25
-    public const VARIABLE   = 'variable';   //PHP variable
24
+    public const CONSTANT   = 'constant'; //Scalar constant and not variable.
25
+    public const VARIABLE   = 'variable'; //PHP variable
26 26
     public const EXPRESSION = 'expression'; //PHP code (expression).
27 27
     public const STRING     = 'string';
28 28
     private string $type;
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
      */
60 60
     public function stringValue(): string
61 61
     {
62
-        if ($this->type != self::STRING) {
62
+        if ($this->type != self::STRING){
63 63
             throw new ReflectionException(
64 64
                 "Unable to represent value as string, value type is '{$this->type}'"
65 65
             );
@@ -80,19 +80,19 @@  discard block
 block discarded – undo
80 80
         $level = 0;
81 81
 
82 82
         $result = [];
83
-        foreach ($tokens as $token) {
84
-            if ($token[ReflectionFile::TOKEN_TYPE] == T_WHITESPACE) {
83
+        foreach ($tokens as $token){
84
+            if ($token[ReflectionFile::TOKEN_TYPE] == T_WHITESPACE){
85 85
                 continue;
86 86
             }
87 87
 
88
-            if (empty($definition)) {
88
+            if (empty($definition)){
89 89
                 $definition = ['type' => self::EXPRESSION, 'value' => '', 'tokens' => []];
90 90
             }
91 91
 
92 92
             if (
93 93
                 $token[ReflectionFile::TOKEN_TYPE] == '('
94 94
                 || $token[ReflectionFile::TOKEN_TYPE] == '['
95
-            ) {
95
+            ){
96 96
                 ++$level;
97 97
                 $definition['value'] .= $token[ReflectionFile::TOKEN_CODE];
98 98
                 continue;
@@ -101,18 +101,18 @@  discard block
 block discarded – undo
101 101
             if (
102 102
                 $token[ReflectionFile::TOKEN_TYPE] == ')'
103 103
                 || $token[ReflectionFile::TOKEN_TYPE] == ']'
104
-            ) {
104
+            ){
105 105
                 --$level;
106 106
                 $definition['value'] .= $token[ReflectionFile::TOKEN_CODE];
107 107
                 continue;
108 108
             }
109 109
 
110
-            if ($level) {
110
+            if ($level){
111 111
                 $definition['value'] .= $token[ReflectionFile::TOKEN_CODE];
112 112
                 continue;
113 113
             }
114 114
 
115
-            if ($token[ReflectionFile::TOKEN_TYPE] == ',') {
115
+            if ($token[ReflectionFile::TOKEN_TYPE] == ','){
116 116
                 $result[] = self::createArgument($definition);
117 117
                 $definition = null;
118 118
                 continue;
@@ -123,9 +123,9 @@  discard block
 block discarded – undo
123 123
         }
124 124
 
125 125
         //Last argument
126
-        if (is_array($definition)) {
126
+        if (is_array($definition)){
127 127
             $definition = self::createArgument($definition);
128
-            if (!empty($definition->getType())) {
128
+            if (!empty($definition->getType())){
129 129
                 $result[] = $definition;
130 130
             }
131 131
         }
@@ -142,9 +142,9 @@  discard block
 block discarded – undo
142 142
     {
143 143
         $result = new static(self::EXPRESSION, $definition['value']);
144 144
 
145
-        if (count($definition['tokens']) == 1) {
145
+        if (count($definition['tokens']) == 1){
146 146
             //If argument represent by one token we can try to resolve it's type more precisely
147
-            switch ($definition['tokens'][0][0]) {
147
+            switch ($definition['tokens'][0][0]){
148 148
                 case T_VARIABLE:
149 149
                     $result->type = self::VARIABLE;
150 150
                     break;
Please login to merge, or discard this patch.
src/Tokenizer/src/Tokenizer.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
      */
78 78
     public function createInjection(ReflectionClass $class, string $context = null)
79 79
     {
80
-        if ($class->isSubclassOf(ClassesInterface::class)) {
80
+        if ($class->isSubclassOf(ClassesInterface::class)){
81 81
             return $this->classLocator();
82
-        } elseif ($class->isSubclassOf(InvocationsInterface::class)) {
82
+        } elseif ($class->isSubclassOf(InvocationsInterface::class)){
83 83
             return $this->invocationLocator();
84 84
         }
85 85
 
@@ -94,12 +94,12 @@  discard block
 block discarded – undo
94 94
         $tokens = token_get_all(file_get_contents($filename));
95 95
 
96 96
         $line = 0;
97
-        foreach ($tokens as &$token) {
98
-            if (isset($token[self::LINE])) {
97
+        foreach ($tokens as &$token){
98
+            if (isset($token[self::LINE])){
99 99
                 $line = $token[self::LINE];
100 100
             }
101 101
 
102
-            if (!is_array($token)) {
102
+            if (!is_array($token)){
103 103
                 $token = [$token, $token, $line];
104 104
             }
105 105
 
@@ -117,11 +117,11 @@  discard block
 block discarded – undo
117 117
     {
118 118
         $finder = new Finder();
119 119
 
120
-        if (empty($directories)) {
120
+        if (empty($directories)){
121 121
             $directories = $this->config->getDirectories();
122 122
         }
123 123
 
124
-        if (empty($exclude)) {
124
+        if (empty($exclude)){
125 125
             $exclude = $this->config->getExcludes();
126 126
         }
127 127
 
Please login to merge, or discard this patch.
Braces   +15 added lines, -7 removed lines patch added patch discarded remove patch
@@ -77,9 +77,12 @@  discard block
 block discarded – undo
77 77
      */
78 78
     public function createInjection(ReflectionClass $class, string $context = null)
79 79
     {
80
-        if ($class->isSubclassOf(ClassesInterface::class)) {
80
+        if ($class->isSubclassOf(ClassesInterface::class))
81
+        {
81 82
             return $this->classLocator();
82
-        } elseif ($class->isSubclassOf(InvocationsInterface::class)) {
83
+        }
84
+        elseif ($class->isSubclassOf(InvocationsInterface::class))
85
+        {
83 86
             return $this->invocationLocator();
84 87
         }
85 88
 
@@ -94,12 +97,15 @@  discard block
 block discarded – undo
94 97
         $tokens = token_get_all(file_get_contents($filename));
95 98
 
96 99
         $line = 0;
97
-        foreach ($tokens as &$token) {
98
-            if (isset($token[self::LINE])) {
100
+        foreach ($tokens as &$token)
101
+        {
102
+            if (isset($token[self::LINE]))
103
+            {
99 104
                 $line = $token[self::LINE];
100 105
             }
101 106
 
102
-            if (!is_array($token)) {
107
+            if (!is_array($token))
108
+            {
103 109
                 $token = [$token, $token, $line];
104 110
             }
105 111
 
@@ -117,11 +123,13 @@  discard block
 block discarded – undo
117 123
     {
118 124
         $finder = new Finder();
119 125
 
120
-        if (empty($directories)) {
126
+        if (empty($directories))
127
+        {
121 128
             $directories = $this->config->getDirectories();
122 129
         }
123 130
 
124
-        if (empty($exclude)) {
131
+        if (empty($exclude))
132
+        {
125 133
             $exclude = $this->config->getExcludes();
126 134
         }
127 135
 
Please login to merge, or discard this patch.
src/Router/src/CoreHandler.php 2 patches
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
         CoreInterface $core,
53 53
         ScopeInterface $scope,
54 54
         ResponseFactoryInterface $responseFactory
55
-    ) {
55
+    ){
56 56
         $this->core = $core;
57 57
         $this->scope = $scope;
58 58
         $this->responseFactory = $responseFactory;
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
      */
91 91
     public function handle(Request $request): Response
92 92
     {
93
-        if ($this->controller === null) {
93
+        if ($this->controller === null){
94 94
             throw new HandlerException('Controller and action pair is not set');
95 95
         }
96 96
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
         $output = $result = null;
101 101
 
102 102
         $response = $this->responseFactory->createResponse(200);
103
-        try {
103
+        try{
104 104
             // run the core withing PSR-7 Request/Response scope
105 105
             $result = $this->scope->runScope(
106 106
                 [
@@ -113,29 +113,29 @@  discard block
 block discarded – undo
113 113
                     $this->parameters
114 114
                 )
115 115
             );
116
-        } catch (ControllerException $e) {
116
+        }catch (ControllerException $e){
117 117
             ob_get_clean();
118 118
             throw $this->mapException($e);
119
-        } catch (Throwable $e) {
119
+        }catch (Throwable $e){
120 120
             ob_get_clean();
121 121
             throw $e;
122
-        } finally {
123
-            while (ob_get_level() > $outputLevel + 1) {
124
-                $output = ob_get_clean() . $output;
122
+        }finally{
123
+            while (ob_get_level() > $outputLevel + 1){
124
+                $output = ob_get_clean().$output;
125 125
             }
126 126
         }
127 127
 
128 128
         return $this->wrapResponse(
129 129
             $response,
130 130
             $result,
131
-            ob_get_clean() . $output
131
+            ob_get_clean().$output
132 132
         );
133 133
     }
134 134
 
135 135
     private function getAction(Request $request): string
136 136
     {
137
-        if ($this->verbActions) {
138
-            return strtolower($request->getMethod()) . ucfirst($this->action);
137
+        if ($this->verbActions){
138
+            return strtolower($request->getMethod()).ucfirst($this->action);
139 139
         }
140 140
 
141 141
         return $this->action;
@@ -150,21 +150,21 @@  discard block
 block discarded – undo
150 150
      */
151 151
     private function wrapResponse(Response $response, $result = null, string $output = ''): Response
152 152
     {
153
-        if ($result instanceof Response) {
154
-            if ($output !== '' && $result->getBody()->isWritable()) {
153
+        if ($result instanceof Response){
154
+            if ($output !== '' && $result->getBody()->isWritable()){
155 155
                 $result->getBody()->write($output);
156 156
             }
157 157
 
158 158
             return $result;
159 159
         }
160 160
 
161
-        if ($result instanceof Generator) {
161
+        if ($result instanceof Generator){
162 162
             return $response->withBody(new GeneratorStream($result));
163 163
         }
164 164
 
165
-        if (\is_array($result) || $result instanceof JsonSerializable) {
165
+        if (\is_array($result) || $result instanceof JsonSerializable){
166 166
             $response = $this->writeJson($response, $result);
167
-        } else {
167
+        }else{
168 168
             $response->getBody()->write((string)$result);
169 169
         }
170 170
 
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
      */
180 180
     private function mapException(ControllerException $exception): ClientException
181 181
     {
182
-        switch ($exception->getCode()) {
182
+        switch ($exception->getCode()){
183 183
             case ControllerException::BAD_ACTION:
184 184
             case ControllerException::NOT_FOUND:
185 185
                 return new NotFoundException($exception->getMessage());
Please login to merge, or discard this patch.
Braces   +30 added lines, -13 removed lines patch added patch discarded remove patch
@@ -90,7 +90,8 @@  discard block
 block discarded – undo
90 90
      */
91 91
     public function handle(Request $request): Response
92 92
     {
93
-        if ($this->controller === null) {
93
+        if ($this->controller === null)
94
+        {
94 95
             throw new HandlerException('Controller and action pair is not set');
95 96
         }
96 97
 
@@ -100,7 +101,8 @@  discard block
 block discarded – undo
100 101
         $output = $result = null;
101 102
 
102 103
         $response = $this->responseFactory->createResponse(200);
103
-        try {
104
+        try
105
+        {
104 106
             // run the core withing PSR-7 Request/Response scope
105 107
             $result = $this->scope->runScope(
106 108
                 [
@@ -113,14 +115,21 @@  discard block
 block discarded – undo
113 115
                     $this->parameters
114 116
                 )
115 117
             );
116
-        } catch (ControllerException $e) {
118
+        }
119
+        catch (ControllerException $e)
120
+        {
117 121
             ob_get_clean();
118 122
             throw $this->mapException($e);
119
-        } catch (Throwable $e) {
123
+        }
124
+        catch (Throwable $e)
125
+        {
120 126
             ob_get_clean();
121 127
             throw $e;
122
-        } finally {
123
-            while (ob_get_level() > $outputLevel + 1) {
128
+        }
129
+        finally
130
+        {
131
+            while (ob_get_level() > $outputLevel + 1)
132
+            {
124 133
                 $output = ob_get_clean() . $output;
125 134
             }
126 135
         }
@@ -134,7 +143,8 @@  discard block
 block discarded – undo
134 143
 
135 144
     private function getAction(Request $request): string
136 145
     {
137
-        if ($this->verbActions) {
146
+        if ($this->verbActions)
147
+        {
138 148
             return strtolower($request->getMethod()) . ucfirst($this->action);
139 149
         }
140 150
 
@@ -150,21 +160,27 @@  discard block
 block discarded – undo
150 160
      */
151 161
     private function wrapResponse(Response $response, $result = null, string $output = ''): Response
152 162
     {
153
-        if ($result instanceof Response) {
154
-            if ($output !== '' && $result->getBody()->isWritable()) {
163
+        if ($result instanceof Response)
164
+        {
165
+            if ($output !== '' && $result->getBody()->isWritable())
166
+            {
155 167
                 $result->getBody()->write($output);
156 168
             }
157 169
 
158 170
             return $result;
159 171
         }
160 172
 
161
-        if ($result instanceof Generator) {
173
+        if ($result instanceof Generator)
174
+        {
162 175
             return $response->withBody(new GeneratorStream($result));
163 176
         }
164 177
 
165
-        if (\is_array($result) || $result instanceof JsonSerializable) {
178
+        if (\is_array($result) || $result instanceof JsonSerializable)
179
+        {
166 180
             $response = $this->writeJson($response, $result);
167
-        } else {
181
+        }
182
+        else
183
+        {
168 184
             $response->getBody()->write((string)$result);
169 185
         }
170 186
 
@@ -179,7 +195,8 @@  discard block
 block discarded – undo
179 195
      */
180 196
     private function mapException(ControllerException $exception): ClientException
181 197
     {
182
-        switch ($exception->getCode()) {
198
+        switch ($exception->getCode())
199
+        {
183 200
             case ControllerException::BAD_ACTION:
184 201
             case ControllerException::NOT_FOUND:
185 202
                 return new NotFoundException($exception->getMessage());
Please login to merge, or discard this patch.