From 69688a9b76a5f8077db76041e98e64c02e8f303f Mon Sep 17 00:00:00 2001 From: Jordan Doyle Date: Sat, 24 Nov 2018 11:18:31 +0000 Subject: [PATCH] Apply fixes from StyleCI (#25) [ci skip] [skip ci] --- public/wp-config.php | 1 - src/Providers/KoseligServiceProvider.php | 2 +- src/Routing/Routing.php | 31 ++++++++++++++++++++----------- src/Routing/TemplateRoute.php | 2 +- 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/public/wp-config.php b/public/wp-config.php index 7c4d66d..dd2d660 100644 --- a/public/wp-config.php +++ b/public/wp-config.php @@ -67,4 +67,3 @@ $app->bootstrapWith([ Illuminate\Foundation\Bootstrap\RegisterProviders::class, Illuminate\Foundation\Bootstrap\BootProviders::class, ]); - diff --git a/src/Providers/KoseligServiceProvider.php b/src/Providers/KoseligServiceProvider.php index 06fe9f5..0e7dfd6 100644 --- a/src/Providers/KoseligServiceProvider.php +++ b/src/Providers/KoseligServiceProvider.php @@ -52,7 +52,7 @@ class KoseligServiceProvider extends ServiceProvider public function boot() { $this->publishes([ - __DIR__ . '/../../public/wp-config.php' => public_path() + __DIR__ . '/../../public/wp-config.php' => public_path(), ], 'public'); } } diff --git a/src/Routing/Routing.php b/src/Routing/Routing.php index 4a96ca4..f3b8d2a 100644 --- a/src/Routing/Routing.php +++ b/src/Routing/Routing.php @@ -170,9 +170,20 @@ class Routing } /** + * Determine if the router currently has a group stack. + * + * @return bool + */ + public function hasGroupStack() + { + return !empty($this->groupStack); + } + + /** * Determine if the action is routing to a controller. * * @param array $action + * * @return bool */ protected function actionReferencesController($action) @@ -180,6 +191,7 @@ class Routing if (!$action instanceof \Closure) { return is_string($action) || (isset($action['uses']) && is_string($action['uses'])); } + return false; } @@ -187,19 +199,22 @@ class Routing * Prepend the last group namespace onto the use clause. * * @param string $class + * * @return string */ protected function prependGroupNamespace($class) { $group = end($this->groupStack); + return isset($group['namespace']) && strpos($class, '\\') !== 0 - ? $group['namespace'].'\\'.$class : $class; + ? $group['namespace'] . '\\' . $class : $class; } /** * Add a controller based route action to the action array. * * @param array|string $action + * * @return array */ protected function convertToControllerAction($action) @@ -217,6 +232,7 @@ class Routing // have a copy of it for reference if we need it. This can be used while we // search for a controller name or do some other type of fetch operation. $action['controller'] = $action['uses']; + return $action; } @@ -248,6 +264,7 @@ class Routing * Add the necessary where clauses to the route based on its initial registration. * * @param \Illuminate\Routing\Route $route + * * @return \Illuminate\Routing\Route */ protected function addWhereClausesToRoute($route) @@ -255,23 +272,15 @@ class Routing $route->where(array_merge( Route::getPatterns(), $route->getAction()['where'] ?? [] )); - return $route; - } - /** - * Determine if the router currently has a group stack. - * - * @return bool - */ - public function hasGroupStack() - { - return !empty($this->groupStack); + return $route; } /** * Merge the group stack with the controller action. * * @param \Illuminate\Routing\Route $route + * * @return void */ protected function mergeGroupAttributesIntoRoute($route) diff --git a/src/Routing/TemplateRoute.php b/src/Routing/TemplateRoute.php index 6583d2c..6a20394 100644 --- a/src/Routing/TemplateRoute.php +++ b/src/Routing/TemplateRoute.php @@ -1,8 +1,8 @@