@@ -65,14 +65,14 @@ |
||
65 | 65 | |
66 | 66 | protected function registerPreProcessor(string $class, bool $when = true): void |
67 | 67 | { |
68 | - if (! in_array($class, $this->preprocessors) && $when) { |
|
68 | + if (!in_array($class, $this->preprocessors) && $when) { |
|
69 | 69 | $this->preprocessors[] = $class; |
70 | 70 | } |
71 | 71 | } |
72 | 72 | |
73 | 73 | protected function registerPostProcessor(string $class, bool $when = true): void |
74 | 74 | { |
75 | - if (! in_array($class, $this->postprocessors) && $when) { |
|
75 | + if (!in_array($class, $this->postprocessors) && $when) { |
|
76 | 76 | $this->postprocessors[] = $class; |
77 | 77 | } |
78 | 78 | } |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | use Illuminate\Support\Facades\File; |
4 | 4 | |
5 | -if (! function_exists('unlinkIfExists')) { |
|
5 | +if (!function_exists('unlinkIfExists')) { |
|
6 | 6 | function unlinkIfExists(string $filepath): void |
7 | 7 | { |
8 | 8 | if (file_exists($filepath)) { |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | } |
12 | 12 | } |
13 | 13 | |
14 | -if (! function_exists('backupDirectory')) { |
|
14 | +if (!function_exists('backupDirectory')) { |
|
15 | 15 | function backupDirectory(string $directory): void |
16 | 16 | { |
17 | 17 | if (file_exists($directory)) { |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | } |
21 | 21 | } |
22 | 22 | |
23 | -if (! function_exists('restoreDirectory')) { |
|
23 | +if (!function_exists('restoreDirectory')) { |
|
24 | 24 | function restoreDirectory(string $directory): void |
25 | 25 | { |
26 | 26 | if (file_exists($directory.'-bak')) { |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | } |
31 | 31 | } |
32 | 32 | |
33 | -if (! function_exists('deleteDirectory')) { |
|
33 | +if (!function_exists('deleteDirectory')) { |
|
34 | 34 | function deleteDirectory(string $directory): void |
35 | 35 | { |
36 | 36 | if (file_exists($directory)) { |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | } |
40 | 40 | } |
41 | 41 | |
42 | -if (! function_exists('unlinkUnlessDefault')) { |
|
42 | +if (!function_exists('unlinkUnlessDefault')) { |
|
43 | 43 | function unlinkUnlessDefault(string $filepath): void |
44 | 44 | { |
45 | 45 | $protected = [ |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | '.gitkeep', |
50 | 50 | ]; |
51 | 51 | |
52 | - if (! in_array(basename($filepath), $protected)) { |
|
52 | + if (!in_array(basename($filepath), $protected)) { |
|
53 | 53 | unlink($filepath); |
54 | 54 | } |
55 | 55 | } |
@@ -31,7 +31,7 @@ |
||
31 | 31 | return ''; |
32 | 32 | } |
33 | 33 | |
34 | - return sprintf(' %s', collect($this->attr)->map(function ($value, $key) { |
|
34 | + return sprintf(' %s', collect($this->attr)->map(function($value, $key) { |
|
35 | 35 | return e($key).'="'.e($value).'"'; |
36 | 36 | })->implode(' ')); |
37 | 37 | } |
@@ -46,7 +46,7 @@ |
||
46 | 46 | // Reject any metadata from the global metadata bag that is already present in the page metadata bag. |
47 | 47 | |
48 | 48 | foreach (['links', 'metadata', 'properties', 'generics'] as $type) { |
49 | - $global->$type = array_filter($global->$type, fn ($meta) => ! in_array($meta->uniqueKey(), |
|
49 | + $global->$type = array_filter($global->$type, fn ($meta) => !in_array($meta->uniqueKey(), |
|
50 | 50 | array_map(fn ($meta) => $meta->uniqueKey(), $page->metadata->$type) |
51 | 51 | )); |
52 | 52 | } |
@@ -22,26 +22,26 @@ discard block |
||
22 | 22 | { |
23 | 23 | public function getSourceFiles(?string $pageClass = null): self |
24 | 24 | { |
25 | - return ! $pageClass ? $this->getAllSourceFiles() : $this->getSourceFilesFor($pageClass); |
|
25 | + return !$pageClass ? $this->getAllSourceFiles() : $this->getSourceFilesFor($pageClass); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | public function getAllSourceFiles(): self |
29 | 29 | { |
30 | - return $this->filter(function (File $file) { |
|
30 | + return $this->filter(function(File $file) { |
|
31 | 31 | return $file->belongsTo !== null; |
32 | 32 | }); |
33 | 33 | } |
34 | 34 | |
35 | 35 | public function getSourceFilesFor(string $pageClass): self |
36 | 36 | { |
37 | - return $this->filter(function (File $file) use ($pageClass): bool { |
|
37 | + return $this->filter(function(File $file) use ($pageClass): bool { |
|
38 | 38 | return $file->belongsTo() === $pageClass; |
39 | 39 | }); |
40 | 40 | } |
41 | 41 | |
42 | 42 | public function getMediaFiles(): self |
43 | 43 | { |
44 | - return $this->filter(function (File $file): bool { |
|
44 | + return $this->filter(function(File $file): bool { |
|
45 | 45 | return str_starts_with((string) $file, '_media'); |
46 | 46 | }); |
47 | 47 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | { |
79 | 79 | // Scan the source directory, and directories therein, for files that match the model's file extension. |
80 | 80 | foreach (glob($this->kernel->path($pageClass::sourcePath('{*,**/*}')), GLOB_BRACE) as $filepath) { |
81 | - if (! str_starts_with(basename($filepath), '_')) { |
|
81 | + if (!str_starts_with(basename($filepath), '_')) { |
|
82 | 82 | $this->put($this->kernel->pathToRelative($filepath), File::make($filepath)->belongsTo($pageClass)); |
83 | 83 | } |
84 | 84 | } |
@@ -141,7 +141,7 @@ |
||
141 | 141 | $string = trim($string); |
142 | 142 | |
143 | 143 | // Check if string is an array |
144 | - if (! static::isValueArrayString($string)) { |
|
144 | + if (!static::isValueArrayString($string)) { |
|
145 | 145 | throw new RuntimeException('Failed parsing BladeMatter array. Input string must follow array syntax.'); |
146 | 146 | } |
147 | 147 |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | public function compileStaticPages(): void |
41 | 41 | { |
42 | - $this->getDiscoveredModels()->each(function (string $pageClass) { |
|
42 | + $this->getDiscoveredModels()->each(function(string $pageClass) { |
|
43 | 43 | $this->compilePagesForClass($pageClass); |
44 | 44 | }); |
45 | 45 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | |
66 | 66 | $this->withProgressBar( |
67 | 67 | $collection, |
68 | - function ($filepath) { |
|
68 | + function($filepath) { |
|
69 | 69 | copy($filepath, Hyde::sitePath('media/'.basename($filepath))); |
70 | 70 | } |
71 | 71 | ); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | */ |
78 | 78 | protected function getDiscoveredModels(): RouteCollection |
79 | 79 | { |
80 | - return $this->router->getRoutes()->map(function (Route $route) { |
|
80 | + return $this->router->getRoutes()->map(function(Route $route) { |
|
81 | 81 | return $route->getPageType(); |
82 | 82 | })->unique(); |
83 | 83 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | /** @psalm-return \Closure(\Hyde\Framework\Models\Support\Route):string */ |
100 | 100 | protected function compileRoute(): Closure |
101 | 101 | { |
102 | - return function (Route $route) { |
|
102 | + return function(Route $route) { |
|
103 | 103 | return (new StaticPageBuilder($route->getSourceModel()))->__invoke(); |
104 | 104 | }; |
105 | 105 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | |
112 | 112 | protected function isItSafeToCleanOutputDirectory(): bool |
113 | 113 | { |
114 | - if (! $this->isOutputDirectoryWhitelisted() && ! $this->askIfUnsafeDirectoryShouldBeEmptied()) { |
|
114 | + if (!$this->isOutputDirectoryWhitelisted() && !$this->askIfUnsafeDirectoryShouldBeEmptied()) { |
|
115 | 115 | $this->info('Output directory will not be emptied.'); |
116 | 116 | |
117 | 117 | return false; |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | |
28 | 28 | public function __construct() |
29 | 29 | { |
30 | - if (! extension_loaded('simplexml') || config('testing.mock_disabled_extensions', false) === true) { |
|
30 | + if (!extension_loaded('simplexml') || config('testing.mock_disabled_extensions', false) === true) { |
|
31 | 31 | throw new Exception('The ext-simplexml extension is not installed, but is required to generate RSS feeds.'); |
32 | 32 | } |
33 | 33 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | public function generate(): static |
41 | 41 | { |
42 | - Route::all()->each(function ($route) { |
|
42 | + Route::all()->each(function($route) { |
|
43 | 43 | $this->addRoute($route); |
44 | 44 | }); |
45 | 45 |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | |
24 | 24 | public function __construct() |
25 | 25 | { |
26 | - if (! extension_loaded('simplexml') || config('testing.mock_disabled_extensions', false) === true) { |
|
26 | + if (!extension_loaded('simplexml') || config('testing.mock_disabled_extensions', false) === true) { |
|
27 | 27 | throw new Exception('The ext-simplexml extension is not installed, but is required to generate RSS feeds.'); |
28 | 28 | } |
29 | 29 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | |
111 | 111 | protected static function xmlEscape(string $string): string |
112 | 112 | { |
113 | - return htmlspecialchars($string, ENT_XML1 | ENT_COMPAT, 'UTF-8'); |
|
113 | + return htmlspecialchars($string, ENT_XML1|ENT_COMPAT, 'UTF-8'); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | public static function getDescription(): string |