@@ -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 | } |