@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | $class = $this->classify($name); |
| 46 | 46 | $postfix = $this->elementPostfix($element); |
| 47 | 47 | |
| 48 | - return \str_ends_with($class, $postfix) ? $class : $class . $postfix; |
|
| 48 | + return \str_ends_with($class, $postfix) ? $class : $class.$postfix; |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | /** |
@@ -56,15 +56,15 @@ discard block |
||
| 56 | 56 | $localNamespace = \trim($this->getOption($element, 'namespace', ''), '\\'); |
| 57 | 57 | ['namespace' => $namespace] = $this->parseName($name); |
| 58 | 58 | |
| 59 | - if (!empty($namespace)) { |
|
| 60 | - $localNamespace .= '\\' . $this->classify($namespace); |
|
| 59 | + if (!empty($namespace)){ |
|
| 60 | + $localNamespace .= '\\'.$this->classify($namespace); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - if (empty($this->baseNamespace($element))) { |
|
| 63 | + if (empty($this->baseNamespace($element))){ |
|
| 64 | 64 | return $localNamespace; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - return \trim($this->baseNamespace($element) . '\\' . $localNamespace, '\\'); |
|
| 67 | + return \trim($this->baseNamespace($element).'\\'.$localNamespace, '\\'); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /** |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | return $this->joinPathChunks([ |
| 82 | 82 | $this->baseDirectory(), |
| 83 | 83 | \str_replace('\\', '/', $elementNamespace), |
| 84 | - $this->className($element, $name) . '.php', |
|
| 84 | + $this->className($element, $name).'.php', |
|
| 85 | 85 | ], '/'); |
| 86 | 86 | } |
| 87 | 87 | |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | { |
| 95 | 95 | $class = $this->getOption($element, 'class'); |
| 96 | 96 | |
| 97 | - if (empty($class)) { |
|
| 97 | + if (empty($class)){ |
|
| 98 | 98 | throw new ScaffolderException( |
| 99 | 99 | \sprintf("Unable to scaffold '%s', no declaration class found", $element) |
| 100 | 100 | ); |
@@ -129,11 +129,11 @@ discard block |
||
| 129 | 129 | { |
| 130 | 130 | $declaration = $this->getDeclaration($element); |
| 131 | 131 | |
| 132 | - if ($declaration === []) { |
|
| 132 | + if ($declaration === []){ |
|
| 133 | 133 | throw new ScaffolderException(\sprintf("Undefined declaration '%s'.", $element)); |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | - if (\array_key_exists($section, $declaration)) { |
|
| 136 | + if (\array_key_exists($section, $declaration)){ |
|
| 137 | 137 | return $declaration[$section]; |
| 138 | 138 | } |
| 139 | 139 | |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | { |
| 152 | 152 | $name = \str_replace('/', '\\', $name); |
| 153 | 153 | |
| 154 | - if (str_contains($name, '\\')) { |
|
| 154 | + if (str_contains($name, '\\')){ |
|
| 155 | 155 | $names = \explode('\\', $name); |
| 156 | 156 | $class = \array_pop($names); |
| 157 | 157 | |
@@ -169,8 +169,8 @@ discard block |
||
| 169 | 169 | { |
| 170 | 170 | $declaration = $this->getDeclaration($element); |
| 171 | 171 | |
| 172 | - if (\array_key_exists('baseNamespace', $declaration)) { |
|
| 173 | - return \trim((string) $this->getOption($element, 'baseNamespace', ''), '\\'); |
|
| 172 | + if (\array_key_exists('baseNamespace', $declaration)){ |
|
| 173 | + return \trim((string)$this->getOption($element, 'baseNamespace', ''), '\\'); |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | return \trim($this->config['namespace'], '\\'); |
@@ -180,12 +180,12 @@ discard block |
||
| 180 | 180 | { |
| 181 | 181 | $firstChunkIterated = false; |
| 182 | 182 | $joinedPath = ''; |
| 183 | - foreach ($chunks as $chunk) { |
|
| 184 | - if (!$firstChunkIterated) { |
|
| 183 | + foreach ($chunks as $chunk){ |
|
| 184 | + if (!$firstChunkIterated){ |
|
| 185 | 185 | $firstChunkIterated = true; |
| 186 | 186 | $joinedPath = $chunk; |
| 187 | - } else { |
|
| 188 | - $joinedPath = \rtrim($joinedPath, $joint) . $joint . \ltrim($chunk, $joint); |
|
| 187 | + }else{ |
|
| 188 | + $joinedPath = \rtrim($joinedPath, $joint).$joint.\ltrim($chunk, $joint); |
|
| 189 | 189 | } |
| 190 | 190 | } |
| 191 | 191 | |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | |
| 195 | 195 | private function classify(string $name): string |
| 196 | 196 | { |
| 197 | - return ( new InflectorFactory() ) |
|
| 197 | + return (new InflectorFactory()) |
|
| 198 | 198 | ->build() |
| 199 | 199 | ->classify($name); |
| 200 | 200 | } |
@@ -56,11 +56,13 @@ discard block |
||
| 56 | 56 | $localNamespace = \trim($this->getOption($element, 'namespace', ''), '\\'); |
| 57 | 57 | ['namespace' => $namespace] = $this->parseName($name); |
| 58 | 58 | |
| 59 | - if (!empty($namespace)) { |
|
| 59 | + if (!empty($namespace)) |
|
| 60 | + { |
|
| 60 | 61 | $localNamespace .= '\\' . $this->classify($namespace); |
| 61 | 62 | } |
| 62 | 63 | |
| 63 | - if (empty($this->baseNamespace($element))) { |
|
| 64 | + if (empty($this->baseNamespace($element))) |
|
| 65 | + { |
|
| 64 | 66 | return $localNamespace; |
| 65 | 67 | } |
| 66 | 68 | |
@@ -94,7 +96,8 @@ discard block |
||
| 94 | 96 | { |
| 95 | 97 | $class = $this->getOption($element, 'class'); |
| 96 | 98 | |
| 97 | - if (empty($class)) { |
|
| 99 | + if (empty($class)) |
|
| 100 | + { |
|
| 98 | 101 | throw new ScaffolderException( |
| 99 | 102 | \sprintf("Unable to scaffold '%s', no declaration class found", $element) |
| 100 | 103 | ); |
@@ -129,11 +132,13 @@ discard block |
||
| 129 | 132 | { |
| 130 | 133 | $declaration = $this->getDeclaration($element); |
| 131 | 134 | |
| 132 | - if ($declaration === []) { |
|
| 135 | + if ($declaration === []) |
|
| 136 | + { |
|
| 133 | 137 | throw new ScaffolderException(\sprintf("Undefined declaration '%s'.", $element)); |
| 134 | 138 | } |
| 135 | 139 | |
| 136 | - if (\array_key_exists($section, $declaration)) { |
|
| 140 | + if (\array_key_exists($section, $declaration)) |
|
| 141 | + { |
|
| 137 | 142 | return $declaration[$section]; |
| 138 | 143 | } |
| 139 | 144 | |
@@ -151,7 +156,8 @@ discard block |
||
| 151 | 156 | { |
| 152 | 157 | $name = \str_replace('/', '\\', $name); |
| 153 | 158 | |
| 154 | - if (str_contains($name, '\\')) { |
|
| 159 | + if (str_contains($name, '\\')) |
|
| 160 | + { |
|
| 155 | 161 | $names = \explode('\\', $name); |
| 156 | 162 | $class = \array_pop($names); |
| 157 | 163 | |
@@ -169,7 +175,8 @@ discard block |
||
| 169 | 175 | { |
| 170 | 176 | $declaration = $this->getDeclaration($element); |
| 171 | 177 | |
| 172 | - if (\array_key_exists('baseNamespace', $declaration)) { |
|
| 178 | + if (\array_key_exists('baseNamespace', $declaration)) |
|
| 179 | + { |
|
| 173 | 180 | return \trim((string) $this->getOption($element, 'baseNamespace', ''), '\\'); |
| 174 | 181 | } |
| 175 | 182 | |
@@ -180,11 +187,15 @@ discard block |
||
| 180 | 187 | { |
| 181 | 188 | $firstChunkIterated = false; |
| 182 | 189 | $joinedPath = ''; |
| 183 | - foreach ($chunks as $chunk) { |
|
| 184 | - if (!$firstChunkIterated) { |
|
| 190 | + foreach ($chunks as $chunk) |
|
| 191 | + { |
|
| 192 | + if (!$firstChunkIterated) |
|
| 193 | + { |
|
| 185 | 194 | $firstChunkIterated = true; |
| 186 | 195 | $joinedPath = $chunk; |
| 187 | - } else { |
|
| 196 | + } |
|
| 197 | + else |
|
| 198 | + { |
|
| 188 | 199 | $joinedPath = \rtrim($joinedPath, $joint) . $joint . \ltrim($chunk, $joint); |
| 189 | 200 | } |
| 190 | 201 | } |