@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | public function getRoutes(?string $pageClass = null): self |
| 55 | 55 | { |
| 56 | - return ! $pageClass ? $this : $this->filter(function (RouteContract $route) use ($pageClass) { |
|
| 56 | + return !$pageClass ? $this : $this->filter(function(RouteContract $route) use ($pageClass) { |
|
| 57 | 57 | return $route->getSourceModel() instanceof $pageClass; |
| 58 | 58 | }); |
| 59 | 59 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | protected function discoverRoutes(): self |
| 81 | 81 | { |
| 82 | - $this->kernel->pages()->each(function (PageContract $page) { |
|
| 82 | + $this->kernel->pages()->each(function(PageContract $page) { |
|
| 83 | 83 | $this->discover($page); |
| 84 | 84 | }); |
| 85 | 85 | |
@@ -15,9 +15,9 @@ discard block |
||
| 15 | 15 | /** @return $this */ |
| 16 | 16 | public function generate(): static |
| 17 | 17 | { |
| 18 | - Hyde::routes()->getRoutes(DocumentationPage::class)->each(function (Route $route) { |
|
| 19 | - if (! $route->getSourceModel()->get('hidden', false)) { |
|
| 20 | - $this->items->push(tap(NavItem::fromRoute($route)->setPriority($this->getPriorityForRoute($route)), function (NavItem $item) { |
|
| 18 | + Hyde::routes()->getRoutes(DocumentationPage::class)->each(function(Route $route) { |
|
| 19 | + if (!$route->getSourceModel()->get('hidden', false)) { |
|
| 20 | + $this->items->push(tap(NavItem::fromRoute($route)->setPriority($this->getPriorityForRoute($route)), function(NavItem $item) { |
|
| 21 | 21 | $item->title = $item->route->getSourceModel()->get('label'); |
| 22 | 22 | })); |
| 23 | 23 | } |
@@ -33,14 +33,14 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | public function getGroups(): array |
| 35 | 35 | { |
| 36 | - return $this->items->map(function (NavItem $item) { |
|
| 36 | + return $this->items->map(function(NavItem $item) { |
|
| 37 | 37 | return $item->getGroup(); |
| 38 | 38 | })->unique()->toArray(); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | public function getItemsInGroup(?string $group): Collection |
| 42 | 42 | { |
| 43 | - return $this->items->filter(function ($item) use ($group) { |
|
| 43 | + return $this->items->filter(function($item) use ($group) { |
|
| 44 | 44 | return $item->getGroup() === $group || $item->getGroup() === Str::slug($group); |
| 45 | 45 | })->sortBy('priority')->values(); |
| 46 | 46 | } |
@@ -29,11 +29,11 @@ discard block |
||
| 29 | 29 | /** @return $this */ |
| 30 | 30 | public function generate(): static |
| 31 | 31 | { |
| 32 | - Hyde::routes()->each(function (Route $route) { |
|
| 32 | + Hyde::routes()->each(function(Route $route) { |
|
| 33 | 33 | $this->items->push(NavItem::fromRoute($route)); |
| 34 | 34 | }); |
| 35 | 35 | |
| 36 | - collect(config('hyde.navigation.custom', []))->each(function (NavItem $item) { |
|
| 36 | + collect(config('hyde.navigation.custom', []))->each(function(NavItem $item) { |
|
| 37 | 37 | $this->items->push($item); |
| 38 | 38 | }); |
| 39 | 39 | |
@@ -59,14 +59,14 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | protected function filterHiddenItems(): Collection |
| 61 | 61 | { |
| 62 | - return $this->items->reject(function (NavItem $item) { |
|
| 62 | + return $this->items->reject(function(NavItem $item) { |
|
| 63 | 63 | return $item->hidden; |
| 64 | 64 | })->values(); |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | protected function filterDuplicateItems(): Collection |
| 68 | 68 | { |
| 69 | - return $this->items->unique(function (NavItem $item) { |
|
| 69 | + return $this->items->unique(function(NavItem $item) { |
|
| 70 | 70 | return $item->resolveLink(); |
| 71 | 71 | }); |
| 72 | 72 | } |
@@ -112,7 +112,7 @@ |
||
| 112 | 112 | /** @inheritDoc */ |
| 113 | 113 | public static function getFromSource(string $sourceFilePath): static |
| 114 | 114 | { |
| 115 | - return Hyde::routes()->first(function (RouteContract $route) use ($sourceFilePath) { |
|
| 115 | + return Hyde::routes()->first(function(RouteContract $route) use ($sourceFilePath) { |
|
| 116 | 116 | return $route->getSourceFilePath() === $sourceFilePath; |
| 117 | 117 | }) ?? throw new RouteNotFoundException($sourceFilePath); |
| 118 | 118 | } |
@@ -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 | /** @deprecated v0.60.x - You should not run tests in a production environment. */ |
| 16 | 16 | function backupDirectory(string $directory): void |
| 17 | 17 | { |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | } |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | -if (! function_exists('restoreDirectory')) { |
|
| 24 | +if (!function_exists('restoreDirectory')) { |
|
| 25 | 25 | /** @deprecated v0.60.x - You should not run tests in a production environment. */ |
| 26 | 26 | function restoreDirectory(string $directory): void |
| 27 | 27 | { |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | } |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | -if (! function_exists('deleteDirectory')) { |
|
| 35 | +if (!function_exists('deleteDirectory')) { |
|
| 36 | 36 | function deleteDirectory(string $directory): void |
| 37 | 37 | { |
| 38 | 38 | if (file_exists($directory)) { |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | } |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | -if (! function_exists('unlinkUnlessDefault')) { |
|
| 44 | +if (!function_exists('unlinkUnlessDefault')) { |
|
| 45 | 45 | function unlinkUnlessDefault(string $filepath): void |
| 46 | 46 | { |
| 47 | 47 | $protected = [ |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | '.gitkeep', |
| 52 | 52 | ]; |
| 53 | 53 | |
| 54 | - if (! in_array(basename($filepath), $protected)) { |
|
| 54 | + if (!in_array(basename($filepath), $protected)) { |
|
| 55 | 55 | unlink($filepath); |
| 56 | 56 | } |
| 57 | 57 | } |