@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | /** |
| 7 | 7 | * @deprecated You should not run tests in a production environment. |
| 8 | 8 | */ |
| 9 | -if (! function_exists('backup')) { |
|
| 9 | +if (!function_exists('backup')) { |
|
| 10 | 10 | function backup(string $filepath) |
| 11 | 11 | { |
| 12 | 12 | if (file_exists($filepath)) { |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | } |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | -if (! function_exists('restore')) { |
|
| 18 | +if (!function_exists('restore')) { |
|
| 19 | 19 | function restore(string $filepath) |
| 20 | 20 | { |
| 21 | 21 | if (file_exists($filepath.'.bak')) { |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | } |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | -if (! function_exists('unlinkIfExists')) { |
|
| 28 | +if (!function_exists('unlinkIfExists')) { |
|
| 29 | 29 | function unlinkIfExists(string $filepath) |
| 30 | 30 | { |
| 31 | 31 | if (file_exists($filepath)) { |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | } |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | -if (! function_exists('backupDirectory')) { |
|
| 37 | +if (!function_exists('backupDirectory')) { |
|
| 38 | 38 | function backupDirectory(string $directory) |
| 39 | 39 | { |
| 40 | 40 | if (file_exists($directory)) { |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | -if (! function_exists('restoreDirectory')) { |
|
| 46 | +if (!function_exists('restoreDirectory')) { |
|
| 47 | 47 | function restoreDirectory(string $directory) |
| 48 | 48 | { |
| 49 | 49 | if (file_exists($directory.'-bak')) { |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | -if (! function_exists('deleteDirectory')) { |
|
| 56 | +if (!function_exists('deleteDirectory')) { |
|
| 57 | 57 | function deleteDirectory(string $directory) |
| 58 | 58 | { |
| 59 | 59 | if (file_exists($directory)) { |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | } |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | -if (! function_exists('createTestPost')) { |
|
| 65 | +if (!function_exists('createTestPost')) { |
|
| 66 | 66 | /** @deprecated - You usually don't need an actual post file anymore. Use touch() instead. */ |
| 67 | 67 | function createTestPost(?string $path = null): string |
| 68 | 68 | { |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | -if (! function_exists('unlinkUnlessDefault')) { |
|
| 85 | +if (!function_exists('unlinkUnlessDefault')) { |
|
| 86 | 86 | function unlinkUnlessDefault(string $filepath) |
| 87 | 87 | { |
| 88 | 88 | $protected = [ |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | '.gitkeep', |
| 93 | 93 | ]; |
| 94 | 94 | |
| 95 | - if (! in_array(basename($filepath), $protected)) { |
|
| 95 | + if (!in_array(basename($filepath), $protected)) { |
|
| 96 | 96 | unlink($filepath); |
| 97 | 97 | } |
| 98 | 98 | } |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | protected function setUp(): void |
| 22 | 22 | { |
| 23 | 23 | // \LaravelZero\Framework\Testing\TestCase instead \Illuminate\Foundation\Testing\TestCase |
| 24 | - if (! $this->app) { |
|
| 24 | + if (!$this->app) { |
|
| 25 | 25 | $this->refreshApplication(); |
| 26 | 26 | } |
| 27 | 27 | |
@@ -50,14 +50,14 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | Browser::$storeSourceAt = base_path('tests/Browser/source'); |
| 52 | 52 | |
| 53 | - Browser::$userResolver = function () { |
|
| 53 | + Browser::$userResolver = function() { |
|
| 54 | 54 | return $this->user(); |
| 55 | 55 | }; |
| 56 | 56 | |
| 57 | - Browser::macro('storeSourceAsHtml', function ($name) { |
|
| 57 | + Browser::macro('storeSourceAsHtml', function($name) { |
|
| 58 | 58 | $source = $this->driver->getPageSource(); |
| 59 | 59 | |
| 60 | - if (! empty($source)) { |
|
| 60 | + if (!empty($source)) { |
|
| 61 | 61 | file_put_contents( |
| 62 | 62 | sprintf('%s/%s.html', rtrim(static::$storeSourceAt, '/'), $name), $source |
| 63 | 63 | ); |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | public static function prepare() |
| 108 | 108 | { |
| 109 | - if (! static::runningInSail()) { |
|
| 109 | + if (!static::runningInSail()) { |
|
| 110 | 110 | static::startChromeDriver(); |
| 111 | 111 | } |
| 112 | 112 | } |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | { |
| 121 | 121 | $options = (new ChromeOptions)->addArguments(collect([ |
| 122 | 122 | $this->shouldStartMaximized() ? '--start-maximized' : '--window-size=1920,1080', |
| 123 | - ])->unless($this->hasHeadlessDisabled(), function ($items) { |
|
| 123 | + ])->unless($this->hasHeadlessDisabled(), function($items) { |
|
| 124 | 124 | return $items->merge([ |
| 125 | 125 | '--disable-gpu', |
| 126 | 126 | '--headless', |
@@ -177,7 +177,7 @@ |
||
| 177 | 177 | */ |
| 178 | 178 | public function hasSiteUrl(): bool |
| 179 | 179 | { |
| 180 | - return ! blank(config('site.url')); |
|
| 180 | + return !blank(config('site.url')); |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | /** |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | /** @return $this */ |
| 13 | 13 | public function generate(): static |
| 14 | 14 | { |
| 15 | - RoutingService::getInstance()->getRoutesForModel(DocumentationPage::class)->each(function (Route $route) { |
|
| 15 | + RoutingService::getInstance()->getRoutesForModel(DocumentationPage::class)->each(function(Route $route) { |
|
| 16 | 16 | $this->items->push(NavItem::fromRoute($route)->setPriority($this->getPriorityForRoute($route))); |
| 17 | 17 | }); |
| 18 | 18 | |
@@ -21,28 +21,28 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | public function hasGroups(): bool |
| 23 | 23 | { |
| 24 | - return $this->items->map(function (NavItem $item) { |
|
| 24 | + return $this->items->map(function(NavItem $item) { |
|
| 25 | 25 | return $item->getGroup() !== null; |
| 26 | 26 | })->contains(true); |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | public function getGroups(): array |
| 30 | 30 | { |
| 31 | - return $this->items->map(function (NavItem $item) { |
|
| 31 | + return $this->items->map(function(NavItem $item) { |
|
| 32 | 32 | return $item->getGroup(); |
| 33 | 33 | })->unique()->toArray(); |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | public function getItemsInGroup(?string $group): Collection |
| 37 | 37 | { |
| 38 | - return $this->items->filter(function ($item) use ($group) { |
|
| 38 | + return $this->items->filter(function($item) use ($group) { |
|
| 39 | 39 | return $item->getGroup() === $group || $item->getGroup() === Str::slug($group); |
| 40 | 40 | })->sortBy('priority')->values(); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | protected function filterHiddenItems(): Collection |
| 44 | 44 | { |
| 45 | - return $this->items->reject(function (NavItem $item) { |
|
| 45 | + return $this->items->reject(function(NavItem $item) { |
|
| 46 | 46 | return $item->route->getSourceModel()->matter('hidden', false) || ($item->route->getRouteKey() === 'docs/index'); |
| 47 | 47 | })->values(); |
| 48 | 48 | } |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | { |
| 57 | 57 | $orderIndexArray = config('docs.sidebar_order', []); |
| 58 | 58 | |
| 59 | - if (! in_array($slug, $orderIndexArray)) { |
|
| 59 | + if (!in_array($slug, $orderIndexArray)) { |
|
| 60 | 60 | return 500; |
| 61 | 61 | } |
| 62 | 62 | |
@@ -28,11 +28,11 @@ discard block |
||
| 28 | 28 | /** @return $this */ |
| 29 | 29 | public function generate(): static |
| 30 | 30 | { |
| 31 | - RoutingService::getInstance()->getRoutes()->each(function (Route $route) { |
|
| 31 | + RoutingService::getInstance()->getRoutes()->each(function(Route $route) { |
|
| 32 | 32 | $this->items->push(NavItem::fromRoute($route)); |
| 33 | 33 | }); |
| 34 | 34 | |
| 35 | - collect(config('hyde.navigation.custom', []))->each(function (NavItem $item) { |
|
| 35 | + collect(config('hyde.navigation.custom', []))->each(function(NavItem $item) { |
|
| 36 | 36 | $this->items->push($item); |
| 37 | 37 | }); |
| 38 | 38 | |
@@ -64,14 +64,14 @@ discard block |
||
| 64 | 64 | |
| 65 | 65 | protected function filterHiddenItems(): Collection |
| 66 | 66 | { |
| 67 | - return $this->items->reject(function (NavItem $item) { |
|
| 67 | + return $this->items->reject(function(NavItem $item) { |
|
| 68 | 68 | return $item->hidden; |
| 69 | 69 | })->values(); |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | protected function filterDuplicateItems(): Collection |
| 73 | 73 | { |
| 74 | - return $this->items->unique(function (NavItem $item) { |
|
| 74 | + return $this->items->unique(function(NavItem $item) { |
|
| 75 | 75 | return $item->resolveLink(); |
| 76 | 76 | }); |
| 77 | 77 | } |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | */ |
| 57 | 57 | public static function getSourceFileListForModel(string $model): array |
| 58 | 58 | { |
| 59 | - if (! class_exists($model) || ! is_subclass_of($model, AbstractPage::class)) { |
|
| 59 | + if (!class_exists($model) || !is_subclass_of($model, AbstractPage::class)) { |
|
| 60 | 60 | throw new UnsupportedPageTypeException($model); |
| 61 | 61 | } |
| 62 | 62 | |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | |
| 65 | 65 | $files = []; |
| 66 | 66 | foreach (glob(Hyde::path($model::qualifyBasename('{*,**/*}')), GLOB_BRACE) as $filepath) { |
| 67 | - if (! str_starts_with(basename($filepath), '_')) { |
|
| 67 | + if (!str_starts_with(basename($filepath), '_')) { |
|
| 68 | 68 | $files[] = self::formatSlugForModel($model, $filepath); |
| 69 | 69 | } |
| 70 | 70 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | public function compileStaticPages(): void |
| 36 | 36 | { |
| 37 | - $this->getDiscoveredModels()->each(function (string $pageClass) { |
|
| 37 | + $this->getDiscoveredModels()->each(function(string $pageClass) { |
|
| 38 | 38 | $this->compilePagesForClass($pageClass); |
| 39 | 39 | }); |
| 40 | 40 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | $this->withProgressBar( |
| 62 | 62 | $collection, |
| 63 | - function ($filepath) { |
|
| 63 | + function($filepath) { |
|
| 64 | 64 | copy($filepath, Hyde::getSiteOutputPath('media/'.basename($filepath))); |
| 65 | 65 | } |
| 66 | 66 | ); |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | protected function getDiscoveredModels(): Collection |
| 71 | 71 | { |
| 72 | - return $this->router->getRoutes()->map(function (Route $route) { |
|
| 72 | + return $this->router->getRoutes()->map(function(Route $route) { |
|
| 73 | 73 | return $route->getPageType(); |
| 74 | 74 | })->unique(); |
| 75 | 75 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | protected function compileRoute(): \Closure |
| 92 | 92 | { |
| 93 | - return function (Route $route) { |
|
| 93 | + return function(Route $route) { |
|
| 94 | 94 | return (new StaticPageBuilder($route->getSourceModel()))->__invoke(); |
| 95 | 95 | }; |
| 96 | 96 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | |
| 103 | 103 | protected function isItSafeToCleanOutputDirectory(): bool |
| 104 | 104 | { |
| 105 | - if (! $this->isOutputDirectoryWhitelisted() && ! $this->askIfUnsafeDirectoryShouldBeEmptied()) { |
|
| 105 | + if (!$this->isOutputDirectoryWhitelisted() && !$this->askIfUnsafeDirectoryShouldBeEmptied()) { |
|
| 106 | 106 | $this->info('Output directory will not be emptied.'); |
| 107 | 107 | |
| 108 | 108 | return false; |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | public function __construct() |
| 22 | 22 | { |
| 23 | - if (! extension_loaded('simplexml') || config('testing.mock_disabled_extensions', false) === true) { |
|
| 23 | + if (!extension_loaded('simplexml') || config('testing.mock_disabled_extensions', false) === true) { |
|
| 24 | 24 | throw new \Exception('The ext-simplexml extension is not installed, but is required to generate RSS feeds.'); |
| 25 | 25 | } |
| 26 | 26 | |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | protected static function xmlEscape(string $string): string |
| 107 | 107 | { |
| 108 | - return htmlspecialchars($string, ENT_XML1 | ENT_COMPAT, 'UTF-8'); |
|
| 108 | + return htmlspecialchars($string, ENT_XML1|ENT_COMPAT, 'UTF-8'); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | public static function getDescription(): string |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | public function __construct() |
| 27 | 27 | { |
| 28 | - if (! extension_loaded('simplexml') || config('testing.mock_disabled_extensions', false) === true) { |
|
| 28 | + if (!extension_loaded('simplexml') || config('testing.mock_disabled_extensions', false) === true) { |
|
| 29 | 29 | throw new \Exception('The ext-simplexml extension is not installed, but is required to generate RSS feeds.'); |
| 30 | 30 | } |
| 31 | 31 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | public function generate(): static |
| 39 | 39 | { |
| 40 | - Route::all()->each(function ($route) { |
|
| 40 | + Route::all()->each(function($route) { |
|
| 41 | 41 | $this->addRoute($route); |
| 42 | 42 | }); |
| 43 | 43 | |