From 1a33c74c6d087a9b70ae28075d616634dfcdebbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Kv=C3=A1=C4=8Dek?= Date: Mon, 4 Apr 2016 21:48:05 +0200 Subject: [PATCH] REFACTORING: return / instaed of DIRECTORY_SEPARATOR in service providers --- .../Providers/ContactFormServiceProvider.php | 15 ++++++--------- .../Gallery/Providers/GalleryServiceProvider.php | 14 +++++++------- .../Providers/StaticPagesServiceProvider.php | 12 ++++++------ 3 files changed, 19 insertions(+), 22 deletions(-) diff --git a/modules/ContactForm/Providers/ContactFormServiceProvider.php b/modules/ContactForm/Providers/ContactFormServiceProvider.php index 43f94d37..1cc4d31c 100644 --- a/modules/ContactForm/Providers/ContactFormServiceProvider.php +++ b/modules/ContactForm/Providers/ContactFormServiceProvider.php @@ -1,7 +1,6 @@ publishes([ - __DIR__ . DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'Config'.DIRECTORY_SEPARATOR.'config.php' => config_path('contactform.php'), - ]); - $this->mergeConfigFrom(__DIR__ . DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'Config'.DIRECTORY_SEPARATOR.'config.php', 'contactform'); + $this->publishes([__DIR__ . '/../Config/config.php' => config_path('contactform.php')]); + $this->mergeConfigFrom(__DIR__ . '/../Config/config.php', 'contactform'); } /** @@ -57,13 +54,13 @@ class ContactFormServiceProvider extends ServiceProvider */ public function registerViews() { - $viewPath = base_path('resources'.DIRECTORY_SEPARATOR.'views'.DIRECTORY_SEPARATOR.'modules'.DIRECTORY_SEPARATOR.'contactform'); - $sourcePath = __DIR__ . DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR.'views'; + $viewPath = base_path('resources/views/modules/contactform'); + $sourcePath = __DIR__ . '/../Resources/views'; $this->publishes([$sourcePath => $viewPath], 'module-views'); $this->loadViewsFrom(array_merge(array_map(function ($path) { - return $path . DIRECTORY_SEPARATOR.'modules'.DIRECTORY_SEPARATOR.'contactform'; + return $path . '/modules/contactform'; }, \Config::get('view.paths')), [$sourcePath]), 'contactform'); /** @@ -90,7 +87,7 @@ class ContactFormServiceProvider extends ServiceProvider */ public function registerTranslations() { - $this->loadTranslationsFrom(__DIR__ . DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR.'lang', 'contactform'); + $this->loadTranslationsFrom(__DIR__ . '/../Resources/lang', 'contactform'); } /** diff --git a/modules/Gallery/Providers/GalleryServiceProvider.php b/modules/Gallery/Providers/GalleryServiceProvider.php index 78efe71d..82061245 100644 --- a/modules/Gallery/Providers/GalleryServiceProvider.php +++ b/modules/Gallery/Providers/GalleryServiceProvider.php @@ -42,9 +42,9 @@ class GalleryServiceProvider extends ServiceProvider protected function registerConfig() { $this->publishes([ - __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'Config' . DIRECTORY_SEPARATOR . 'config.php' => config_path('gallery.php'), + __DIR__.'/../Config/config.php' => config_path('gallery.php'), ]); - $this->mergeConfigFrom(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'Config' . DIRECTORY_SEPARATOR . 'config.php', 'gallery'); + $this->mergeConfigFrom(__DIR__.'/../Config/config.php', 'gallery'); } /** @@ -54,13 +54,13 @@ class GalleryServiceProvider extends ServiceProvider */ public function registerViews() { - $viewPath = base_path('resources' . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . 'gallery'); - $sourcePath = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'Resources' . DIRECTORY_SEPARATOR . 'views'; + $viewPath = base_path('resources/views/modules/gallery'); + $sourcePath = __DIR__.'/../Resources/views'; $this->publishes([$sourcePath => $viewPath], 'module-views'); $this->loadViewsFrom(array_merge(array_map(function ($path) { - return $path . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . 'gallery'; + return $path.'/modules/gallery'; }, \Config::get('view.paths')), [$sourcePath]), 'gallery'); /** @@ -87,12 +87,12 @@ class GalleryServiceProvider extends ServiceProvider */ public function registerTranslations() { - $langPath = base_path('resources' . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . 'gallery'); + $langPath = base_path('resources/lang/modules/gallery'); if (is_dir($langPath)) { $this->loadTranslationsFrom($langPath, 'gallery'); } else { - $this->loadTranslationsFrom(__DIR__ . DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR.'lang', 'gallery'); + $this->loadTranslationsFrom(__DIR__ . '/../Resources/lang', 'gallery'); } } diff --git a/modules/StaticPages/Providers/StaticPagesServiceProvider.php b/modules/StaticPages/Providers/StaticPagesServiceProvider.php index bb6044fd..779b2a97 100644 --- a/modules/StaticPages/Providers/StaticPagesServiceProvider.php +++ b/modules/StaticPages/Providers/StaticPagesServiceProvider.php @@ -57,7 +57,7 @@ class StaticPagesServiceProvider extends ServiceProvider */ protected function registerConfig() { - $config = __DIR__ . DIRECTORY_SEPARATOR .'..'.DIRECTORY_SEPARATOR.'Config'.DIRECTORY_SEPARATOR.'config.php'; + $config = __DIR__ . DIRECTORY_SEPARATOR .'../Config/config.php'; $this->publishes([$config => config_path('staticpages.php')]); $this->mergeConfigFrom($config, 'staticpages'); } @@ -69,13 +69,13 @@ class StaticPagesServiceProvider extends ServiceProvider */ public function registerViews() { - $viewPath = base_path('resources'.DIRECTORY_SEPARATOR.'views'.DIRECTORY_SEPARATOR.'modules'.DIRECTORY_SEPARATOR.'staticpages'); - $sourcePath = __DIR__ . DIRECTORY_SEPARATOR .'..'.DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR.'views'; + $viewPath = base_path('resources/views/modules/staticpages'); + $sourcePath = __DIR__ . '/../Resources/views'; $this->publishes([$sourcePath => $viewPath], 'module-views'); $this->loadViewsFrom(array_merge(array_map(function ($path) { - return $path . DIRECTORY_SEPARATOR. 'modules'.DIRECTORY_SEPARATOR.'staticpages'; + return $path . '/modules/staticpages'; }, \Config::get('view.paths')), [$sourcePath]), 'staticpages'); /** @@ -84,7 +84,7 @@ class StaticPagesServiceProvider extends ServiceProvider $registrator = $this->app->make('registerTemplateDir'); try { // setup some global variables - $registrator->setBaseDirectory('resources'.DIRECTORY_SEPARATOR.'views'.DIRECTORY_SEPARATOR.'modules'.DIRECTORY_SEPARATOR.'staticpages'.DIRECTORY_SEPARATOR.'visitor'); + $registrator->setBaseDirectory('resources/views/modules/staticpages/visitor'); $registrator->setNamespace('staticpages'); $registrator->setModuleId(call_user_func([config('staticpages.handler'), 'getModuleId'])); @@ -102,6 +102,6 @@ class StaticPagesServiceProvider extends ServiceProvider */ public function registerTranslations() { - $this->loadTranslationsFrom(__DIR__ . DIRECTORY_SEPARATOR. '..'.DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR.'lang', 'staticpages'); + $this->loadTranslationsFrom(__DIR__ . '/../Resources/lang', 'staticpages'); } }