Passed
Pull Request — master (#656)
by Abdul Malik
08:14
created
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/HtmlHandler.php 3 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -50,10 +50,10 @@  discard block
 block discarded – undo
50 50
         $this->style = $style;
51 51
         $this->dumper = new Dumper();
52 52
 
53
-        if ($style == self::INVERTED) {
53
+        if ($style == self::INVERTED){
54 54
             $this->renderer = new HtmlRenderer(HtmlRenderer::INVERTED);
55 55
             $this->highlighter = new Highlighter(new HtmlStyle(HtmlStyle::INVERTED));
56
-        } else {
56
+        }else{
57 57
             $this->renderer = new HtmlRenderer(HtmlRenderer::DEFAULT);
58 58
             $this->highlighter = new Highlighter(new HtmlStyle(HtmlStyle::DEFAULT));
59 59
         }
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
             'message'      => $this->getMessage($e),
83 83
             'exception'    => $e,
84 84
             'valueWrapper' => new ValueWrapper($this->dumper, $this->renderer, $verbosity),
85
-            'style'        => $this->render('styles/' . $this->style),
85
+            'style'        => $this->render('styles/'.$this->style),
86 86
             'footer'       => $this->render('partials/footer'),
87 87
             'variables'    => '',
88 88
             'logs'         => '',
@@ -105,20 +105,20 @@  discard block
 block discarded – undo
105 105
             'valueWrapper' => $options['valueWrapper'],
106 106
         ]);
107 107
 
108
-        if ($this->state !== null) {
109
-            if ($this->state->getTags() !== []) {
108
+        if ($this->state !== null){
109
+            if ($this->state->getTags() !== []){
110 110
                 $options['tags'] = $this->render('partials/tags', [
111 111
                     'tags' => $this->state->getTags(),
112 112
                 ]);
113 113
             }
114 114
 
115
-            if ($this->state->getLogEvents() !== []) {
115
+            if ($this->state->getLogEvents() !== []){
116 116
                 $options['logs'] = $this->render('partials/logs', [
117 117
                     'logEvents' => $this->state->getLogEvents(),
118 118
                 ]);
119 119
             }
120 120
 
121
-            if ($this->state->getVariables() !== []) {
121
+            if ($this->state->getVariables() !== []){
122 122
                 $options['variables'] = $this->render('partials/variables', [
123 123
                     'variables' => $this->state->getVariables(),
124 124
                 ]);
Please login to merge, or discard this patch.
Braces   +13 added lines, -6 removed lines patch added patch discarded remove patch
@@ -50,10 +50,13 @@  discard block
 block discarded – undo
50 50
         $this->style = $style;
51 51
         $this->dumper = new Dumper();
52 52
 
53
-        if ($style == self::INVERTED) {
53
+        if ($style == self::INVERTED)
54
+        {
54 55
             $this->renderer = new HtmlRenderer(HtmlRenderer::INVERTED);
55 56
             $this->highlighter = new Highlighter(new HtmlStyle(HtmlStyle::INVERTED));
56
-        } else {
57
+        }
58
+        else
59
+        {
57 60
             $this->renderer = new HtmlRenderer(HtmlRenderer::DEFAULT);
58 61
             $this->highlighter = new Highlighter(new HtmlStyle(HtmlStyle::DEFAULT));
59 62
         }
@@ -105,20 +108,24 @@  discard block
 block discarded – undo
105 108
             'valueWrapper' => $options['valueWrapper'],
106 109
         ]);
107 110
 
108
-        if ($this->state !== null) {
109
-            if ($this->state->getTags() !== []) {
111
+        if ($this->state !== null)
112
+        {
113
+            if ($this->state->getTags() !== [])
114
+            {
110 115
                 $options['tags'] = $this->render('partials/tags', [
111 116
                     'tags' => $this->state->getTags(),
112 117
                 ]);
113 118
             }
114 119
 
115
-            if ($this->state->getLogEvents() !== []) {
120
+            if ($this->state->getLogEvents() !== [])
121
+            {
116 122
                 $options['logs'] = $this->render('partials/logs', [
117 123
                     'logEvents' => $this->state->getLogEvents(),
118 124
                 ]);
119 125
             }
120 126
 
121
-            if ($this->state->getVariables() !== []) {
127
+            if ($this->state->getVariables() !== [])
128
+            {
122 129
                 $options['variables'] = $this->render('partials/variables', [
123 130
                     'variables' => $this->state->getVariables(),
124 131
                 ]);
Please login to merge, or discard this patch.
Upper-Lower-Casing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
     /**
25 25
      * Visual styles.
26 26
      */
27
-    public const DEFAULT  = 'default';
27
+    public const default  = 'default';
28 28
     public const INVERTED = 'inverted';
29 29
 
30 30
     /** @var HtmlRenderer */
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     protected $highlighter;
35 35
 
36 36
     /** @var string */
37
-    protected $style = self::DEFAULT;
37
+    protected $style = self::default;
38 38
 
39 39
     /** @var Dumper */
40 40
     protected $dumper;
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
     /** @var StateInterface|null */
43 43
     protected $state;
44 44
 
45
-    public function __construct(string $style = self::DEFAULT)
45
+    public function __construct(string $style = self::default)
46 46
     {
47 47
         $this->style = $style;
48 48
         $this->dumper = new Dumper();
@@ -51,11 +51,11 @@  discard block
 block discarded – undo
51 51
             $this->renderer = new HtmlRenderer(HtmlRenderer::INVERTED);
52 52
             $this->highlighter = new Highlighter(new HtmlStyle(HtmlStyle::INVERTED));
53 53
         } else {
54
-            $this->renderer = new HtmlRenderer(HtmlRenderer::DEFAULT);
55
-            $this->highlighter = new Highlighter(new HtmlStyle(HtmlStyle::DEFAULT));
54
+            $this->renderer = new HtmlRenderer(HtmlRenderer::default);
55
+            $this->highlighter = new Highlighter(new HtmlStyle(HtmlStyle::default));
56 56
         }
57 57
 
58
-        $this->dumper->setRenderer(Dumper::RETURN, $this->renderer);
58
+        $this->dumper->setRenderer(Dumper::return, $this->renderer);
59 59
     }
60 60
 
61 61
     public function withState(StateInterface $state): HandlerInterface
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.
src/Framework/Http/Middleware/ErrorHandlerMiddleware.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
         RendererInterface $renderer,
60 60
         ResponseFactoryInterface $responseFactory,
61 61
         ContainerInterface $container
62
-    ) {
62
+    ){
63 63
         $this->suppressErrors = $suppressErrors;
64 64
         $this->renderer = $renderer;
65 65
         $this->responseFactory = $responseFactory;
@@ -73,22 +73,22 @@  discard block
 block discarded – undo
73 73
      */
74 74
     public function process(Request $request, Handler $handler): Response
75 75
     {
76
-        try {
76
+        try{
77 77
             return $handler->handle($request);
78
-        } catch (ClientException | RouterException $e) {
79
-            if ($e instanceof ClientException) {
78
+        }catch (ClientException | RouterException $e){
79
+            if ($e instanceof ClientException){
80 80
                 $code = $e->getCode();
81
-            } else {
81
+            }else{
82 82
                 $code = 404;
83 83
             }
84
-        } catch (\Throwable $e) {
84
+        }catch (\Throwable $e){
85 85
             $snapshotter = $this->getOptional(SnapshotterInterface::class);
86
-            if ($snapshotter !== null) {
86
+            if ($snapshotter !== null){
87 87
                 /** @var SnapshotterInterface $snapshotter */
88 88
                 $snapshotter->register($e);
89 89
             }
90 90
 
91
-            if (!$this->suppressErrors->suppressed()) {
91
+            if (!$this->suppressErrors->suppressed()){
92 92
                 return $this->renderError($request, $e);
93 93
             }
94 94
 
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
     {
112 112
         $response = $this->responseFactory->createResponse(500);
113 113
 
114
-        if ($request->getHeaderLine('Accept') === 'application/json') {
114
+        if ($request->getHeaderLine('Accept') === 'application/json'){
115 115
             $response = $response->withHeader('Content-Type', 'application/json');
116 116
             $handler = new JsonHandler();
117 117
             $response->getBody()->write(
@@ -123,10 +123,10 @@  discard block
 block discarded – undo
123 123
                     )
124 124
                 )
125 125
             );
126
-        } else {
126
+        }else{
127 127
             $handler = new HtmlHandler();
128 128
             $state = $this->getOptional(StateInterface::class);
129
-            if ($state !== null) {
129
+            if ($state !== null){
130 130
                 $handler = $handler->withState($state);
131 131
             }
132 132
 
@@ -162,9 +162,9 @@  discard block
 block discarded – undo
162 162
      */
163 163
     private function getOptional(string $class)
164 164
     {
165
-        try {
165
+        try{
166 166
             return $this->container->get($class);
167
-        } catch (\Throwable | ContainerExceptionInterface $se) {
167
+        }catch (\Throwable | ContainerExceptionInterface $se){
168 168
             return null;
169 169
         }
170 170
     }
Please login to merge, or discard this patch.
Braces   +29 added lines, -12 removed lines patch added patch discarded remove patch
@@ -73,22 +73,32 @@  discard block
 block discarded – undo
73 73
      */
74 74
     public function process(Request $request, Handler $handler): Response
75 75
     {
76
-        try {
76
+        try
77
+        {
77 78
             return $handler->handle($request);
78
-        } catch (ClientException | RouterException $e) {
79
-            if ($e instanceof ClientException) {
79
+        }
80
+        catch (ClientException | RouterException $e)
81
+        {
82
+            if ($e instanceof ClientException)
83
+            {
80 84
                 $code = $e->getCode();
81
-            } else {
85
+            }
86
+            else
87
+            {
82 88
                 $code = 404;
83 89
             }
84
-        } catch (\Throwable $e) {
90
+        }
91
+        catch (\Throwable $e)
92
+        {
85 93
             $snapshotter = $this->getOptional(SnapshotterInterface::class);
86
-            if ($snapshotter !== null) {
94
+            if ($snapshotter !== null)
95
+            {
87 96
                 /** @var SnapshotterInterface $snapshotter */
88 97
                 $snapshotter->register($e);
89 98
             }
90 99
 
91
-            if (!$this->suppressErrors->suppressed()) {
100
+            if (!$this->suppressErrors->suppressed())
101
+            {
92 102
                 return $this->renderError($request, $e);
93 103
             }
94 104
 
@@ -111,7 +121,8 @@  discard block
 block discarded – undo
111 121
     {
112 122
         $response = $this->responseFactory->createResponse(500);
113 123
 
114
-        if ($request->getHeaderLine('Accept') === 'application/json') {
124
+        if ($request->getHeaderLine('Accept') === 'application/json')
125
+        {
115 126
             $response = $response->withHeader('Content-Type', 'application/json');
116 127
             $handler = new JsonHandler();
117 128
             $response->getBody()->write(
@@ -123,10 +134,13 @@  discard block
 block discarded – undo
123 134
                     )
124 135
                 )
125 136
             );
126
-        } else {
137
+        }
138
+        else
139
+        {
127 140
             $handler = new HtmlHandler();
128 141
             $state = $this->getOptional(StateInterface::class);
129
-            if ($state !== null) {
142
+            if ($state !== null)
143
+            {
130 144
                 $handler = $handler->withState($state);
131 145
             }
132 146
 
@@ -162,9 +176,12 @@  discard block
 block discarded – undo
162 176
      */
163 177
     private function getOptional(string $class)
164 178
     {
165
-        try {
179
+        try
180
+        {
166 181
             return $this->container->get($class);
167
-        } catch (\Throwable | ContainerExceptionInterface $se) {
182
+        }
183
+        catch (\Throwable | ContainerExceptionInterface $se)
184
+        {
168 185
             return null;
169 186
         }
170 187
     }
Please login to merge, or discard this patch.
src/Scaffolder/src/Command/ControllerCommand.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,11 +54,11 @@
 block discarded – undo
54 54
         /** @var ControllerDeclaration $declaration */
55 55
         $declaration = $this->createDeclaration();
56 56
 
57
-        foreach ($this->option('action') as $action) {
57
+        foreach ($this->option('action') as $action){
58 58
             $declaration->addAction($action);
59 59
         }
60 60
 
61
-        if ((bool)$this->option('prototype')) {
61
+        if ((bool)$this->option('prototype')){
62 62
             $declaration->addPrototypeTrait();
63 63
         }
64 64
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,11 +54,13 @@
 block discarded – undo
54 54
         /** @var ControllerDeclaration $declaration */
55 55
         $declaration = $this->createDeclaration();
56 56
 
57
-        foreach ($this->option('action') as $action) {
57
+        foreach ($this->option('action') as $action)
58
+        {
58 59
             $declaration->addAction($action);
59 60
         }
60 61
 
61
-        if ((bool)$this->option('prototype')) {
62
+        if ((bool)$this->option('prototype'))
63
+        {
62 64
             $declaration->addPrototypeTrait();
63 65
         }
64 66
 
Please login to merge, or discard this patch.
src/Scaffolder/src/Command/MigrationCommand.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -60,10 +60,10 @@
 block discarded – undo
60 60
         /** @var MigrationDeclaration $declaration */
61 61
         $declaration = $this->createDeclaration();
62 62
 
63
-        if (!empty($this->option('table'))) {
63
+        if (!empty($this->option('table'))){
64 64
             $fields = [];
65
-            foreach ($this->option('field') as $field) {
66
-                if (strpos($field, ':') === false) {
65
+            foreach ($this->option('field') as $field){
66
+                if (strpos($field, ':') === false){
67 67
                     throw new ScaffolderException("Field definition must in 'name:type' form");
68 68
                 }
69 69
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -60,10 +60,13 @@
 block discarded – undo
60 60
         /** @var MigrationDeclaration $declaration */
61 61
         $declaration = $this->createDeclaration();
62 62
 
63
-        if (!empty($this->option('table'))) {
63
+        if (!empty($this->option('table')))
64
+        {
64 65
             $fields = [];
65
-            foreach ($this->option('field') as $field) {
66
-                if (strpos($field, ':') === false) {
66
+            foreach ($this->option('field') as $field)
67
+            {
68
+                if (strpos($field, ':') === false)
69
+                {
67 70
                     throw new ScaffolderException("Field definition must in 'name:type' form");
68 71
                 }
69 72
 
Please login to merge, or discard this patch.
src/Scaffolder/src/Command/AbstractCommand.php 3 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
         FilesInterface $files,
52 52
         ContainerInterface $container,
53 53
         FactoryInterface $factory
54
-    ) {
54
+    ){
55 55
         $this->config = $config;
56 56
         $this->files = $files;
57 57
         $this->factory = $factory;
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
         $filename = $this->config->classFilename($type, (string)$this->argument('name'));
111 111
         $filename = $this->files->normalizePath($filename);
112 112
 
113
-        if ($this->files->exists($filename)) {
113
+        if ($this->files->exists($filename)){
114 114
             $this->writeln(
115 115
                 "<fg=red>Unable to create '<comment>{$declaration->getName()}</comment>' declaration, "
116 116
                 . "file '<comment>{$filename}</comment>' already exists.</fg=red>"
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -110,7 +110,8 @@
 block discarded – undo
110 110
         $filename = $this->config->classFilename($type, (string)$this->argument('name'));
111 111
         $filename = $this->files->normalizePath($filename);
112 112
 
113
-        if ($this->files->exists($filename)) {
113
+        if ($this->files->exists($filename))
114
+        {
114 115
             $this->writeln(
115 116
                 "<fg=red>Unable to create '<comment>{$declaration->getName()}</comment>' declaration, "
116 117
                 . "file '<comment>{$filename}</comment>' already exists.</fg=red>"
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@
 block discarded – undo
114 114
         $this->files->write(
115 115
             $filename,
116 116
             $file->render(),
117
-            FilesInterface::READONLY,
117
+            FilesInterface::readonly,
118 118
             true
119 119
         );
120 120
 
Please login to merge, or discard this patch.
src/Scaffolder/src/Command/CommandCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
         ['name', InputArgument::REQUIRED, 'Command name'],
27 27
         ['alias', InputArgument::OPTIONAL, 'Command id/alias'],
28 28
     ];
29
-    protected const OPTIONS     = [
29
+    protected const OPTIONS = [
30 30
         [
31 31
             'description',
32 32
             'd',
Please login to merge, or discard this patch.
src/Scaffolder/src/Config/ScaffolderConfig.php 2 patches
Braces   +19 added lines, -9 removed lines patch added patch discarded remove patch
@@ -69,11 +69,13 @@  discard block
 block discarded – undo
69 69
         $localNamespace = trim($this->getOption($element, 'namespace', ''), '\\');
70 70
         ['namespace' => $namespace] = $this->parseName($name);
71 71
 
72
-        if (!empty($namespace)) {
72
+        if (!empty($namespace))
73
+        {
73 74
             $localNamespace .= '\\' . $this->classify($namespace);
74 75
         }
75 76
 
76
-        if (empty($this->baseNamespace())) {
77
+        if (empty($this->baseNamespace()))
78
+        {
77 79
             return $localNamespace;
78 80
         }
79 81
 
@@ -106,7 +108,8 @@  discard block
 block discarded – undo
106 108
     {
107 109
         $class = $this->getOption($element, 'class');
108 110
 
109
-        if (empty($class)) {
111
+        if (empty($class))
112
+        {
110 113
             throw new ScaffolderException(
111 114
                 "Unable to scaffold '{$element}', no declaration class found"
112 115
             );
@@ -143,11 +146,13 @@  discard block
 block discarded – undo
143 146
      */
144 147
     private function getOption(string $element, string $section, $default = null)
145 148
     {
146
-        if (!isset($this->config['declarations'][$element])) {
149
+        if (!isset($this->config['declarations'][$element]))
150
+        {
147 151
             throw new ScaffolderException("Undefined declaration '{$element}'.");
148 152
         }
149 153
 
150
-        if (array_key_exists($section, $this->config['declarations'][$element])) {
154
+        if (array_key_exists($section, $this->config['declarations'][$element]))
155
+        {
151 156
             return $this->config['declarations'][$element][$section];
152 157
         }
153 158
 
@@ -164,7 +169,8 @@  discard block
 block discarded – undo
164 169
     {
165 170
         $name = str_replace('/', '\\', $name);
166 171
 
167
-        if (strpos($name, '\\') !== false) {
172
+        if (strpos($name, '\\') !== false)
173
+        {
168 174
             $names = explode('\\', $name);
169 175
             $class = array_pop($names);
170 176
 
@@ -192,11 +198,15 @@  discard block
 block discarded – undo
192 198
     {
193 199
         $firstChunkIterated = false;
194 200
         $joinedPath = '';
195
-        foreach ($chunks as $chunk) {
196
-            if (!$firstChunkIterated) {
201
+        foreach ($chunks as $chunk)
202
+        {
203
+            if (!$firstChunkIterated)
204
+            {
197 205
                 $firstChunkIterated = true;
198 206
                 $joinedPath = $chunk;
199
-            } else {
207
+            }
208
+            else
209
+            {
200 210
                 $joinedPath = rtrim($joinedPath, $joint) . $joint . ltrim($chunk, $joint);
201 211
             }
202 212
         }
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
     {
46 46
         ['name' => $name] = $this->parseName($name);
47 47
 
48
-        return $this->classify($name) . $this->elementPostfix($element);
48
+        return $this->classify($name).$this->elementPostfix($element);
49 49
     }
50 50
 
51 51
     public function classNamespace(string $element, string $name = ''): string
@@ -53,15 +53,15 @@  discard block
 block discarded – undo
53 53
         $localNamespace = trim($this->getOption($element, 'namespace', ''), '\\');
54 54
         ['namespace' => $namespace] = $this->parseName($name);
55 55
 
56
-        if (!empty($namespace)) {
57
-            $localNamespace .= '\\' . $this->classify($namespace);
56
+        if (!empty($namespace)){
57
+            $localNamespace .= '\\'.$this->classify($namespace);
58 58
         }
59 59
 
60
-        if (empty($this->baseNamespace())) {
60
+        if (empty($this->baseNamespace())){
61 61
             return $localNamespace;
62 62
         }
63 63
 
64
-        return trim($this->baseNamespace() . '\\' . $localNamespace, '\\');
64
+        return trim($this->baseNamespace().'\\'.$localNamespace, '\\');
65 65
     }
66 66
 
67 67
     public function classFilename(string $element, string $name): string
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
         return $this->joinPathChunks([
73 73
             $this->baseDirectory(),
74 74
             str_replace('\\', '/', $namespace),
75
-            $this->className($element, $name) . '.php',
75
+            $this->className($element, $name).'.php',
76 76
         ], '/');
77 77
     }
78 78
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
     {
84 84
         $class = $this->getOption($element, 'class');
85 85
 
86
-        if (empty($class)) {
86
+        if (empty($class)){
87 87
             throw new ScaffolderException(
88 88
                 "Unable to scaffold '{$element}', no declaration class found"
89 89
             );
@@ -111,11 +111,11 @@  discard block
 block discarded – undo
111 111
      */
112 112
     private function getOption(string $element, string $section, $default = null)
113 113
     {
114
-        if (!isset($this->config['declarations'][$element])) {
114
+        if (!isset($this->config['declarations'][$element])){
115 115
             throw new ScaffolderException("Undefined declaration '{$element}'.");
116 116
         }
117 117
 
118
-        if (array_key_exists($section, $this->config['declarations'][$element])) {
118
+        if (array_key_exists($section, $this->config['declarations'][$element])){
119 119
             return $this->config['declarations'][$element][$section];
120 120
         }
121 121
 
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
     {
132 132
         $name = str_replace('/', '\\', $name);
133 133
 
134
-        if (strpos($name, '\\') !== false) {
134
+        if (strpos($name, '\\') !== false){
135 135
             $names = explode('\\', $name);
136 136
             $class = array_pop($names);
137 137
 
@@ -151,12 +151,12 @@  discard block
 block discarded – undo
151 151
     {
152 152
         $firstChunkIterated = false;
153 153
         $joinedPath = '';
154
-        foreach ($chunks as $chunk) {
155
-            if (!$firstChunkIterated) {
154
+        foreach ($chunks as $chunk){
155
+            if (!$firstChunkIterated){
156 156
                 $firstChunkIterated = true;
157 157
                 $joinedPath = $chunk;
158
-            } else {
159
-                $joinedPath = rtrim($joinedPath, $joint) . $joint . ltrim($chunk, $joint);
158
+            }else{
159
+                $joinedPath = rtrim($joinedPath, $joint).$joint.ltrim($chunk, $joint);
160 160
             }
161 161
         }
162 162
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 
166 166
     private function classify(string $name): string
167 167
     {
168
-        return ( new InflectorFactory() )
168
+        return (new InflectorFactory())
169 169
             ->build()
170 170
             ->classify($name);
171 171
     }
Please login to merge, or discard this patch.