Passed
Pull Request — master (#370)
by Valentin
04:51
created
src/Framework/Command/Database/ListCommand.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -34,13 +34,13 @@  discard block
 block discarded – undo
34 34
      */
35 35
     public function perform(DatabaseConfig $config, DatabaseManager $dbal): void
36 36
     {
37
-        if ($this->argument('db')) {
37
+        if ($this->argument('db')){
38 38
             $databases = [$this->argument('db')];
39
-        } else {
39
+        }else{
40 40
             $databases = array_keys($config->getDatabases());
41 41
         }
42 42
 
43
-        if (empty($databases)) {
43
+        if (empty($databases)){
44 44
             $this->writeln('<fg=red>No databases found.</fg=red>');
45 45
 
46 46
             return;
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
             ]
59 59
         );
60 60
 
61
-        foreach ($databases as $database) {
61
+        foreach ($databases as $database){
62 62
             $database = $dbal->database($database);
63 63
 
64 64
             /** @var Driver $driver */
@@ -71,12 +71,12 @@  discard block
 block discarded – undo
71 71
                 $database->getPrefix() ?: '<comment>---</comment>',
72 72
             ];
73 73
 
74
-            try {
74
+            try{
75 75
                 $driver->connect();
76
-            } catch (\Exception $exception) {
76
+            }catch (\Exception $exception){
77 77
                 $this->renderException($grid, $header, $exception);
78 78
 
79
-                if ($database->getName() != end($databases)) {
79
+                if ($database->getName() != end($databases)){
80 80
                     $grid->addRow(new TableSeparator());
81 81
                 }
82 82
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 
86 86
             $header[] = '<info>connected</info>';
87 87
             $this->renderTables($grid, $header, $database);
88
-            if ($database->getName() != end($databases)) {
88
+            if ($database->getName() != end($databases)){
89 89
                 $grid->addRow(new TableSeparator());
90 90
             }
91 91
         }
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
      */
120 120
     private function renderTables(Table $grid, array $header, Database $database): void
121 121
     {
122
-        foreach ($database->getTables() as $table) {
122
+        foreach ($database->getTables() as $table){
123 123
             $grid->addRow(
124 124
                 array_merge(
125 125
                     $header,
Please login to merge, or discard this patch.
Braces   +20 added lines, -9 removed lines patch added patch discarded remove patch
@@ -34,13 +34,17 @@  discard block
 block discarded – undo
34 34
      */
35 35
     public function perform(DatabaseConfig $config, DatabaseManager $dbal): void
36 36
     {
37
-        if ($this->argument('db')) {
37
+        if ($this->argument('db'))
38
+        {
38 39
             $databases = [$this->argument('db')];
39
-        } else {
40
+        }
41
+        else
42
+        {
40 43
             $databases = array_keys($config->getDatabases());
41 44
         }
42 45
 
43
-        if (empty($databases)) {
46
+        if (empty($databases))
47
+        {
44 48
             $this->writeln('<fg=red>No databases found.</fg=red>');
45 49
 
46 50
             return;
@@ -58,7 +62,8 @@  discard block
 block discarded – undo
58 62
             ]
59 63
         );
60 64
 
61
-        foreach ($databases as $database) {
65
+        foreach ($databases as $database)
66
+        {
62 67
             $database = $dbal->database($database);
63 68
 
64 69
             /** @var Driver $driver */
@@ -71,12 +76,16 @@  discard block
 block discarded – undo
71 76
                 $database->getPrefix() ?: '<comment>---</comment>',
72 77
             ];
73 78
 
74
-            try {
79
+            try
80
+            {
75 81
                 $driver->connect();
76
-            } catch (\Exception $exception) {
82
+            }
83
+            catch (\Exception $exception)
84
+            {
77 85
                 $this->renderException($grid, $header, $exception);
78 86
 
79
-                if ($database->getName() != end($databases)) {
87
+                if ($database->getName() != end($databases))
88
+                {
80 89
                     $grid->addRow(new TableSeparator());
81 90
                 }
82 91
 
@@ -85,7 +94,8 @@  discard block
 block discarded – undo
85 94
 
86 95
             $header[] = '<info>connected</info>';
87 96
             $this->renderTables($grid, $header, $database);
88
-            if ($database->getName() != end($databases)) {
97
+            if ($database->getName() != end($databases))
98
+            {
89 99
                 $grid->addRow(new TableSeparator());
90 100
             }
91 101
         }
@@ -119,7 +129,8 @@  discard block
 block discarded – undo
119 129
      */
120 130
     private function renderTables(Table $grid, array $header, Database $database): void
121 131
     {
122
-        foreach ($database->getTables() as $table) {
132
+        foreach ($database->getTables() as $table)
133
+        {
123 134
             $grid->addRow(
124 135
                 array_merge(
125 136
                     $header,
Please login to merge, or discard this patch.
src/Framework/Domain/GuardInterceptor.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     {
53 53
         $permission = $this->getPermissions($controller, $action);
54 54
 
55
-        if ($permission !== null && !$this->guard->allows($permission[0], $parameters)) {
55
+        if ($permission !== null && !$this->guard->allows($permission[0], $parameters)){
56 56
             throw new ControllerException($permission[2], $permission[1]);
57 57
         }
58 58
 
@@ -70,14 +70,14 @@  discard block
 block discarded – undo
70 70
     private function getPermissions(string $controller, string $action): ?array
71 71
     {
72 72
         $key = sprintf('%s:%s', $controller, $action);
73
-        if (array_key_exists($key, $this->cache)) {
73
+        if (array_key_exists($key, $this->cache)){
74 74
             return $this->cache[$key];
75 75
         }
76 76
 
77 77
         $this->cache[$key] = null;
78
-        try {
78
+        try{
79 79
             $method = new \ReflectionMethod($controller, $action);
80
-        } catch (\ReflectionException $e) {
80
+        }catch (\ReflectionException $e){
81 81
             return null;
82 82
         }
83 83
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
             Guarded::class
96 96
         );
97 97
 
98
-        if ($action === null) {
98
+        if ($action === null){
99 99
             return null;
100 100
         }
101 101
 
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
             $guarded->errorMessage ?? sprintf('Unauthorized access `%s`', $guarded->permission ?? $method->getName()),
119 119
         ];
120 120
 
121
-        if ($guarded->permission === null && $ns === null) {
121
+        if ($guarded->permission === null && $ns === null){
122 122
             throw new InterceptorException(
123 123
                 sprintf(
124 124
                     'Unable to apply @Guarded without name or @GuardNamespace on `%s`->`%s`',
@@ -128,16 +128,16 @@  discard block
 block discarded – undo
128 128
             );
129 129
         }
130 130
 
131
-        if ($ns !== null) {
131
+        if ($ns !== null){
132 132
             $permission[0] = sprintf('%s.%s', $ns->namespace, $permission[0]);
133 133
         }
134 134
 
135
-        if ($this->namespace !== null) {
135
+        if ($this->namespace !== null){
136 136
             // global namespace
137 137
             $permission[0] = sprintf('%s.%s', $this->namespace, $permission[0]);
138 138
         }
139 139
 
140
-        switch ($guarded->else) {
140
+        switch ($guarded->else){
141 141
             case 'unauthorized':
142 142
                 $permission[1] = ControllerException::UNAUTHORIZED;
143 143
                 break;
Please login to merge, or discard this patch.
Braces   +19 added lines, -9 removed lines patch added patch discarded remove patch
@@ -52,7 +52,8 @@  discard block
 block discarded – undo
52 52
     {
53 53
         $permission = $this->getPermissions($controller, $action);
54 54
 
55
-        if ($permission !== null && !$this->guard->allows($permission[0], $parameters)) {
55
+        if ($permission !== null && !$this->guard->allows($permission[0], $parameters))
56
+        {
56 57
             throw new ControllerException($permission[2], $permission[1]);
57 58
         }
58 59
 
@@ -70,14 +71,18 @@  discard block
 block discarded – undo
70 71
     private function getPermissions(string $controller, string $action): ?array
71 72
     {
72 73
         $key = sprintf('%s:%s', $controller, $action);
73
-        if (array_key_exists($key, $this->cache)) {
74
+        if (array_key_exists($key, $this->cache))
75
+        {
74 76
             return $this->cache[$key];
75 77
         }
76 78
 
77 79
         $this->cache[$key] = null;
78
-        try {
80
+        try
81
+        {
79 82
             $method = new \ReflectionMethod($controller, $action);
80
-        } catch (\ReflectionException $e) {
83
+        }
84
+        catch (\ReflectionException $e)
85
+        {
81 86
             return null;
82 87
         }
83 88
 
@@ -95,7 +100,8 @@  discard block
 block discarded – undo
95 100
             Guarded::class
96 101
         );
97 102
 
98
-        if ($action === null) {
103
+        if ($action === null)
104
+        {
99 105
             return null;
100 106
         }
101 107
 
@@ -118,7 +124,8 @@  discard block
 block discarded – undo
118 124
             $guarded->errorMessage ?? sprintf('Unauthorized access `%s`', $guarded->permission ?? $method->getName()),
119 125
         ];
120 126
 
121
-        if ($guarded->permission === null && $ns === null) {
127
+        if ($guarded->permission === null && $ns === null)
128
+        {
122 129
             throw new InterceptorException(
123 130
                 sprintf(
124 131
                     'Unable to apply @Guarded without name or @GuardNamespace on `%s`->`%s`',
@@ -128,16 +135,19 @@  discard block
 block discarded – undo
128 135
             );
129 136
         }
130 137
 
131
-        if ($ns !== null) {
138
+        if ($ns !== null)
139
+        {
132 140
             $permission[0] = sprintf('%s.%s', $ns->namespace, $permission[0]);
133 141
         }
134 142
 
135
-        if ($this->namespace !== null) {
143
+        if ($this->namespace !== null)
144
+        {
136 145
             // global namespace
137 146
             $permission[0] = sprintf('%s.%s', $this->namespace, $permission[0]);
138 147
         }
139 148
 
140
-        switch ($guarded->else) {
149
+        switch ($guarded->else)
150
+        {
141 151
             case 'unauthorized':
142 152
                 $permission[1] = ControllerException::UNAUTHORIZED;
143 153
                 break;
Please login to merge, or discard this patch.
src/Streams/src/StreamWrapper.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
      */
73 73
     public function stream_open($path, $mode, $options, &$opened_path)
74 74
     {
75
-        if (!isset(self::$uris[$path])) {
75
+        if (!isset(self::$uris[$path])){
76 76
             return false;
77 77
         }
78 78
 
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
      */
157 157
     public function url_stat($path, $flags)
158 158
     {
159
-        if (!isset(self::$uris[$path])) {
159
+        if (!isset(self::$uris[$path])){
160 160
             return null;
161 161
         }
162 162
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
      */
169 169
     public static function register()
170 170
     {
171
-        if (self::$registered) {
171
+        if (self::$registered){
172 172
             return;
173 173
         }
174 174
 
@@ -184,8 +184,8 @@  discard block
 block discarded – undo
184 184
      */
185 185
     public static function has($file)
186 186
     {
187
-        if ($file instanceof StreamInterface) {
188
-            $file = 'spiral://' . spl_object_hash($file);
187
+        if ($file instanceof StreamInterface){
188
+            $file = 'spiral://'.spl_object_hash($file);
189 189
         }
190 190
 
191 191
         return isset(self::$uris[$file]);
@@ -202,15 +202,15 @@  discard block
 block discarded – undo
202 202
     public static function getResource(StreamInterface $stream)
203 203
     {
204 204
         $mode = null;
205
-        if ($stream->isReadable()) {
205
+        if ($stream->isReadable()){
206 206
             $mode = 'r';
207 207
         }
208 208
 
209
-        if ($stream->isWritable()) {
209
+        if ($stream->isWritable()){
210 210
             $mode = !empty($mode) ? 'r+' : 'w';
211 211
         }
212 212
 
213
-        if (empty($mode)) {
213
+        if (empty($mode)){
214 214
             throw new WrapperException('Stream is not available in read or write modes');
215 215
         }
216 216
 
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
     {
228 228
         self::register();
229 229
 
230
-        $uri = 'spiral://' . spl_object_hash($stream);
230
+        $uri = 'spiral://'.spl_object_hash($stream);
231 231
         self::$uris[$uri] = $stream;
232 232
 
233 233
         return $uri;
@@ -241,8 +241,8 @@  discard block
 block discarded – undo
241 241
      */
242 242
     public static function release($file)
243 243
     {
244
-        if ($file instanceof StreamInterface) {
245
-            $file = 'spiral://' . spl_object_hash($file);
244
+        if ($file instanceof StreamInterface){
245
+            $file = 'spiral://'.spl_object_hash($file);
246 246
         }
247 247
 
248 248
         unset(self::$uris[$file]);
@@ -257,12 +257,12 @@  discard block
 block discarded – undo
257 257
     private function getStreamStats(StreamInterface $stream)
258 258
     {
259 259
         $mode = $this->mode;
260
-        if (empty($mode)) {
261
-            if ($stream->isReadable()) {
260
+        if (empty($mode)){
261
+            if ($stream->isReadable()){
262 262
                 $mode = 'r';
263 263
             }
264 264
 
265
-            if ($stream->isWritable()) {
265
+            if ($stream->isWritable()){
266 266
                 $mode = !empty($mode) ? 'r+' : 'w';
267 267
             }
268 268
         }
Please login to merge, or discard this patch.
Braces   +22 added lines, -11 removed lines patch added patch discarded remove patch
@@ -72,7 +72,8 @@  discard block
 block discarded – undo
72 72
      */
73 73
     public function stream_open($path, $mode, $options, &$opened_path)
74 74
     {
75
-        if (!isset(self::$uris[$path])) {
75
+        if (!isset(self::$uris[$path]))
76
+        {
76 77
             return false;
77 78
         }
78 79
 
@@ -156,7 +157,8 @@  discard block
 block discarded – undo
156 157
      */
157 158
     public function url_stat($path, $flags)
158 159
     {
159
-        if (!isset(self::$uris[$path])) {
160
+        if (!isset(self::$uris[$path]))
161
+        {
160 162
             return null;
161 163
         }
162 164
 
@@ -168,7 +170,8 @@  discard block
 block discarded – undo
168 170
      */
169 171
     public static function register()
170 172
     {
171
-        if (self::$registered) {
173
+        if (self::$registered)
174
+        {
172 175
             return;
173 176
         }
174 177
 
@@ -184,7 +187,8 @@  discard block
 block discarded – undo
184 187
      */
185 188
     public static function has($file)
186 189
     {
187
-        if ($file instanceof StreamInterface) {
190
+        if ($file instanceof StreamInterface)
191
+        {
188 192
             $file = 'spiral://' . spl_object_hash($file);
189 193
         }
190 194
 
@@ -202,15 +206,18 @@  discard block
 block discarded – undo
202 206
     public static function getResource(StreamInterface $stream)
203 207
     {
204 208
         $mode = null;
205
-        if ($stream->isReadable()) {
209
+        if ($stream->isReadable())
210
+        {
206 211
             $mode = 'r';
207 212
         }
208 213
 
209
-        if ($stream->isWritable()) {
214
+        if ($stream->isWritable())
215
+        {
210 216
             $mode = !empty($mode) ? 'r+' : 'w';
211 217
         }
212 218
 
213
-        if (empty($mode)) {
219
+        if (empty($mode))
220
+        {
214 221
             throw new WrapperException('Stream is not available in read or write modes');
215 222
         }
216 223
 
@@ -241,7 +248,8 @@  discard block
 block discarded – undo
241 248
      */
242 249
     public static function release($file)
243 250
     {
244
-        if ($file instanceof StreamInterface) {
251
+        if ($file instanceof StreamInterface)
252
+        {
245 253
             $file = 'spiral://' . spl_object_hash($file);
246 254
         }
247 255
 
@@ -257,12 +265,15 @@  discard block
 block discarded – undo
257 265
     private function getStreamStats(StreamInterface $stream)
258 266
     {
259 267
         $mode = $this->mode;
260
-        if (empty($mode)) {
261
-            if ($stream->isReadable()) {
268
+        if (empty($mode))
269
+        {
270
+            if ($stream->isReadable())
271
+            {
262 272
                 $mode = 'r';
263 273
             }
264 274
 
265
-            if ($stream->isWritable()) {
275
+            if ($stream->isWritable())
276
+            {
266 277
                 $mode = !empty($mode) ? 'r+' : 'w';
267 278
             }
268 279
         }
Please login to merge, or discard this patch.
src/Exceptions/src/JsonHandler.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -39,24 +39,24 @@
 block discarded – undo
39 39
      */
40 40
     private function renderTrace(array $trace, int $verbosity): \Generator
41 41
     {
42
-        foreach ($trace as $item) {
42
+        foreach ($trace as $item){
43 43
             $result = [];
44 44
 
45
-            if (isset($item['class'])) {
45
+            if (isset($item['class'])){
46 46
                 $result['function'] = sprintf(
47 47
                     '%s%s%s()',
48 48
                     $item['class'],
49 49
                     $item['type'],
50 50
                     $item['function']
51 51
                 );
52
-            } else {
52
+            }else{
53 53
                 $result['function'] = sprintf(
54 54
                     '%s()',
55 55
                     $item['function']
56 56
                 );
57 57
             }
58 58
 
59
-            if ($verbosity >= self::VERBOSITY_VERBOSE && isset($item['file'])) {
59
+            if ($verbosity >= self::VERBOSITY_VERBOSE && isset($item['file'])){
60 60
                 $result['at'] = [
61 61
                     'file' => $item['file'] ?? null,
62 62
                     'line' => $item['line'] ?? null,
Please login to merge, or discard this patch.
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -39,24 +39,29 @@
 block discarded – undo
39 39
      */
40 40
     private function renderTrace(array $trace, int $verbosity): \Generator
41 41
     {
42
-        foreach ($trace as $item) {
42
+        foreach ($trace as $item)
43
+        {
43 44
             $result = [];
44 45
 
45
-            if (isset($item['class'])) {
46
+            if (isset($item['class']))
47
+            {
46 48
                 $result['function'] = sprintf(
47 49
                     '%s%s%s()',
48 50
                     $item['class'],
49 51
                     $item['type'],
50 52
                     $item['function']
51 53
                 );
52
-            } else {
54
+            }
55
+            else
56
+            {
53 57
                 $result['function'] = sprintf(
54 58
                     '%s()',
55 59
                     $item['function']
56 60
                 );
57 61
             }
58 62
 
59
-            if ($verbosity >= self::VERBOSITY_VERBOSE && isset($item['file'])) {
63
+            if ($verbosity >= self::VERBOSITY_VERBOSE && isset($item['file']))
64
+            {
60 65
                 $result['at'] = [
61 66
                     'file' => $item['file'] ?? null,
62 67
                     'line' => $item['line'] ?? null,
Please login to merge, or discard this patch.
src/Exceptions/src/AbstractHandler.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     protected function getStacktrace(\Throwable $e): array
34 34
     {
35 35
         $stacktrace = $e->getTrace();
36
-        if (empty($stacktrace)) {
36
+        if (empty($stacktrace)){
37 37
             return [];
38 38
         }
39 39
 
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
                 'line' => $e->getLine(),
44 44
             ] + $stacktrace[0];
45 45
 
46
-        if ($stacktrace[0] != $header) {
46
+        if ($stacktrace[0] != $header){
47 47
             array_unshift($stacktrace, $header);
48 48
         }
49 49
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,8 @@  discard block
 block discarded – undo
33 33
     protected function getStacktrace(\Throwable $e): array
34 34
     {
35 35
         $stacktrace = $e->getTrace();
36
-        if (empty($stacktrace)) {
36
+        if (empty($stacktrace))
37
+        {
37 38
             return [];
38 39
         }
39 40
 
@@ -43,7 +44,8 @@  discard block
 block discarded – undo
43 44
                 'line' => $e->getLine(),
44 45
             ] + $stacktrace[0];
45 46
 
46
-        if ($stacktrace[0] != $header) {
47
+        if ($stacktrace[0] != $header)
48
+        {
47 49
             array_unshift($stacktrace, $header);
48 50
         }
49 51
 
Please login to merge, or discard this patch.
src/Console/src/Sequence/CallableSequence.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
         array $parameters = [],
38 38
         string $header = '',
39 39
         string $footer = ''
40
-    ) {
40
+    ){
41 41
         $this->function = $function;
42 42
         $this->parameters = $parameters;
43 43
 
@@ -50,18 +50,18 @@  discard block
 block discarded – undo
50 50
     public function execute(ContainerInterface $container, OutputInterface $output): void
51 51
     {
52 52
         $function = $this->function;
53
-        if (is_string($function) && strpos($function, ':') !== false) {
53
+        if (is_string($function) && strpos($function, ':') !== false){
54 54
             $function = explode(':', str_replace('::', ':', $function));
55 55
         }
56 56
 
57
-        if (is_array($function) && isset($function[0]) && !is_object($function[0])) {
57
+        if (is_array($function) && isset($function[0]) && !is_object($function[0])){
58 58
             $function[0] = $container->get($function[0]);
59 59
         }
60 60
 
61 61
         /** @var ResolverInterface $resolver */
62 62
         $resolver = $container->get(ResolverInterface::class);
63 63
 
64
-        if (is_array($function)) {
64
+        if (is_array($function)){
65 65
             $reflection = new \ReflectionMethod($function[0], $function[1]);
66 66
             $reflection->invokeArgs($function[0], $resolver->resolveArguments($reflection, [
67 67
                 'output' => $output,
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -50,18 +50,21 @@
 block discarded – undo
50 50
     public function execute(ContainerInterface $container, OutputInterface $output): void
51 51
     {
52 52
         $function = $this->function;
53
-        if (is_string($function) && strpos($function, ':') !== false) {
53
+        if (is_string($function) && strpos($function, ':') !== false)
54
+        {
54 55
             $function = explode(':', str_replace('::', ':', $function));
55 56
         }
56 57
 
57
-        if (is_array($function) && isset($function[0]) && !is_object($function[0])) {
58
+        if (is_array($function) && isset($function[0]) && !is_object($function[0]))
59
+        {
58 60
             $function[0] = $container->get($function[0]);
59 61
         }
60 62
 
61 63
         /** @var ResolverInterface $resolver */
62 64
         $resolver = $container->get(ResolverInterface::class);
63 65
 
64
-        if (is_array($function)) {
66
+        if (is_array($function))
67
+        {
65 68
             $reflection = new \ReflectionMethod($function[0], $function[1]);
66 69
             $reflection->invokeArgs($function[0], $resolver->resolveArguments($reflection, [
67 70
                 'output' => $output,
Please login to merge, or discard this patch.
src/Dumper/src/helpers.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 
12 12
 use Spiral\Debug\Dumper;
13 13
 
14
-if (!function_exists('dump')) {
14
+if (!function_exists('dump')){
15 15
     /**
16 16
      * Dump value.
17 17
      *
@@ -22,12 +22,12 @@  discard block
 block discarded – undo
22 22
      */
23 23
     function dump($value, int $output = Dumper::OUTPUT): ?string
24 24
     {
25
-        if (!class_exists(\Spiral\Core\ContainerScope::class)) {
25
+        if (!class_exists(\Spiral\Core\ContainerScope::class)){
26 26
             return (new Dumper())->dump($value, $output);
27 27
         }
28 28
 
29 29
         $container = \Spiral\Core\ContainerScope::getContainer();
30
-        if (is_null($container) || !$container->has(Dumper::class)) {
30
+        if (is_null($container) || !$container->has(Dumper::class)){
31 31
             $dumper = new Dumper();
32 32
 
33 33
             return $dumper->dump($value, $output);
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,7 +11,8 @@  discard block
 block discarded – undo
11 11
 
12 12
 use Spiral\Debug\Dumper;
13 13
 
14
-if (!function_exists('dump')) {
14
+if (!function_exists('dump'))
15
+{
15 16
     /**
16 17
      * Dump value.
17 18
      *
@@ -22,12 +23,14 @@  discard block
 block discarded – undo
22 23
      */
23 24
     function dump($value, int $output = Dumper::OUTPUT): ?string
24 25
     {
25
-        if (!class_exists(\Spiral\Core\ContainerScope::class)) {
26
+        if (!class_exists(\Spiral\Core\ContainerScope::class))
27
+        {
26 28
             return (new Dumper())->dump($value, $output);
27 29
         }
28 30
 
29 31
         $container = \Spiral\Core\ContainerScope::getContainer();
30
-        if (is_null($container) || !$container->has(Dumper::class)) {
32
+        if (is_null($container) || !$container->has(Dumper::class))
33
+        {
31 34
             $dumper = new Dumper();
32 35
 
33 36
             return $dumper->dump($value, $output);
Please login to merge, or discard this patch.
src/Filters/src/SchemaBuilder.php 3 patches
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
                     FilterProvider::SOURCE => null,
93 93
                     FilterProvider::ORIGIN => $field,
94 94
                     FilterProvider::FILTER => $definition,
95
-                    FilterProvider::ARRAY  => false,
95
+                    FilterProvider::array  => false,
96 96
                 ];
97 97
 
98 98
                 continue;
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
                 FilterProvider::FILTER => $definition[self::NESTED],
122 122
                 FilterProvider::SOURCE => null,
123 123
                 FilterProvider::ORIGIN => $origin,
124
-                FilterProvider::ARRAY  => $iterate,
124
+                FilterProvider::array  => $iterate,
125 125
             ];
126 126
 
127 127
             if ($iterate) {
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -69,16 +69,16 @@  discard block
 block discarded – undo
69 69
     protected function buildMap(ReflectionEntity $filter): array
70 70
     {
71 71
         $schema = $filter->getProperty('schema', true);
72
-        if (empty($schema)) {
72
+        if (empty($schema)){
73 73
             throw new SchemaException("Filter `{$filter->getName()}` does not define any schema");
74 74
         }
75 75
 
76 76
         $result = [];
77
-        foreach ($schema as $field => $definition) {
77
+        foreach ($schema as $field => $definition){
78 78
             // short definition
79
-            if (is_string($definition)) {
79
+            if (is_string($definition)){
80 80
                 // simple scalar field definition
81
-                if (!class_exists($definition)) {
81
+                if (!class_exists($definition)){
82 82
                     [$source, $origin] = $this->parseDefinition($field, $definition);
83 83
                     $result[$field] = [
84 84
                         FilterProvider::SOURCE => $source,
@@ -98,20 +98,20 @@  discard block
 block discarded – undo
98 98
                 continue;
99 99
             }
100 100
 
101
-            if (!is_array($definition) || count($definition) === 0) {
101
+            if (!is_array($definition) || count($definition) === 0){
102 102
                 throw new SchemaException(
103 103
                     "Invalid schema definition at `{$filter->getName()}`->`{$field}`"
104 104
                 );
105 105
             }
106 106
 
107 107
             // complex definition
108
-            if (!empty($definition[self::ORIGIN])) {
108
+            if (!empty($definition[self::ORIGIN])){
109 109
                 $origin = $definition[self::ORIGIN];
110 110
 
111 111
                 // [class, 'data:something.*'] vs [class, 'data:something']
112 112
                 $iterate = strpos($origin, '.*') !== false || !empty($definition[self::ITERATE]);
113 113
                 $origin = rtrim($origin, '.*');
114
-            } else {
114
+            }else{
115 115
                 $origin = $field;
116 116
                 $iterate = true;
117 117
             }
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
                 FilterProvider::ARRAY  => $iterate,
125 125
             ];
126 126
 
127
-            if ($iterate) {
127
+            if ($iterate){
128 128
                 [$source, $origin] = $this->parseDefinition($field, $definition[self::ITERATE] ?? $origin);
129 129
 
130 130
                 $map[FilterProvider::ITERATE_SOURCE] = $source;
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
      */
151 151
     private function parseDefinition(string $field, string $definition): array
152 152
     {
153
-        if (strpos($definition, ':') === false) {
153
+        if (strpos($definition, ':') === false){
154 154
             return ['data', $definition ?? $field];
155 155
         }
156 156
 
Please login to merge, or discard this patch.
Braces   +19 added lines, -9 removed lines patch added patch discarded remove patch
@@ -69,16 +69,20 @@  discard block
 block discarded – undo
69 69
     protected function buildMap(ReflectionEntity $filter): array
70 70
     {
71 71
         $schema = $filter->getProperty('schema', true);
72
-        if (empty($schema)) {
72
+        if (empty($schema))
73
+        {
73 74
             throw new SchemaException("Filter `{$filter->getName()}` does not define any schema");
74 75
         }
75 76
 
76 77
         $result = [];
77
-        foreach ($schema as $field => $definition) {
78
+        foreach ($schema as $field => $definition)
79
+        {
78 80
             // short definition
79
-            if (is_string($definition)) {
81
+            if (is_string($definition))
82
+            {
80 83
                 // simple scalar field definition
81
-                if (!class_exists($definition)) {
84
+                if (!class_exists($definition))
85
+                {
82 86
                     [$source, $origin] = $this->parseDefinition($field, $definition);
83 87
                     $result[$field] = [
84 88
                         FilterProvider::SOURCE => $source,
@@ -98,20 +102,24 @@  discard block
 block discarded – undo
98 102
                 continue;
99 103
             }
100 104
 
101
-            if (!is_array($definition) || count($definition) === 0) {
105
+            if (!is_array($definition) || count($definition) === 0)
106
+            {
102 107
                 throw new SchemaException(
103 108
                     "Invalid schema definition at `{$filter->getName()}`->`{$field}`"
104 109
                 );
105 110
             }
106 111
 
107 112
             // complex definition
108
-            if (!empty($definition[self::ORIGIN])) {
113
+            if (!empty($definition[self::ORIGIN]))
114
+            {
109 115
                 $origin = $definition[self::ORIGIN];
110 116
 
111 117
                 // [class, 'data:something.*'] vs [class, 'data:something']
112 118
                 $iterate = strpos($origin, '.*') !== false || !empty($definition[self::ITERATE]);
113 119
                 $origin = rtrim($origin, '.*');
114
-            } else {
120
+            }
121
+            else
122
+            {
115 123
                 $origin = $field;
116 124
                 $iterate = true;
117 125
             }
@@ -124,7 +132,8 @@  discard block
 block discarded – undo
124 132
                 FilterProvider::ARRAY  => $iterate,
125 133
             ];
126 134
 
127
-            if ($iterate) {
135
+            if ($iterate)
136
+            {
128 137
                 [$source, $origin] = $this->parseDefinition($field, $definition[self::ITERATE] ?? $origin);
129 138
 
130 139
                 $map[FilterProvider::ITERATE_SOURCE] = $source;
@@ -150,7 +159,8 @@  discard block
 block discarded – undo
150 159
      */
151 160
     private function parseDefinition(string $field, string $definition): array
152 161
     {
153
-        if (strpos($definition, ':') === false) {
162
+        if (strpos($definition, ':') === false)
163
+        {
154 164
             return ['data', $definition ?? $field];
155 165
         }
156 166
 
Please login to merge, or discard this patch.
src/Reactor/src/Traits/AccessTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
             AbstractDeclaration::ACCESS_PROTECTED,
39 39
             AbstractDeclaration::ACCESS_PUBLIC,
40 40
             ], true)
41
-        ) {
41
+        ){
42 42
             throw new ReactorException("Invalid declaration level '{$access}'");
43 43
         }
44 44
 
Please login to merge, or discard this patch.