@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | $structure = ''; |
| 39 | 39 | |
| 40 | - $this->nodes->each(function (TestableHtmlElement $node) use (&$structure): void { |
|
| 40 | + $this->nodes->each(function(TestableHtmlElement $node) use (&$structure): void { |
|
| 41 | 41 | $structure .= $this->createStructureMapEntry($node, 0); |
| 42 | 42 | }); |
| 43 | 43 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | { |
| 49 | 49 | $text = ''; |
| 50 | 50 | |
| 51 | - $this->nodes->each(function (TestableHtmlElement $node) use (&$text): void { |
|
| 51 | + $this->nodes->each(function(TestableHtmlElement $node) use (&$text): void { |
|
| 52 | 52 | $text .= $this->createTextMapEntry($node); |
| 53 | 53 | }); |
| 54 | 54 | |
@@ -89,17 +89,17 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | protected function createStructureMapEntry(TestableHtmlElement $node, int $level): string |
| 91 | 91 | { |
| 92 | - return sprintf("\n%s%s%s", str_repeat(' ', $level), $node->tag, $node->nodes->map(function (TestableHtmlElement $node) use ($level): string { |
|
| 92 | + return sprintf("\n%s%s%s", str_repeat(' ', $level), $node->tag, $node->nodes->map(function(TestableHtmlElement $node) use ($level): string { |
|
| 93 | 93 | return $this->createStructureMapEntry($node, $level + 1); |
| 94 | 94 | })->implode('')); |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | protected function createTextMapEntry(TestableHtmlElement $node, bool $addNewline = true): string |
| 98 | 98 | { |
| 99 | - $childEntries = $node->nodes->map(function (TestableHtmlElement $node): string { |
|
| 99 | + $childEntries = $node->nodes->map(function(TestableHtmlElement $node): string { |
|
| 100 | 100 | $isInline = in_array($node->tag, ['a', 'abbr', 'acronym', 'b', 'bdo', 'big', 'br', 'button', 'cite', 'code', 'dfn', 'em', 'i', 'img', 'input', 'kbd', 'label', 'map', 'object', 'q', 'samp', 'script', 'select', 'small', 'span', 'strong', 'sub', 'sup', 'textarea', 'time', 'tt', 'var']); |
| 101 | 101 | |
| 102 | - return $this->createTextMapEntry($node, ! $isInline); |
|
| 102 | + return $this->createTextMapEntry($node, !$isInline); |
|
| 103 | 103 | })->implode(''); |
| 104 | 104 | |
| 105 | 105 | return sprintf('%s%s%s', $addNewline ? "\n" : ' ', $node->text, $childEntries); |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | $html .= '<h2>Abstract Syntax Tree Node Inspection</h2>'; |
| 113 | 113 | $openAllButton = '<script>function openAll() {document.querySelectorAll(\'details\').forEach((el) => el.open = true);}</script><a href="javascript:openAll();" onclick="this.remove();">Open all</a>'; |
| 114 | - $html .= sprintf("\n<details open><summary><strong>Document</strong> <small>$openAllButton</small></summary>\n<ul>%s</ul></details>\n", $this->nodes->map(function (TestableHtmlElement $node): string { |
|
| 114 | + $html .= sprintf("\n<details open><summary><strong>Document</strong> <small>$openAllButton</small></summary>\n<ul>%s</ul></details>\n", $this->nodes->map(function(TestableHtmlElement $node): string { |
|
| 115 | 115 | return $this->createDumpNodeMapEntry($node); |
| 116 | 116 | })->implode('')); |
| 117 | 117 | |
@@ -130,20 +130,20 @@ discard block |
||
| 130 | 130 | { |
| 131 | 131 | $data = $node->toArray(); |
| 132 | 132 | |
| 133 | - $list = sprintf("\n <ul class=\"node\">\n%s </ul>\n", implode('', array_map(function (string|iterable $value, string $key): string { |
|
| 133 | + $list = sprintf("\n <ul class=\"node\">\n%s </ul>\n", implode('', array_map(function(string|iterable $value, string $key): string { |
|
| 134 | 134 | if ($value instanceof Collection) { |
| 135 | 135 | if ($value->isEmpty()) { |
| 136 | 136 | return sprintf(" <li><strong>%s</strong>: <span>None</span></li>\n", ucfirst($key)); |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - return sprintf(" <li><strong>%s</strong>: <ul>%s</ul></li>\n", ucfirst($key), $value->map(function (TestableHtmlElement $node): string { |
|
| 139 | + return sprintf(" <li><strong>%s</strong>: <ul>%s</ul></li>\n", ucfirst($key), $value->map(function(TestableHtmlElement $node): string { |
|
| 140 | 140 | return $this->createDumpNodeMapEntry($node); |
| 141 | 141 | })->implode('')); |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | if (is_array($value)) { |
| 145 | - if (! is_numeric(array_key_first($value))) { |
|
| 146 | - $value = array_map(function (string $value, string $key): string { |
|
| 145 | + if (!is_numeric(array_key_first($value))) { |
|
| 146 | + $value = array_map(function(string $value, string $key): string { |
|
| 147 | 147 | return sprintf('%s: %s', $key, str_contains($value, ' ') ? sprintf('"%s"', $value) : $value); |
| 148 | 148 | }, $value, array_keys($value)); |
| 149 | 149 | } |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | */ |
| 133 | 133 | public static function files(): array |
| 134 | 134 | { |
| 135 | - return Files::getFiles(static::class)->map(function (SourceFile $file): string { |
|
| 135 | + return Files::getFiles(static::class)->map(function(SourceFile $file): string { |
|
| 136 | 136 | return static::pathToIdentifier($file->getPath()); |
| 137 | 137 | })->values()->toArray(); |
| 138 | 138 | } |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | */ |
| 371 | 371 | public function showInNavigation(): bool |
| 372 | 372 | { |
| 373 | - return ! $this->navigation->hidden; |
|
| 373 | + return !$this->navigation->hidden; |
|
| 374 | 374 | } |
| 375 | 375 | |
| 376 | 376 | /** |
@@ -402,11 +402,11 @@ discard block |
||
| 402 | 402 | /** @var ?string $value */ |
| 403 | 403 | $value = $this->matter('canonicalUrl'); |
| 404 | 404 | |
| 405 | - if (! empty($value)) { |
|
| 405 | + if (!empty($value)) { |
|
| 406 | 406 | return $value; |
| 407 | 407 | } |
| 408 | 408 | |
| 409 | - if (Hyde::hasSiteUrl() && ! empty($this->identifier)) { |
|
| 409 | + if (Hyde::hasSiteUrl() && !empty($this->identifier)) { |
|
| 410 | 410 | return Hyde::url($this->getOutputPath()); |
| 411 | 411 | } |
| 412 | 412 | |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | /** @param string[] $parameterNames */ |
| 89 | 89 | protected static function qualifyArguments(array $parameterNames, array $arguments): Collection |
| 90 | 90 | { |
| 91 | - return collect($arguments)->mapWithKeys(function (string|array|int|bool $argumentValue, int|string $key) use ($parameterNames): string|array|int|bool { |
|
| 91 | + return collect($arguments)->mapWithKeys(function(string|array|int|bool $argumentValue, int|string $key) use ($parameterNames): string|array|int|bool { |
|
| 92 | 92 | $argumentsToQualify = ['path', 'paths', 'file', 'target', 'directory', 'destination', 'firstFile', 'secondFile', 'pattern', 'link', 'from', 'to']; |
| 93 | 93 | |
| 94 | 94 | if (is_int($key)) { |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | protected static function qualifyPathArgument(array|string $path): string|array |
| 108 | 108 | { |
| 109 | 109 | return is_array($path) |
| 110 | - ? array_map(fn (string $path): string => self::qualifyPathArgument($path), $path) |
|
| 110 | + ? array_map(fn (string $path) : string => self::qualifyPathArgument($path), $path) |
|
| 111 | 111 | : self::absolutePath($path); |
| 112 | 112 | } |
| 113 | 113 | } |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | /** Get all the configuration files for the application. */ |
| 20 | 20 | protected function getConfigurationFiles(Application $app): array |
| 21 | 21 | { |
| 22 | - return (array) tap(parent::getConfigurationFiles($app), /** @param array<string, string> $files */ function (array &$files) use ($app): void { |
|
| 22 | + return (array) tap(parent::getConfigurationFiles($app), /** @param array<string, string> $files */ function(array &$files) use ($app): void { |
|
| 23 | 23 | // Inject our custom config file which is stored in `app/config.php`. |
| 24 | 24 | $files['app'] ??= $app->basePath().DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'config.php'; |
| 25 | 25 | }); |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | { |
| 55 | 55 | $selected = $this->parseSelection(); |
| 56 | 56 | |
| 57 | - if (! $this->canExistingFileBeOverwritten()) { |
|
| 57 | + if (!$this->canExistingFileBeOverwritten()) { |
|
| 58 | 58 | $this->error('A modified index.blade.php file already exists. Use --force to overwrite.'); |
| 59 | 59 | |
| 60 | 60 | return 409; |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | protected function formatPublishableChoices(): array |
| 94 | 94 | { |
| 95 | - return $this->getTemplateOptions()->map(function (array $option, string $key): string { |
|
| 95 | + return $this->getTemplateOptions()->map(function(array $option, string $key): string { |
|
| 96 | 96 | return "<comment>$key</comment>: {$option['description']}"; |
| 97 | 97 | })->values()->toArray(); |
| 98 | 98 | } |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | return true; |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - if (! file_exists(BladePage::path('index.blade.php'))) { |
|
| 117 | + if (!file_exists(BladePage::path('index.blade.php'))) { |
|
| 118 | 118 | return true; |
| 119 | 119 | } |
| 120 | 120 | |
@@ -98,6 +98,6 @@ |
||
| 98 | 98 | |
| 99 | 99 | protected function isPageDiscoverable(): bool |
| 100 | 100 | { |
| 101 | - return filled($this->route->getSourcePath()) && ! $this->route->getPage() instanceof InMemoryPage; |
|
| 101 | + return filled($this->route->getSourcePath()) && !$this->route->getPage() instanceof InMemoryPage; |
|
| 102 | 102 | } |
| 103 | 103 | } |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | */ |
| 137 | 137 | public function vendorPath(string $path = '', string $package = 'framework'): string |
| 138 | 138 | { |
| 139 | - if (PharSupport::running() && ! PharSupport::hasVendorDirectory()) { |
|
| 139 | + if (PharSupport::running() && !PharSupport::hasVendorDirectory()) { |
|
| 140 | 140 | return PharSupport::vendorPath($path, $package); |
| 141 | 141 | } |
| 142 | 142 | |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | */ |
| 151 | 151 | public function touch(string|array $path): bool |
| 152 | 152 | { |
| 153 | - return collect($path)->map(function (string $path): bool { |
|
| 153 | + return collect($path)->map(function(string $path): bool { |
|
| 154 | 154 | return touch($this->path($path)); |
| 155 | 155 | })->contains(false) === false; |
| 156 | 156 | } |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | */ |
| 163 | 163 | public function unlink(string|array $path): bool |
| 164 | 164 | { |
| 165 | - return collect($path)->map(function (string $path): bool { |
|
| 165 | + return collect($path)->map(function(string $path): bool { |
|
| 166 | 166 | return unlink($this->path($path)); |
| 167 | 167 | })->contains(false) === false; |
| 168 | 168 | } |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | protected function file(string $path, ?string $contents = null): void |
| 24 | 24 | { |
| 25 | - if (! is_dir(dirname($path))) { |
|
| 25 | + if (!is_dir(dirname($path))) { |
|
| 26 | 26 | $this->directory(dirname($path)); |
| 27 | 27 | } |
| 28 | 28 | |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | if (sizeof($this->fileMemory) > 0) { |
| 64 | 64 | foreach ($this->fileMemory as $file) { |
| 65 | 65 | if (Filesystem::isDirectory($file)) { |
| 66 | - if (! in_array($file, ['_site', '_media', '_pages', '_posts', '_docs', 'app', 'config', 'storage', 'vendor', 'node_modules'])) { |
|
| 66 | + if (!in_array($file, ['_site', '_media', '_pages', '_posts', '_docs', 'app', 'config', 'storage', 'vendor', 'node_modules'])) { |
|
| 67 | 67 | Filesystem::deleteDirectory($file); |
| 68 | 68 | } |
| 69 | 69 | } else { |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | |
| 31 | 31 | return match ($this->option('format')) { |
| 32 | 32 | 'txt' => $this->table($this->makeHeader($routes), $routes) ?? Command::SUCCESS, |
| 33 | - 'json' => $this->writeRaw(json_encode($routes, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)) ?? Command::SUCCESS, |
|
| 33 | + 'json' => $this->writeRaw(json_encode($routes, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES)) ?? Command::SUCCESS, |
|
| 34 | 34 | default => $this->error("Invalid format provided. Only 'txt' and 'json' are supported.") ?? Command::FAILURE, |
| 35 | 35 | }; |
| 36 | 36 | } |