@@ -67,7 +67,7 @@ |
||
67 | 67 | { |
68 | 68 | $path = Hyde::path('_media/'.$this->image->getSource()); |
69 | 69 | |
70 | - if (! file_exists($path)) { |
|
70 | + if (!file_exists($path)) { |
|
71 | 71 | $this->write(' > <comment>Warning:</comment> Could not find image file at '.$path.'!'); |
72 | 72 | $this->write(' <fg=gray> Using default content length of 0. '.'</>'); |
73 | 73 |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | */ |
98 | 98 | public function validate(): void |
99 | 99 | { |
100 | - if (! ( |
|
100 | + if (!( |
|
101 | 101 | str_starts_with($this->path, Hyde::pathToRelative(Hyde::getBladePagePath())) || |
102 | 102 | str_starts_with($this->path, Hyde::pathToRelative(Hyde::getMarkdownPagePath())) || |
103 | 103 | str_starts_with($this->path, Hyde::pathToRelative(Hyde::getMarkdownPostPath())) || |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | throw new Exception("Path [$this->path] is not in a valid source directory.", 400); |
107 | 107 | } |
108 | 108 | |
109 | - if (! file_exists(Hyde::path($this->path))) { |
|
109 | + if (!file_exists(Hyde::path($this->path))) { |
|
110 | 110 | throw new Exception("File [$this->path] not found.", 404); |
111 | 111 | } |
112 | 112 | } |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | public function getPages(?string $pageClass = null): self |
27 | 27 | { |
28 | - return ! $pageClass ? $this : $this->filter(function (HydePage $page) use ($pageClass): bool { |
|
28 | + return !$pageClass ? $this : $this->filter(function(HydePage $page) use ($pageClass) : bool { |
|
29 | 29 | return $page instanceof $pageClass; |
30 | 30 | }); |
31 | 31 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | protected function discoverPagesFor(string $pageClass): void |
55 | 55 | { |
56 | - $this->parsePagesFor($pageClass)->each(function ($page) { |
|
56 | + $this->parsePagesFor($pageClass)->each(function($page) { |
|
57 | 57 | $this->discover($page); |
58 | 58 | }); |
59 | 59 | } |
@@ -36,12 +36,12 @@ |
||
36 | 36 | */ |
37 | 37 | public static function getSourceFileListForModel(string $model): array |
38 | 38 | { |
39 | - if (! class_exists($model) || ! is_subclass_of($model, HydePage::class)) { |
|
39 | + if (!class_exists($model) || !is_subclass_of($model, HydePage::class)) { |
|
40 | 40 | throw new UnsupportedPageTypeException($model); |
41 | 41 | } |
42 | 42 | |
43 | 43 | $files = []; |
44 | - Hyde::files()->getSourceFiles($model)->each(function (File $file) use (&$files, $model) { |
|
44 | + Hyde::files()->getSourceFiles($model)->each(function(File $file) use (&$files, $model) { |
|
45 | 45 | $files[] = self::formatSlugForModel($model, $file->withoutDirectoryPrefix()); |
46 | 46 | }); |
47 | 47 |
@@ -23,7 +23,7 @@ |
||
23 | 23 | $filepath = $model::sourceDirectory().'/'. |
24 | 24 | $slug.$model::fileExtension(); |
25 | 25 | |
26 | - if (! file_exists(Hyde::path($filepath))) { |
|
26 | + if (!file_exists(Hyde::path($filepath))) { |
|
27 | 27 | throw new FileNotFoundException($filepath); |
28 | 28 | } |
29 | 29 | } |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | */ |
245 | 245 | public function has(string $key): bool |
246 | 246 | { |
247 | - return ! blank($this->get($key)); |
|
247 | + return !blank($this->get($key)); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | // Section: Accessors |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | |
265 | 265 | public function showInNavigation(): bool |
266 | 266 | { |
267 | - return ! $this->navigation['hidden']; |
|
267 | + return !$this->navigation['hidden']; |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | public function navigationMenuPriority(): int |
@@ -19,26 +19,26 @@ discard block |
||
19 | 19 | { |
20 | 20 | public function getSourceFiles(?string $pageClass = null): self |
21 | 21 | { |
22 | - return ! $pageClass ? $this->getAllSourceFiles() : $this->getSourceFilesFor($pageClass); |
|
22 | + return !$pageClass ? $this->getAllSourceFiles() : $this->getSourceFilesFor($pageClass); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | public function getAllSourceFiles(): self |
26 | 26 | { |
27 | - return $this->filter(function (File $file) { |
|
27 | + return $this->filter(function(File $file) { |
|
28 | 28 | return $file->belongsTo !== null; |
29 | 29 | }); |
30 | 30 | } |
31 | 31 | |
32 | 32 | public function getSourceFilesFor(string $pageClass): self |
33 | 33 | { |
34 | - return $this->filter(function (File $file) use ($pageClass): bool { |
|
34 | + return $this->filter(function(File $file) use ($pageClass): bool { |
|
35 | 35 | return $file->belongsTo() === $pageClass; |
36 | 36 | }); |
37 | 37 | } |
38 | 38 | |
39 | 39 | public function getMediaFiles(): self |
40 | 40 | { |
41 | - return $this->filter(function (File $file): bool { |
|
41 | + return $this->filter(function(File $file): bool { |
|
42 | 42 | return str_starts_with($file, '_media'); |
43 | 43 | }); |
44 | 44 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | { |
72 | 72 | // Scan the source directory, and directories therein, for files that match the model's file extension. |
73 | 73 | foreach (glob($this->kernel->path($pageClass::sourcePath('{*,**/*}')), GLOB_BRACE) as $filepath) { |
74 | - if (! str_starts_with(basename($filepath), '_')) { |
|
74 | + if (!str_starts_with(basename($filepath), '_')) { |
|
75 | 75 | $this->put($this->kernel->pathToRelative($filepath), File::make($filepath)->belongsTo($pageClass)); |
76 | 76 | } |
77 | 77 | } |
@@ -16,8 +16,8 @@ discard block |
||
16 | 16 | /** @return $this */ |
17 | 17 | public function generate(): static |
18 | 18 | { |
19 | - Hyde::routes()->getRoutes(DocumentationPage::class)->each(function (Route $route) { |
|
20 | - $this->items->push(tap(NavItem::fromRoute($route)->setPriority($this->getPriorityForRoute($route)), function (NavItem $item) { |
|
19 | + Hyde::routes()->getRoutes(DocumentationPage::class)->each(function(Route $route) { |
|
20 | + $this->items->push(tap(NavItem::fromRoute($route)->setPriority($this->getPriorityForRoute($route)), function(NavItem $item) { |
|
21 | 21 | $item->label = $item->route->getSourceModel()->get('navigation.label'); |
22 | 22 | })); |
23 | 23 | }); |
@@ -32,14 +32,14 @@ discard block |
||
32 | 32 | |
33 | 33 | public function getGroups(): array |
34 | 34 | { |
35 | - return $this->items->map(function (NavItem $item) { |
|
35 | + return $this->items->map(function(NavItem $item) { |
|
36 | 36 | return $item->getGroup(); |
37 | 37 | })->unique()->toArray(); |
38 | 38 | } |
39 | 39 | |
40 | 40 | public function getItemsInGroup(?string $group): Collection |
41 | 41 | { |
42 | - return $this->items->filter(function ($item) use ($group) { |
|
42 | + return $this->items->filter(function($item) use ($group) { |
|
43 | 43 | return $item->getGroup() === $group || $item->getGroup() === Str::slug($group); |
44 | 44 | })->sortBy('navigation.priority')->values(); |
45 | 45 | } |
@@ -51,6 +51,6 @@ discard block |
||
51 | 51 | |
52 | 52 | protected function filterDocumentationPage(NavItem $item): bool |
53 | 53 | { |
54 | - return ! parent::filterDocumentationPage($item); |
|
54 | + return !parent::filterDocumentationPage($item); |
|
55 | 55 | } |
56 | 56 | } |
@@ -31,11 +31,11 @@ discard block |
||
31 | 31 | /** @return $this */ |
32 | 32 | public function generate(): static |
33 | 33 | { |
34 | - Hyde::routes()->each(function (Route $route) { |
|
34 | + Hyde::routes()->each(function(Route $route) { |
|
35 | 35 | $this->items->push(NavItem::fromRoute($route)); |
36 | 36 | }); |
37 | 37 | |
38 | - collect(config('hyde.navigation.custom', []))->each(function (NavItem $item) { |
|
38 | + collect(config('hyde.navigation.custom', []))->each(function(NavItem $item) { |
|
39 | 39 | $this->items->push($item); |
40 | 40 | }); |
41 | 41 | |
@@ -61,14 +61,14 @@ discard block |
||
61 | 61 | |
62 | 62 | protected function filterHiddenItems(): Collection |
63 | 63 | { |
64 | - return $this->items->reject(function (NavItem $item) { |
|
64 | + return $this->items->reject(function(NavItem $item) { |
|
65 | 65 | return $item->hidden || $this->filterDocumentationPage($item); |
66 | 66 | })->values(); |
67 | 67 | } |
68 | 68 | |
69 | 69 | protected function filterDuplicateItems(): Collection |
70 | 70 | { |
71 | - return $this->items->unique(function (NavItem $item) { |
|
71 | + return $this->items->unique(function(NavItem $item) { |
|
72 | 72 | return $item->resolveLink(); |
73 | 73 | }); |
74 | 74 | } |