@@ -21,7 +21,7 @@ |
||
21 | 21 | |
22 | 22 | public function handle(): void |
23 | 23 | { |
24 | - if (! Hyde::hasSiteUrl()) { |
|
24 | + if (!Hyde::hasSiteUrl()) { |
|
25 | 25 | $this->skip('Cannot generate sitemap without a valid base URL'); |
26 | 26 | } |
27 | 27 |
@@ -30,7 +30,7 @@ |
||
30 | 30 | if ($this->hasYamlConfigFile()) { |
31 | 31 | $data = $this->parseYamlFile(); |
32 | 32 | |
33 | - if (! self::configurationContainsNamespaces($data)) { |
|
33 | + if (!self::configurationContainsNamespaces($data)) { |
|
34 | 34 | $data = ['hyde' => $data]; |
35 | 35 | } |
36 | 36 |
@@ -34,7 +34,7 @@ |
||
34 | 34 | |
35 | 35 | protected function canInjectSiteNameEnvironmentVariable(): bool |
36 | 36 | { |
37 | - return $this->yamlHasSiteNameSet() && ! $this->alreadyHasEnvironmentVariable(); |
|
37 | + return $this->yamlHasSiteNameSet() && !$this->alreadyHasEnvironmentVariable(); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | protected function alreadyHasEnvironmentVariable(): bool |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | |
36 | 36 | protected function runDiscovery(): void |
37 | 37 | { |
38 | - $this->kernel->files()->each(function (SourceFile $file): void { |
|
38 | + $this->kernel->files()->each(function(SourceFile $file): void { |
|
39 | 39 | $this->addPage($this->parsePage($file->pageClass, $file->getPath())); |
40 | 40 | }); |
41 | 41 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | /** @param class-string<\Hyde\Pages\Concerns\HydePage>|null $pageClass */ |
63 | 63 | public function getPages(?string $pageClass = null): PageCollection |
64 | 64 | { |
65 | - return $pageClass ? $this->filter(function (HydePage $page) use ($pageClass): bool { |
|
65 | + return $pageClass ? $this->filter(function(HydePage $page) use ($pageClass) : bool { |
|
66 | 66 | return $page instanceof $pageClass; |
67 | 67 | }) : $this; |
68 | 68 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | protected function runDiscovery(): void |
38 | 38 | { |
39 | - $this->kernel->pages()->each(function (HydePage $page): void { |
|
39 | + $this->kernel->pages()->each(function(HydePage $page): void { |
|
40 | 40 | $this->addRoute(new Route($page)); |
41 | 41 | }); |
42 | 42 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | /** @param class-string<\Hyde\Pages\Concerns\HydePage>|null $pageClass */ |
57 | 57 | public function getRoutes(?string $pageClass = null): RouteCollection |
58 | 58 | { |
59 | - return $pageClass ? $this->filter(function (Route $route) use ($pageClass): bool { |
|
59 | + return $pageClass ? $this->filter(function(Route $route) use ($pageClass) : bool { |
|
60 | 60 | return $route->getPage() instanceof $pageClass; |
61 | 61 | }) : $this; |
62 | 62 | } |
@@ -84,7 +84,7 @@ |
||
84 | 84 | */ |
85 | 85 | private function formatArray(array $array): string |
86 | 86 | { |
87 | - $json = json_encode($array, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); |
|
87 | + $json = json_encode($array, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES); |
|
88 | 88 | |
89 | 89 | // Transform JSON to PHP array syntax |
90 | 90 | $php = preg_replace('/^(\s*)\"(\w+)\":/m', '$1$2:', $json); // Remove quotes from keys |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | protected static function mockRender(): Render |
55 | 55 | { |
56 | - return tap(new Render(), function () { |
|
56 | + return tap(new Render(), function() { |
|
57 | 57 | Render::swap(new RenderData()); |
58 | 58 | }); |
59 | 59 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | |
66 | 66 | protected static function mockConfig(array $items = []): void |
67 | 67 | { |
68 | - Config::swap(tap(new Repository($items), function ($config) { |
|
68 | + Config::swap(tap(new Repository($items), function($config) { |
|
69 | 69 | app()->instance('config', $config); |
70 | 70 | })); |
71 | 71 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | /** @return \Illuminate\Filesystem\Filesystem&\Mockery\MockInterface */ |
74 | 74 | protected function mockFilesystem(array $methods = []): Filesystem |
75 | 75 | { |
76 | - return tap(Mockery::mock(Filesystem::class, $methods)->makePartial(), function ($filesystem) { |
|
76 | + return tap(Mockery::mock(Filesystem::class, $methods)->makePartial(), function($filesystem) { |
|
77 | 77 | app()->instance(Filesystem::class, $filesystem); |
78 | 78 | }); |
79 | 79 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | /** @return \Illuminate\Filesystem\Filesystem&\Mockery\MockInterface */ |
82 | 82 | protected function mockFilesystemStrict(array $methods = []): Filesystem |
83 | 83 | { |
84 | - return tap(Mockery::mock(Filesystem::class, $methods), function ($filesystem) { |
|
84 | + return tap(Mockery::mock(Filesystem::class, $methods), function($filesystem) { |
|
85 | 85 | app()->instance(Filesystem::class, $filesystem); |
86 | 86 | }); |
87 | 87 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | { |
68 | 68 | $element = $this->query($selector); |
69 | 69 | |
70 | - if (! $element) { |
|
70 | + if (!$element) { |
|
71 | 71 | PHPUnit::fail("No element matching the selector '$selector' was found in the HTML."); |
72 | 72 | } |
73 | 73 | |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | $nodes = new Collection(); |
152 | 152 | $dom = new DOMDocument(); |
153 | 153 | |
154 | - $dom->loadHTML($html, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD | LIBXML_NOERROR | LIBXML_NOWARNING | LIBXML_NONET | LIBXML_NOXMLDECL | LIBXML_COMPACT | LIBXML_PARSEHUGE); |
|
154 | + $dom->loadHTML($html, LIBXML_HTML_NOIMPLIED|LIBXML_HTML_NODEFDTD|LIBXML_NOERROR|LIBXML_NOWARNING|LIBXML_NONET|LIBXML_NOXMLDECL|LIBXML_COMPACT|LIBXML_PARSEHUGE); |
|
155 | 155 | |
156 | 156 | // Initiate recursive parsing from the root element |
157 | 157 | foreach ($dom->childNodes as $childNode) { |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public static function handle(string $directory, array|string|false $matchExtensions = false, bool $recursive = false): Collection |
23 | 23 | { |
24 | - if (! Filesystem::isDirectory($directory)) { |
|
24 | + if (!Filesystem::isDirectory($directory)) { |
|
25 | 25 | return collect(); |
26 | 26 | } |
27 | 27 | |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | $finder->name(static::buildFileExtensionPattern((array) $matchExtensions)); |
36 | 36 | } |
37 | 37 | |
38 | - return collect($finder)->map(function (SplFileInfo $file): string { |
|
38 | + return collect($finder)->map(function(SplFileInfo $file): string { |
|
39 | 39 | return Hyde::pathToRelative($file->getPathname()); |
40 | 40 | })->sort()->values(); |
41 | 41 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | /** @param array<string> $extensions */ |
52 | 52 | private static function expandCommaSeparatedValues(array $extensions): array |
53 | 53 | { |
54 | - return array_merge(...array_map(function (string $item): array { |
|
54 | + return array_merge(...array_map(function(string $item): array { |
|
55 | 55 | return array_map(fn (string $item): string => trim($item), explode(',', $item)); |
56 | 56 | }, $extensions)); |
57 | 57 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | /** @param array<string> $extensions */ |
60 | 60 | private static function normalizeExtensionForRegexPattern(array $extensions): string |
61 | 61 | { |
62 | - return implode('|', array_map(function (string $extension): string { |
|
62 | + return implode('|', array_map(function(string $extension): string { |
|
63 | 63 | return preg_quote(ltrim($extension, '.'), '/'); |
64 | 64 | }, $extensions)); |
65 | 65 | } |