@@ -23,7 +23,7 @@ class Docs
23
23
public const SUPPORT_VERSIONS = [
24
24
'8.x ' ,
25
25
'5.4 ' ,
26
- '4.2 '
26
+ '4.2 ' ,
27
27
];
28
28
29
29
/**
@@ -64,7 +64,7 @@ class Docs
64
64
*/
65
65
public function __construct (string $ version , string $ file )
66
66
{
67
- $ this ->file = $ file . '.md ' ;
67
+ $ this ->file = $ file. '.md ' ;
68
68
$ this ->version = $ version ;
69
69
$ this ->path = "/ $ version/ $ this ->file " ;
70
70
@@ -77,7 +77,7 @@ public function __construct(string $version, string $file)
77
77
78
78
try {
79
79
$ this ->variables = Yaml::parse ($ variables );
80
- }catch (\Throwable ){
80
+ } catch (\Throwable ) {
81
81
82
82
}
83
83
}
@@ -87,9 +87,9 @@ public function __construct(string $version, string $file)
87
87
*
88
88
* @param string $view The view name.
89
89
*
90
- * @return \Illuminate\Contracts\View\View The rendered view of the documentation page.
91
- *
92
90
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
91
+ *
92
+ * @return \Illuminate\Contracts\View\View The rendered view of the documentation page.
93
93
*/
94
94
public function view (string $ view )
95
95
{
@@ -115,7 +115,7 @@ public function view(string $view)
115
115
*/
116
116
public function getMenu (): array
117
117
{
118
- $ page = Storage::disk ('docs ' )->get ($ this ->version . '/documentation.md ' );
118
+ $ page = Storage::disk ('docs ' )->get ($ this ->version . '/documentation.md ' );
119
119
120
120
$ html = Str::of ($ page )
121
121
->after ('--- ' )
@@ -156,7 +156,7 @@ public function docsToArray(string $html): array
156
156
$ menu = [];
157
157
158
158
$ crawler ->filter ('ul > li ' )->each (function (Crawler $ node ) use (&$ menu ) {
159
- $ subList = $ node ->filter ('ul > li ' )->each (fn (Crawler $ subNode ) => [
159
+ $ subList = $ node ->filter ('ul > li ' )->each (fn (Crawler $ subNode ) => [
160
160
'title ' => $ subNode ->filter ('a ' )->text (),
161
161
'href ' => url ($ subNode ->filter ('a ' )->attr ('href ' )),
162
162
]);
@@ -181,15 +181,15 @@ public function docsToArray(string $html): array
181
181
*
182
182
* @return \Illuminate\Support\Collection A collection of Docs instances.
183
183
*/
184
- static public function every (string $ version ): \Illuminate \Support \Collection
184
+ public static function every (string $ version ): \Illuminate \Support \Collection
185
185
{
186
186
$ files = Storage::disk ('docs ' )->allFiles ($ version );
187
187
188
188
return collect ($ files )
189
- ->filter (fn (string $ path ) => Str::of ($ path )->endsWith ('.md ' ))
190
- ->filter (fn (string $ path ) => !Str::of ($ path )->endsWith (['readme.md ' , 'license.md ' ]))
191
- ->map (fn (string $ path ) => Str::of ($ path )->after ($ version . '/ ' )->before ('.md ' ))
192
- ->map (fn (string $ path ) => new static ($ version , $ path ));
189
+ ->filter (fn (string $ path ) => Str::of ($ path )->endsWith ('.md ' ))
190
+ ->filter (fn (string $ path ) => ! Str::of ($ path )->endsWith (['readme.md ' , 'license.md ' ]))
191
+ ->map (fn (string $ path ) => Str::of ($ path )->after ($ version. '/ ' )->before ('.md ' ))
192
+ ->map (fn (string $ path ) => new static ($ version , $ path ));
193
193
}
194
194
195
195
/**
@@ -205,7 +205,7 @@ public function fetchBehind(): int
205
205
->get ("https://api.github.com/repos/laravel/docs/commits?sha= {$ this ->version }&path= {$ this ->file }" );
206
206
207
207
return $ response ->collect ()
208
- ->takeUntil (fn ($ commit ) => $ commit ['sha ' ] === $ this ->variables ['git ' ])
208
+ ->takeUntil (fn ($ commit ) => $ commit ['sha ' ] === $ this ->variables ['git ' ])
209
209
->count ();
210
210
}
211
211
@@ -237,11 +237,11 @@ public function goToOriginal(): string
237
237
*
238
238
* @return string
239
239
*/
240
- static public function compareLink (string $ version , string $ hash ): string
240
+ public static function compareLink (string $ version , string $ hash ): string
241
241
{
242
242
$ compactHash = Str::of ($ hash )->limit (7 , '' )->toString ();
243
243
244
- return "https://github.com/laravel/docs/compare/ $ version .. $ compactHash " ;
244
+ return "https://github.com/laravel/docs/compare/ $ compactHash .. $ version " ;
245
245
}
246
246
247
247
/**
@@ -262,9 +262,9 @@ public function getModel(): Document
262
262
}
263
263
264
264
/**
265
- * @return int
265
+ * @return int|null
266
266
*/
267
- public function behind ():int
267
+ public function behind (): ? int
268
268
{
269
269
return $ this ->getModel ()->behind ;
270
270
}
0 commit comments