From da9f7535e4466366bfd8888532e9f2f177693a42 Mon Sep 17 00:00:00 2001 From: Khoubza Younes Date: Sun, 6 Dec 2020 17:29:32 +0100 Subject: [PATCH] update namespaces --- ...der.php => FlasherNotyfServiceProvider.php | 3 +- ServiceProvider/Providers/Laravel.php | 34 +++++++++---------- ServiceProvider/Providers/Laravel4.php | 12 +++---- ServiceProvider/Providers/Lumen.php | 8 ++--- .../Providers/ServiceProviderInterface.php | 6 ++-- ServiceProvider/ServiceProviderManager.php | 6 ++-- Tests/NotifyNotyfServiceProviderTest.php | 2 +- Tests/TestCase.php | 2 +- composer.json | 21 ++++++------ 9 files changed, 46 insertions(+), 48 deletions(-) rename NotifyNotyfServiceProvider.php => FlasherNotyfServiceProvider.php (93%) diff --git a/NotifyNotyfServiceProvider.php b/FlasherNotyfServiceProvider.php similarity index 93% rename from NotifyNotyfServiceProvider.php rename to FlasherNotyfServiceProvider.php index cc7e7b48..1de9c0b0 100644 --- a/NotifyNotyfServiceProvider.php +++ b/FlasherNotyfServiceProvider.php @@ -6,7 +6,7 @@ use Illuminate\Contracts\Support\DeferrableProvider; use Illuminate\Support\ServiceProvider; use Flasher\Notyf\Laravel\ServiceProvider\ServiceProviderManager; -class NotifyNotyfServiceProvider extends ServiceProvider +class FlasherNotyfServiceProvider extends ServiceProvider { public function boot() { @@ -31,7 +31,6 @@ class NotifyNotyfServiceProvider extends ServiceProvider public function provides() { return array( - 'flasher.factory', 'flasher.factory.notyf', 'flasher.renderer.notyf', ); diff --git a/ServiceProvider/Providers/Laravel.php b/ServiceProvider/Providers/Laravel.php index a44f0c5d..9bcc658f 100644 --- a/ServiceProvider/Providers/Laravel.php +++ b/ServiceProvider/Providers/Laravel.php @@ -2,9 +2,9 @@ namespace Flasher\Notyf\Laravel\ServiceProvider\Providers; -use Flasher\Notyf\LaravelFlasher\PrimeNotyfServiceProvider; -use Flasher\Notyf\Prime\Factory\NotyfProducer; -use Flasher\Notyf\Prime\Renderer\NotyfRenderer; +use Flasher\Notyf\Laravel\FlasherNotyfServiceProvider; +use Flasher\Notyf\Prime\NotyfFactory; +use Flasher\Notyf\Prime\NotyfRenderer; use Flasher\Prime\Flasher; use Flasher\Prime\Renderer\RendererManager; use Illuminate\Container\Container; @@ -24,36 +24,36 @@ class Laravel implements ServiceProviderInterface return $this->app instanceof Application; } - public function publishConfig(NotifyNotyfServiceProvider $provider) + public function publishConfig(FlasherNotyfServiceProvider $provider) { $source = realpath($raw = __DIR__.'/../../../resources/config/config.php') ?: $raw; - $provider->publishes(array($source => config_path('notify_notyf.php')), 'config'); + $provider->publishes(array($source => config_path('flasher_notyf.php')), 'config'); - $provider->mergeConfigFrom($source, 'notify_notyf'); + $provider->mergeConfigFrom($source, 'flasher_notyf'); } - public function registerNotifyNotyfServices() + public function registerServices() { $this->app->singleton('flasher.factory.notyf', function (Container $app) { - return new NotyfProducer($app['flasher.storage'], $app['flasher.middleware']); + return new NotyfFactory($app['flasher.event_dispatcher']); }); $this->app->singleton('flasher.renderer.notyf', function (Container $app) { return new NotyfRenderer($app['flasher.config']); }); - $this->app->alias('flasher.factory.notyf', 'Flasher\Notyf\Prime\Factory\NotyfProducer'); - $this->app->alias('flasher.renderer.notyf', 'Flasher\Notyf\Prime\Renderer\NotyfRenderer'); + $this->app->alias('flasher.factory.notyf', 'Flasher\Notyf\Prime\NotyfFactory'); + $this->app->alias('flasher.renderer.notyf', 'Flasher\Notyf\Prime\NotyfRenderer'); - $this->app->extend('flasher.factory', function (Flasher $manager, Container $app) { - $manager->addDriver('notyf', $app['flasher.factory.notyf']); + $this->app->extend('flasher', function (Flasher $manager, Container $app) { + $manager->addDriver($app['flasher.factory.notyf']); return $manager; }); - $this->app->extend('flasher.renderer', function (RendererManager $manager, Container $app) { - $manager->addDriver('notyf', $app['flasher.renderer.notyf']); + $this->app->extend('flasher.renderer_manager', function (RendererManager $manager, Container $app) { + $manager->addDriver($app['flasher.renderer.notyf']); return $manager; }); @@ -61,10 +61,10 @@ class Laravel implements ServiceProviderInterface public function mergeConfigFromNotyf() { - $notifyConfig = $this->app['config']->get('flasher.adapters.notyf', array()); + $flasherConfig = $this->app['config']->get('flasher.adapters.notyf', array()); - $notyfConfig = $this->app['config']->get('notify_notyf', array()); + $notyfConfig = $this->app['config']->get('flasher_notyf', array()); - $this->app['config']->set('flasher.adapters.notyf', array_merge($notyfConfig, $notifyConfig)); + $this->app['config']->set('flasher.adapters.notyf', array_merge($notyfConfig, $flasherConfig)); } } diff --git a/ServiceProvider/Providers/Laravel4.php b/ServiceProvider/Providers/Laravel4.php index cb520bf3..5288ac02 100644 --- a/ServiceProvider/Providers/Laravel4.php +++ b/ServiceProvider/Providers/Laravel4.php @@ -2,8 +2,8 @@ namespace Flasher\Notyf\Laravel\ServiceProvider\Providers; +use Flasher\Notyf\Laravel\FlasherNotyfServiceProvider; use Illuminate\Foundation\Application; -use Flasher\Notyf\LaravelFlasher\PrimeNotyfServiceProvider; final class Laravel4 extends Laravel { @@ -12,17 +12,17 @@ final class Laravel4 extends Laravel return $this->app instanceof Application && 0 === strpos(Application::VERSION, '4.'); } - public function publishConfig(NotifyNotyfServiceProvider $provider) + public function publishConfig(FlasherNotyfServiceProvider $provider) { - $provider->package('php-flasher/flasher-laravel-notyf', 'notify_notyf', __DIR__.'/../../../resources'); + $provider->package('php-flasher/flasher-laravel-notyf', 'flasher_notyf', __DIR__.'/../../../resources'); } public function mergeConfigFromNotyf() { - $notifyConfig = $this->app['config']->get('notify::config.adapters.notyf', array()); + $flasherConfig = $this->app['config']->get('flasher::config.adapters.notyf', array()); - $notyfConfig = $this->app['config']->get('notify_notyf::config', array()); + $notyfConfig = $this->app['config']->get('flasher_notyf::config', array()); - $this->app['config']->set('notify::config.adapters.notyf', array_merge($notyfConfig, $notifyConfig)); + $this->app['config']->set('flasher::config.adapters.notyf', array_merge($notyfConfig, $flasherConfig)); } } diff --git a/ServiceProvider/Providers/Lumen.php b/ServiceProvider/Providers/Lumen.php index ad4cbf1c..877edd27 100644 --- a/ServiceProvider/Providers/Lumen.php +++ b/ServiceProvider/Providers/Lumen.php @@ -2,8 +2,8 @@ namespace Flasher\Notyf\Laravel\ServiceProvider\Providers; +use Flasher\Notyf\Laravel\FlasherNotyfServiceProvider; use Laravel\Lumen\Application; -use Flasher\Notyf\LaravelFlasher\PrimeNotyfServiceProvider; final class Lumen extends Laravel { @@ -12,12 +12,12 @@ final class Lumen extends Laravel return $this->app instanceof Application; } - public function publishConfig(NotifyNotyfServiceProvider $provider) + public function publishConfig(FlasherNotyfServiceProvider $provider) { $source = realpath($raw = __DIR__.'/../../../resources/config/config.php') ?: $raw; - $this->app->configure('notify_notyf'); + $this->app->configure('flasher_notyf'); - $provider->mergeConfigFrom($source, 'notify_notyf'); + $provider->mergeConfigFrom($source, 'flasher_notyf'); } } diff --git a/ServiceProvider/Providers/ServiceProviderInterface.php b/ServiceProvider/Providers/ServiceProviderInterface.php index 68a5f0fd..e1856407 100644 --- a/ServiceProvider/Providers/ServiceProviderInterface.php +++ b/ServiceProvider/Providers/ServiceProviderInterface.php @@ -2,15 +2,15 @@ namespace Flasher\Notyf\Laravel\ServiceProvider\Providers; -use Flasher\Notyf\LaravelFlasher\PrimeNotyfServiceProvider; +use Flasher\Notyf\Laravel\FlasherNotyfServiceProvider; interface ServiceProviderInterface { public function shouldBeUsed(); - public function publishConfig(NotifyNotyfServiceProvider $provider); + public function publishConfig(FlasherNotyfServiceProvider $provider); - public function registerNotifyNotyfServices(); + public function registerServices(); public function mergeConfigFromNotyf(); } diff --git a/ServiceProvider/ServiceProviderManager.php b/ServiceProvider/ServiceProviderManager.php index 2e6cae61..2c326093 100644 --- a/ServiceProvider/ServiceProviderManager.php +++ b/ServiceProvider/ServiceProviderManager.php @@ -2,7 +2,7 @@ namespace Flasher\Notyf\Laravel\ServiceProvider; -use Flasher\Notyf\LaravelFlasher\PrimeNotyfServiceProvider; +use Flasher\Notyf\Laravel\FlasherNotyfServiceProvider; use Flasher\Notyf\Laravel\ServiceProvider\Providers\ServiceProviderInterface; final class ServiceProviderManager @@ -20,7 +20,7 @@ final class ServiceProviderManager private $notifyServiceProvider; - public function __construct(NotifyNotyfServiceProvider $notifyServiceProvider) + public function __construct(FlasherNotyfServiceProvider $notifyServiceProvider) { $this->notifyServiceProvider = $notifyServiceProvider; } @@ -36,7 +36,7 @@ final class ServiceProviderManager public function register() { $provider = $this->resolveServiceProvider(); - $provider->registerNotifyNotyfServices(); + $provider->registerServices(); } /** diff --git a/Tests/NotifyNotyfServiceProviderTest.php b/Tests/NotifyNotyfServiceProviderTest.php index cf7ed557..b6aadaf1 100644 --- a/Tests/NotifyNotyfServiceProviderTest.php +++ b/Tests/NotifyNotyfServiceProviderTest.php @@ -2,7 +2,7 @@ namespace Flasher\Notyf\Laravel\Tests; -class NotifyNotyfServiceProviderTest extends TestCase +final class NotifyNotyfServiceProviderTest extends TestCase { public function testContainerContainNotifyServices() { diff --git a/Tests/TestCase.php b/Tests/TestCase.php index fbc2744c..785c70de 100644 --- a/Tests/TestCase.php +++ b/Tests/TestCase.php @@ -9,7 +9,7 @@ use Illuminate\Http\Request; use Illuminate\Support\Facades\Facade; use Orchestra\Testbench\TestCase as Orchestra; -class TestCase extends Orchestra +final class TestCase extends Orchestra { /** * @param \Illuminate\Foundation\Application $app diff --git a/composer.json b/composer.json index 3925ee6d..a05c9146 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { - "name": "php-flasher/flasher-laravel-notyf", - "description": "Laravel Flasher adapter package for php-flasher/flasher-notyf", + "name": "php-flasher/flasher-notyf-laravel", + "description": "Laravel adapter for php-flasher/flasher-notyf library", "keywords": [ "yoeunes", "notify", @@ -29,27 +29,26 @@ "license": "MIT", "require": { "php": ">=5.3", - "php-flasher/flasher-laravel": "^1.0.4", - "php-flasher/flasher-notyf": "^1.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8 || ^5.7 || ^6.0 || ^7.0 || ^8.3 || ^9.0", - "orchestra/testbench": "^2.0 || ^3.0 || ^4.0 || ^5.0 || ^6.0" + "php-flasher/flasher-laravel": "dev-main", + "php-flasher/flasher-notyf": "dev-main" }, "autoload": { "psr-4": { - "Flasher\\Laravel\\Notyf\\": "src/" + "Flasher\\Notyf\\Laravel\\": "", + "exclude-from-classmap": [ + "/Tests/" + ] } }, "autoload-dev": { "psr-4": { - "Flasher\\Laravel\\Notyf\\Tests\\": "tests/" + "Flasher\\Notyf\\Laravel\\Tests\\": "Tests/" } }, "extra": { "laravel": { "providers": [ - "Flasher\\Laravel\\Notyf\Flasher\PrimeNotyfServiceProvider" + "Flasher\\Notyf\\Laravel\\FlasherNotyfServiceProvider" ] } },