Passed
Push — master ( c776c7...570285 )
by Kirill
04:05
created
src/Scaffolder/src/Bootloader/ScaffolderBootloader.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -62,9 +62,9 @@  discard block
 block discarded – undo
62 62
         $console->addCommand(Command\MiddlewareCommand::class);
63 63
         $console->addCommand(Command\MigrationCommand::class);
64 64
 
65
-        try {
65
+        try{
66 66
             $defaultNamespace = (new ReflectionClass($this->kernel))->getNamespaceName();
67
-        } catch (ReflectionException $e) {
67
+        }catch (ReflectionException $e){
68 68
             $defaultNamespace = '';
69 69
         }
70 70
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
              * Base directory for generated classes, class will be automatically localed into sub directory
84 84
              * using given namespace.
85 85
              */
86
-            'directory'    => directory('app') . 'src/',
86
+            'directory'    => directory('app').'src/',
87 87
 
88 88
             /*
89 89
              * Default namespace to be applied for every generated class. By default uses Kernel namespace
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -62,9 +62,12 @@
 block discarded – undo
62 62
         $console->addCommand(Command\MiddlewareCommand::class);
63 63
         $console->addCommand(Command\MigrationCommand::class);
64 64
 
65
-        try {
65
+        try
66
+        {
66 67
             $defaultNamespace = (new ReflectionClass($this->kernel))->getNamespaceName();
67
-        } catch (ReflectionException $e) {
68
+        }
69
+        catch (ReflectionException $e)
70
+        {
68 71
             $defaultNamespace = '';
69 72
         }
70 73
 
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/Database/EntityCommand.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
         ['name', InputArgument::REQUIRED, 'Entity name'],
34 34
         ['format', InputArgument::OPTIONAL, 'Declaration format (annotated, xml?, yaml?, php?)', 'annotated'],
35 35
     ];
36
-    protected const OPTIONS     = [
36
+    protected const OPTIONS = [
37 37
         [
38 38
             'role',
39 39
             'r',
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
         $declaration = $this->createDeclaration();
109 109
 
110 110
         $repository = trimPostfix((string)$this->argument('name'), 'repository');
111
-        if ($this->option('repository')) {
111
+        if ($this->option('repository')){
112 112
             $repositoryClass = $config->className(RepositoryCommand::ELEMENT, $repository);
113 113
             $repositoryNamespace = $config->classNamespace(RepositoryCommand::ELEMENT, $repository);
114 114
             $declaration->setRepository("\\$repositoryNamespace\\$repositoryClass");
@@ -120,8 +120,8 @@  discard block
 block discarded – undo
120 120
         $declaration->setDatabase((string)$this->option('database'));
121 121
         $declaration->setInflection((string)$this->option('inflection'));
122 122
 
123
-        foreach ($this->option('field') as $field) {
124
-            if (strpos($field, ':') === false) {
123
+        foreach ($this->option('field') as $field){
124
+            if (strpos($field, ':') === false){
125 125
                 throw new ScaffolderException("Field definition must in 'name:type' or 'name:type' form");
126 126
             }
127 127
 
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 
136 136
         $this->writeDeclaration($declaration);
137 137
 
138
-        if ($this->option('repository')) {
138
+        if ($this->option('repository')){
139 139
             $console->run('create:repository', [
140 140
                 'name' => $repository ?? $this->argument('name')
141 141
             ]);
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
             AbstractDeclaration::ACCESS_PROTECTED,
163 163
             AbstractDeclaration::ACCESS_PRIVATE
164 164
             ], true)
165
-        ) {
165
+        ){
166 166
             throw new ScaffolderException("Invalid accessibility value `$accessibility`");
167 167
         }
168 168
     }
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -108,7 +108,8 @@  discard block
 block discarded – undo
108 108
         $declaration = $this->createDeclaration();
109 109
 
110 110
         $repository = trimPostfix((string)$this->argument('name'), 'repository');
111
-        if ($this->option('repository')) {
111
+        if ($this->option('repository'))
112
+        {
112 113
             $repositoryClass = $config->className(RepositoryCommand::ELEMENT, $repository);
113 114
             $repositoryNamespace = $config->classNamespace(RepositoryCommand::ELEMENT, $repository);
114 115
             $declaration->setRepository("\\$repositoryNamespace\\$repositoryClass");
@@ -120,8 +121,10 @@  discard block
 block discarded – undo
120 121
         $declaration->setDatabase((string)$this->option('database'));
121 122
         $declaration->setInflection((string)$this->option('inflection'));
122 123
 
123
-        foreach ($this->option('field') as $field) {
124
-            if (strpos($field, ':') === false) {
124
+        foreach ($this->option('field') as $field)
125
+        {
126
+            if (strpos($field, ':') === false)
127
+            {
125 128
                 throw new ScaffolderException("Field definition must in 'name:type' or 'name:type' form");
126 129
             }
127 130
 
@@ -135,7 +138,8 @@  discard block
 block discarded – undo
135 138
 
136 139
         $this->writeDeclaration($declaration);
137 140
 
138
-        if ($this->option('repository')) {
141
+        if ($this->option('repository'))
142
+        {
139 143
             $console->run('create:repository', [
140 144
                 'name' => $repository ?? $this->argument('name')
141 145
             ]);
Please login to merge, or discard this patch.
src/Scaffolder/src/Command/AbstractCommand.php 2 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.
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/Command/FilterCommand.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -63,11 +63,11 @@  discard block
 block discarded – undo
63 63
         $declaration = $this->createDeclaration();
64 64
 
65 65
         $fields = [];
66
-        if ($this->option('entity')) {
66
+        if ($this->option('entity')){
67 67
             $name = $this->option('entity');
68
-            try {
68
+            try{
69 69
                 $fields = $this->parseSourceEntity($name);
70
-            } catch (ReflectionException $e) {
70
+            }catch (ReflectionException $e){
71 71
                 $this->writeln(
72 72
                     "<fg=red>Unable to create '<comment>{$declaration->getName()} from $name</comment>' declaration: "
73 73
                     . "'<comment>{$e->getMessage()}' at {$e->getFile()}:{$e->getLine()}.</comment></fg=red>"
@@ -75,13 +75,13 @@  discard block
 block discarded – undo
75 75
 
76 76
                 return;
77 77
             }
78
-        } else {
79
-            foreach ($this->option('field') as $field) {
78
+        }else{
79
+            foreach ($this->option('field') as $field){
80 80
                 $fields[] = $this->parseField($field);
81 81
             }
82 82
         }
83 83
 
84
-        foreach ($fields as $values) {
84
+        foreach ($fields as $values){
85 85
             [$field, $type, $source, $origin] = $values;
86 86
 
87 87
             $declaration->declareField($field, $type, $source, $origin);
@@ -102,16 +102,16 @@  discard block
 block discarded – undo
102 102
         $source = null;
103 103
         $origin = null;
104 104
 
105
-        if (strpos($field, '(') !== false) {
105
+        if (strpos($field, '(') !== false){
106 106
             $source = substr($field, strpos($field, '(') + 1, -1);
107 107
             $field = substr($field, 0, strpos($field, '('));
108 108
 
109
-            if (strpos($source, ':') !== false) {
109
+            if (strpos($source, ':') !== false){
110 110
                 [$source, $origin] = explode(':', $source);
111 111
             }
112 112
         }
113 113
 
114
-        if (strpos($field, ':') !== false) {
114
+        if (strpos($field, ':') !== false){
115 115
             [$field, $type] = explode(':', $field);
116 116
         }
117 117
 
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
     {
128 128
         $fields = [];
129 129
         $reflection = new ReflectionClass($name);
130
-        foreach ($reflection->getProperties() as $property) {
130
+        foreach ($reflection->getProperties() as $property){
131 131
             $type = $this->getTypedPropertyType($property)
132 132
                 ?? $this->getPropertyTypeFromDefaults($property, $reflection)
133 133
                 ?? $this->getPropertyTypeFromDocBlock($property);
@@ -144,10 +144,10 @@  discard block
 block discarded – undo
144 144
      */
145 145
     private function getTypedPropertyType(ReflectionProperty $property): ?string
146 146
     {
147
-        if (method_exists($property, 'hasType') && method_exists($property, 'getType') && $property->hasType()) {
147
+        if (method_exists($property, 'hasType') && method_exists($property, 'getType') && $property->hasType()){
148 148
             /** @var ReflectionType $type */
149 149
             $type = $property->getType();
150
-            if (method_exists($type, 'getName') && $this->isKnownType($type->getName())) {
150
+            if (method_exists($type, 'getName') && $this->isKnownType($type->getName())){
151 151
                 return $type->getName();
152 152
             }
153 153
         }
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
      */
163 163
     private function getPropertyTypeFromDefaults(ReflectionProperty $property, ReflectionClass $reflection): ?string
164 164
     {
165
-        if (!isset($reflection->getDefaultProperties()[$property->name])) {
165
+        if (!isset($reflection->getDefaultProperties()[$property->name])){
166 166
             return null;
167 167
         }
168 168
 
@@ -178,9 +178,9 @@  discard block
 block discarded – undo
178 178
     private function getPropertyTypeFromDocBlock(ReflectionProperty $property): ?string
179 179
     {
180 180
         $doc = $property->getDocComment();
181
-        if (is_string($doc)) {
181
+        if (is_string($doc)){
182 182
             preg_match('/@var\s*([\S]+)/i', $doc, $match);
183
-            if (!empty($match[1]) && $this->isKnownType($match[1])) {
183
+            if (!empty($match[1]) && $this->isKnownType($match[1])){
184 184
                 return $match[1];
185 185
             }
186 186
         }
Please login to merge, or discard this patch.
Braces   +32 added lines, -15 removed lines patch added patch discarded remove patch
@@ -63,11 +63,15 @@  discard block
 block discarded – undo
63 63
         $declaration = $this->createDeclaration();
64 64
 
65 65
         $fields = [];
66
-        if ($this->option('entity')) {
66
+        if ($this->option('entity'))
67
+        {
67 68
             $name = $this->option('entity');
68
-            try {
69
+            try
70
+            {
69 71
                 $fields = $this->parseSourceEntity($name);
70
-            } catch (ReflectionException $e) {
72
+            }
73
+            catch (ReflectionException $e)
74
+            {
71 75
                 $this->writeln(
72 76
                     "<fg=red>Unable to create '<comment>{$declaration->getName()} from $name</comment>' declaration: "
73 77
                     . "'<comment>{$e->getMessage()}' at {$e->getFile()}:{$e->getLine()}.</comment></fg=red>"
@@ -75,13 +79,17 @@  discard block
 block discarded – undo
75 79
 
76 80
                 return;
77 81
             }
78
-        } else {
79
-            foreach ($this->option('field') as $field) {
82
+        }
83
+        else
84
+        {
85
+            foreach ($this->option('field') as $field)
86
+            {
80 87
                 $fields[] = $this->parseField($field);
81 88
             }
82 89
         }
83 90
 
84
-        foreach ($fields as $values) {
91
+        foreach ($fields as $values)
92
+        {
85 93
             [$field, $type, $source, $origin] = $values;
86 94
 
87 95
             $declaration->declareField($field, $type, $source, $origin);
@@ -102,16 +110,19 @@  discard block
 block discarded – undo
102 110
         $source = null;
103 111
         $origin = null;
104 112
 
105
-        if (strpos($field, '(') !== false) {
113
+        if (strpos($field, '(') !== false)
114
+        {
106 115
             $source = substr($field, strpos($field, '(') + 1, -1);
107 116
             $field = substr($field, 0, strpos($field, '('));
108 117
 
109
-            if (strpos($source, ':') !== false) {
118
+            if (strpos($source, ':') !== false)
119
+            {
110 120
                 [$source, $origin] = explode(':', $source);
111 121
             }
112 122
         }
113 123
 
114
-        if (strpos($field, ':') !== false) {
124
+        if (strpos($field, ':') !== false)
125
+        {
115 126
             [$field, $type] = explode(':', $field);
116 127
         }
117 128
 
@@ -127,7 +138,8 @@  discard block
 block discarded – undo
127 138
     {
128 139
         $fields = [];
129 140
         $reflection = new ReflectionClass($name);
130
-        foreach ($reflection->getProperties() as $property) {
141
+        foreach ($reflection->getProperties() as $property)
142
+        {
131 143
             $type = $this->getTypedPropertyType($property)
132 144
                 ?? $this->getPropertyTypeFromDefaults($property, $reflection)
133 145
                 ?? $this->getPropertyTypeFromDocBlock($property);
@@ -144,10 +156,12 @@  discard block
 block discarded – undo
144 156
      */
145 157
     private function getTypedPropertyType(ReflectionProperty $property): ?string
146 158
     {
147
-        if (method_exists($property, 'hasType') && method_exists($property, 'getType') && $property->hasType()) {
159
+        if (method_exists($property, 'hasType') && method_exists($property, 'getType') && $property->hasType())
160
+        {
148 161
             /** @var ReflectionType $type */
149 162
             $type = $property->getType();
150
-            if (method_exists($type, 'getName') && $this->isKnownType($type->getName())) {
163
+            if (method_exists($type, 'getName') && $this->isKnownType($type->getName()))
164
+            {
151 165
                 return $type->getName();
152 166
             }
153 167
         }
@@ -162,7 +176,8 @@  discard block
 block discarded – undo
162 176
      */
163 177
     private function getPropertyTypeFromDefaults(ReflectionProperty $property, ReflectionClass $reflection): ?string
164 178
     {
165
-        if (!isset($reflection->getDefaultProperties()[$property->name])) {
179
+        if (!isset($reflection->getDefaultProperties()[$property->name]))
180
+        {
166 181
             return null;
167 182
         }
168 183
 
@@ -178,9 +193,11 @@  discard block
 block discarded – undo
178 193
     private function getPropertyTypeFromDocBlock(ReflectionProperty $property): ?string
179 194
     {
180 195
         $doc = $property->getDocComment();
181
-        if (is_string($doc)) {
196
+        if (is_string($doc))
197
+        {
182 198
             preg_match('/@var\s*([\S]+)/i', $doc, $match);
183
-            if (!empty($match[1]) && $this->isKnownType($match[1])) {
199
+            if (!empty($match[1]) && $this->isKnownType($match[1]))
200
+            {
184 201
                 return $match[1];
185 202
             }
186 203
         }
Please login to merge, or discard this patch.
src/Scaffolder/src/Config/ScaffolderConfig.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
     {
57 57
         ['name' => $name] = $this->parseName($name);
58 58
 
59
-        return $this->classify($name) . $this->elementPostfix($element);
59
+        return $this->classify($name).$this->elementPostfix($element);
60 60
     }
61 61
 
62 62
     /**
@@ -69,15 +69,15 @@  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)) {
73
-            $localNamespace .= '\\' . $this->classify($namespace);
72
+        if (!empty($namespace)){
73
+            $localNamespace .= '\\'.$this->classify($namespace);
74 74
         }
75 75
 
76
-        if (empty($this->baseNamespace())) {
76
+        if (empty($this->baseNamespace())){
77 77
             return $localNamespace;
78 78
         }
79 79
 
80
-        return trim($this->baseNamespace() . '\\' . $localNamespace, '\\');
80
+        return trim($this->baseNamespace().'\\'.$localNamespace, '\\');
81 81
     }
82 82
 
83 83
     /**
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
         return $this->joinPathChunks([
94 94
             $this->baseDirectory(),
95 95
             str_replace('\\', '/', $namespace),
96
-            $this->className($element, $name) . '.php'
96
+            $this->className($element, $name).'.php'
97 97
         ], '/');
98 98
     }
99 99
 
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
     {
107 107
         $class = $this->getOption($element, 'class');
108 108
 
109
-        if (empty($class)) {
109
+        if (empty($class)){
110 110
             throw new ScaffolderException(
111 111
                 "Unable to scaffold '{$element}', no declaration class found"
112 112
             );
@@ -143,11 +143,11 @@  discard block
 block discarded – undo
143 143
      */
144 144
     private function getOption(string $element, string $section, $default = null)
145 145
     {
146
-        if (!isset($this->config['declarations'][$element])) {
146
+        if (!isset($this->config['declarations'][$element])){
147 147
             throw new ScaffolderException("Undefined declaration '{$element}'.");
148 148
         }
149 149
 
150
-        if (array_key_exists($section, $this->config['declarations'][$element])) {
150
+        if (array_key_exists($section, $this->config['declarations'][$element])){
151 151
             return $this->config['declarations'][$element][$section];
152 152
         }
153 153
 
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
     {
165 165
         $name = str_replace('/', '\\', $name);
166 166
 
167
-        if (strpos($name, '\\') !== false) {
167
+        if (strpos($name, '\\') !== false){
168 168
             $names = explode('\\', $name);
169 169
             $class = array_pop($names);
170 170
 
@@ -192,12 +192,12 @@  discard block
 block discarded – undo
192 192
     {
193 193
         $firstChunkIterated = false;
194 194
         $joinedPath = '';
195
-        foreach ($chunks as $chunk) {
196
-            if (!$firstChunkIterated) {
195
+        foreach ($chunks as $chunk){
196
+            if (!$firstChunkIterated){
197 197
                 $firstChunkIterated = true;
198 198
                 $joinedPath = $chunk;
199
-            } else {
200
-                $joinedPath = rtrim($joinedPath, $joint) . $joint . ltrim($chunk, $joint);
199
+            }else{
200
+                $joinedPath = rtrim($joinedPath, $joint).$joint.ltrim($chunk, $joint);
201 201
             }
202 202
         }
203 203
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
      */
211 211
     private function classify(string $name): string
212 212
     {
213
-        return ( new InflectorFactory() )
213
+        return (new InflectorFactory())
214 214
             ->build()
215 215
             ->classify($name);
216 216
     }
Please login to merge, or discard this patch.
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.
src/Scaffolder/src/helpers.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 
12 12
 namespace Spiral\Scaffolder;
13 13
 
14
-if (!function_exists('trimPostfix')) {
14
+if (!function_exists('trimPostfix')){
15 15
     /**
16 16
      * @param string $name
17 17
      * @param string $postfix
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
     }
26 26
 }
27 27
 
28
-if (!function_exists('isAssociativeArray')) {
28
+if (!function_exists('isAssociativeArray')){
29 29
     /**
30 30
      * @param array $array
31 31
      * @return bool
@@ -33,12 +33,12 @@  discard block
 block discarded – undo
33 33
     function isAssociativeArray(array $array): bool
34 34
     {
35 35
         $keys = [];
36
-        foreach ($array as $key => $value) {
37
-            if (!is_int($key)) {
36
+        foreach ($array as $key => $value){
37
+            if (!is_int($key)){
38 38
                 return true;
39 39
             }
40 40
 
41
-            if ($key !== count($keys)) {
41
+            if ($key !== count($keys)){
42 42
                 return true;
43 43
             }
44 44
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
     }
50 50
 }
51 51
 
52
-if (!function_exists('defineArrayType')) {
52
+if (!function_exists('defineArrayType')){
53 53
     /**
54 54
      * @param array  $array
55 55
      * @param string $failureType
Please login to merge, or discard this patch.
Braces   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,7 +11,8 @@  discard block
 block discarded – undo
11 11
 
12 12
 namespace Spiral\Scaffolder;
13 13
 
14
-if (!function_exists('trimPostfix')) {
14
+if (!function_exists('trimPostfix'))
15
+{
15 16
     /**
16 17
      * @param string $name
17 18
      * @param string $postfix
@@ -25,7 +26,8 @@  discard block
 block discarded – undo
25 26
     }
26 27
 }
27 28
 
28
-if (!function_exists('isAssociativeArray')) {
29
+if (!function_exists('isAssociativeArray'))
30
+{
29 31
     /**
30 32
      * @param array $array
31 33
      * @return bool
@@ -33,12 +35,15 @@  discard block
 block discarded – undo
33 35
     function isAssociativeArray(array $array): bool
34 36
     {
35 37
         $keys = [];
36
-        foreach ($array as $key => $value) {
37
-            if (!is_int($key)) {
38
+        foreach ($array as $key => $value)
39
+        {
40
+            if (!is_int($key))
41
+            {
38 42
                 return true;
39 43
             }
40 44
 
41
-            if ($key !== count($keys)) {
45
+            if ($key !== count($keys))
46
+            {
42 47
                 return true;
43 48
             }
44 49
 
@@ -49,7 +54,8 @@  discard block
 block discarded – undo
49 54
     }
50 55
 }
51 56
 
52
-if (!function_exists('defineArrayType')) {
57
+if (!function_exists('defineArrayType'))
58
+{
53 59
     /**
54 60
      * @param array  $array
55 61
      * @param string $failureType
Please login to merge, or discard this patch.