2020
2121class ShowDocumentationController extends Controller
2222{
23- public function __invoke (Request $ request , string $ version , string $ page = null )
23+ public function __invoke (Request $ request , string $ version , ? string $ page = null )
2424 {
2525 if (config ('app.env ' ) === 'local ' ) {
2626 Cache::flush ();
@@ -123,15 +123,15 @@ protected function getNavigation(string $version): array
123123 $ basePath = resource_path ('views ' );
124124 $ path = "$ basePath/docs/ $ version " ;
125125
126- $ mainNavigation = (new Finder () )
126+ $ mainNavigation = (new Finder )
127127 ->files ()
128128 ->name ('_index.md ' )
129129 ->depth (1 )
130130 ->in ($ path );
131131
132132 $ navigation = collect ();
133133
134- $ mainPages = (new Finder () )
134+ $ mainPages = (new Finder )
135135 ->files ()
136136 ->notName ('_index.md ' )
137137 ->name ('*.md ' )
@@ -145,7 +145,7 @@ protected function getNavigation(string $version): array
145145 $ path = Str::after ($ mainPage ->getPath (), $ basePath ).'/ ' .$ mainPage ->getBasename ('.md ' );
146146
147147 $ navigation ->push ([
148- 'path ' => $ path ,
148+ 'path ' => $ path ,
149149 'title ' => $ parsedSection ->matter ('title ' , '' ),
150150 'order ' => $ parsedSection ->matter ('order ' , 0 ),
151151 ]);
@@ -156,11 +156,11 @@ protected function getNavigation(string $version): array
156156 $ parsedSection = YamlFrontMatter::parse ($ section ->getContents ());
157157 $ navigationEntry = [
158158 'relative_path ' => $ section ->getRelativePath (),
159- 'title ' => $ parsedSection ->matter ('title ' , '' ),
160- 'order ' => $ parsedSection ->matter ('order ' , 0 ),
159+ 'title ' => $ parsedSection ->matter ('title ' , '' ),
160+ 'order ' => $ parsedSection ->matter ('order ' , 0 ),
161161 ];
162162
163- $ subSections = (new Finder () )
163+ $ subSections = (new Finder )
164164 ->files ()
165165 ->notName ('_index.md ' )
166166 ->name ('*.md ' )
@@ -183,7 +183,7 @@ protected function getNavigation(string $version): array
183183 }
184184
185185 $ children ->push ([
186- 'path ' => $ path ,
186+ 'path ' => $ path ,
187187 'title ' => $ title ,
188188 'order ' => $ parsedSection ->matter ('order ' , 0 ),
189189 ]);
@@ -245,7 +245,7 @@ protected function redirectToFirstNavigationPage(array $navigation, $page = null
245245 {
246246 $ firstNavigationPath = collect ($ navigation )
247247 ->filter (function ($ nav ) use ($ page ) {
248- if (!is_null ($ page )) {
248+ if (! is_null ($ page )) {
249249 return Arr::get ($ nav , 'relative_path ' ) === $ page ;
250250 }
251251
@@ -267,7 +267,7 @@ protected function redirectToFirstNavigationPage(array $navigation, $page = null
267267 ->flatten (1 )
268268 ->first ();
269269
270- if (is_null ($ firstNavigationPath ) && !is_null ($ page )) {
270+ if (is_null ($ firstNavigationPath ) && ! is_null ($ page )) {
271271 return $ this ->redirectToFirstNavigationPage ($ navigation );
272272 }
273273
0 commit comments