diff --git a/NotifySweetAlertServiceProvider.php b/FlasherSweetAlertServiceProvider.php similarity index 92% rename from NotifySweetAlertServiceProvider.php rename to FlasherSweetAlertServiceProvider.php index b25b1ef4..e08952e8 100644 --- a/NotifySweetAlertServiceProvider.php +++ b/FlasherSweetAlertServiceProvider.php @@ -6,7 +6,7 @@ use Illuminate\Contracts\Support\DeferrableProvider; use Illuminate\Support\ServiceProvider; use Flasher\SweetAlert\Laravel\ServiceProvider\ServiceProviderManager; -class NotifySweetAlertServiceProvider extends ServiceProvider +final class FlasherSweetAlertServiceProvider extends ServiceProvider { public function boot() { @@ -31,7 +31,6 @@ class NotifySweetAlertServiceProvider extends ServiceProvider public function provides() { return array( - 'flasher.factory', 'flasher.factory.sweet_alert', 'flasher.renderer.sweet_alert', ); diff --git a/ServiceProvider/Providers/Laravel.php b/ServiceProvider/Providers/Laravel.php index ae5cf980..57ed86f8 100644 --- a/ServiceProvider/Providers/Laravel.php +++ b/ServiceProvider/Providers/Laravel.php @@ -4,9 +4,9 @@ namespace Flasher\SweetAlert\Laravel\ServiceProvider\Providers; use Flasher\Prime\Flasher; use Flasher\Prime\Renderer\RendererManager; -use Flasher\SweetAlert\LaravelFlasher\PrimeSweetAlertServiceProvider; -use Flasher\SweetAlert\Prime\Factory\SweetAlertProducer; -use Flasher\SweetAlert\Prime\Renderer\SweetAlertRenderer; +use Flasher\SweetAlert\Laravel\FlasherSweetAlertServiceProvider; +use Flasher\SweetAlert\Prime\SweetAlertFactory; +use Flasher\SweetAlert\Prime\SweetAlertRenderer; use Illuminate\Container\Container; use Illuminate\Foundation\Application; @@ -24,36 +24,36 @@ class Laravel implements ServiceProviderInterface return $this->app instanceof Application; } - public function publishConfig(NotifySweetAlertServiceProvider $provider) + public function publishConfig(FlasherSweetAlertServiceProvider $provider) { $source = realpath($raw = __DIR__.'/../../../resources/config/config.php') ?: $raw; - $provider->publishes(array($source => config_path('notify_sweet_alert.php')), 'config'); + $provider->publishes(array($source => config_path('flasher_sweet_alert.php')), 'config'); - $provider->mergeConfigFrom($source, 'notify_sweet_alert'); + $provider->mergeConfigFrom($source, 'flasher_sweet_alert'); } - public function registerNotifySweetAlertServices() + public function registerServices() { $this->app->singleton('flasher.factory.sweet_alert', function (Container $app) { - return new SweetAlertProducer($app['flasher.storage'], $app['flasher.middleware']); + return new SweetAlertFactory($app['flasher.event_dispatcher']); }); $this->app->singleton('flasher.renderer.sweet_alert', function (Container $app) { return new SweetAlertRenderer($app['flasher.config']); }); - $this->app->alias('flasher.factory.sweet_alert', 'Flasher\SweetAlert\Prime\Factory\SweetAlertProducer'); - $this->app->alias('flasher.renderer.sweet_alert', 'Flasher\SweetAlert\Prime\Renderer\SweetAlertRenderer'); + $this->app->alias('flasher.factory.sweet_alert', 'Flasher\SweetAlert\Prime\SweetAlertFactory'); + $this->app->alias('flasher.renderer.sweet_alert', 'Flasher\SweetAlert\Prime\SweetAlertRenderer'); - $this->app->extend('flasher.factory', function (Flasher $manager, Container $app) { - $manager->addDriver('sweet_alert', $app['flasher.factory.sweet_alert']); + $this->app->extend('flasher', function (Flasher $manager, Container $app) { + $manager->addDriver($app['flasher.factory.sweet_alert']); return $manager; }); - $this->app->extend('flasher.renderer', function (RendererManager $manager, Container $app) { - $manager->addDriver('sweet_alert', $app['flasher.renderer.sweet_alert']); + $this->app->extend('flasher.renderer_manager', function (RendererManager $manager, Container $app) { + $manager->addDriver($app['flasher.renderer.sweet_alert']); return $manager; }); @@ -63,7 +63,7 @@ class Laravel implements ServiceProviderInterface { $notifyConfig = $this->app['config']->get('flasher.adapters.sweet_alert', array()); - $sweetAlertConfig = $this->app['config']->get('notify_sweet_alert', array()); + $sweetAlertConfig = $this->app['config']->get('flasher_sweet_alert', array()); $this->app['config']->set('flasher.adapters.sweet_alert', array_merge($sweetAlertConfig, $notifyConfig)); } diff --git a/ServiceProvider/Providers/Laravel4.php b/ServiceProvider/Providers/Laravel4.php index 6f5a0dbe..455b0364 100644 --- a/ServiceProvider/Providers/Laravel4.php +++ b/ServiceProvider/Providers/Laravel4.php @@ -2,8 +2,8 @@ namespace Flasher\SweetAlert\Laravel\ServiceProvider\Providers; +use Flasher\SweetAlert\Laravel\FlasherSweetAlertServiceProvider; use Illuminate\Foundation\Application; -use Flasher\SweetAlert\LaravelFlasher\PrimeSweetAlertServiceProvider; 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(NotifySweetAlertServiceProvider $provider) + public function publishConfig(FlasherSweetAlertServiceProvider $provider) { - $provider->package('php-flasher/flasher-laravel-sweet_alert', 'notify_sweet_alert', __DIR__.'/../../../resources'); + $provider->package('php-flasher/flasher-laravel-sweet_alert', 'flasher_sweet_alert', __DIR__.'/../../../resources'); } public function mergeConfigFromSweetAlert() { - $notifyConfig = $this->app['config']->get('notify::config.adapters.sweet_alert', array()); + $flasherConfig = $this->app['config']->get('flasher::config.adapters.sweet_alert', array()); - $sweet_alertConfig = $this->app['config']->get('notify_sweet_alert::config', array()); + $sweetAlertConfig = $this->app['config']->get('flasher_sweet_alert::config', array()); - $this->app['config']->set('notify::config.adapters.sweet_alert', array_merge($sweet_alertConfig, $notifyConfig)); + $this->app['config']->set('flasher::config.adapters.sweet_alert', array_merge($sweetAlertConfig, $flasherConfig)); } } diff --git a/ServiceProvider/Providers/Lumen.php b/ServiceProvider/Providers/Lumen.php index e58587c5..ed9edda2 100644 --- a/ServiceProvider/Providers/Lumen.php +++ b/ServiceProvider/Providers/Lumen.php @@ -2,8 +2,8 @@ namespace Flasher\SweetAlert\Laravel\ServiceProvider\Providers; +use Flasher\SweetAlert\Laravel\FlasherSweetAlertServiceProvider; use Laravel\Lumen\Application; -use Flasher\SweetAlert\LaravelFlasher\PrimeSweetAlertServiceProvider; final class Lumen extends Laravel { @@ -12,12 +12,12 @@ final class Lumen extends Laravel return $this->app instanceof Application; } - public function publishConfig(NotifySweetAlertServiceProvider $provider) + public function publishConfig(FlasherSweetAlertServiceProvider $provider) { $source = realpath($raw = __DIR__.'/../../../resources/config/config.php') ?: $raw; - $this->app->configure('notify_sweet_alert'); + $this->app->configure('flasher_sweet_alert'); - $provider->mergeConfigFrom($source, 'notify_sweet_alert'); + $provider->mergeConfigFrom($source, 'flasher_sweet_alert'); } } diff --git a/ServiceProvider/Providers/ServiceProviderInterface.php b/ServiceProvider/Providers/ServiceProviderInterface.php index 2cd261e6..f7d4ea9c 100644 --- a/ServiceProvider/Providers/ServiceProviderInterface.php +++ b/ServiceProvider/Providers/ServiceProviderInterface.php @@ -2,15 +2,15 @@ namespace Flasher\SweetAlert\Laravel\ServiceProvider\Providers; -use Flasher\SweetAlert\LaravelFlasher\PrimeSweetAlertServiceProvider; +use Flasher\SweetAlert\Laravel\FlasherSweetAlertServiceProvider; interface ServiceProviderInterface { public function shouldBeUsed(); - public function publishConfig(NotifySweetAlertServiceProvider $provider); + public function publishConfig(FlasherSweetAlertServiceProvider $provider); - public function registerNotifySweetAlertServices(); + public function registerServices(); public function mergeConfigFromSweetAlert(); } diff --git a/ServiceProvider/ServiceProviderManager.php b/ServiceProvider/ServiceProviderManager.php index 91a5bf74..7d482e1a 100644 --- a/ServiceProvider/ServiceProviderManager.php +++ b/ServiceProvider/ServiceProviderManager.php @@ -2,7 +2,7 @@ namespace Flasher\SweetAlert\Laravel\ServiceProvider; -use Flasher\SweetAlert\LaravelFlasher\PrimeSweetAlertServiceProvider; +use Flasher\SweetAlert\Laravel\FlasherSweetAlertServiceProvider; use Flasher\SweetAlert\Laravel\ServiceProvider\Providers\ServiceProviderInterface; final class ServiceProviderManager @@ -20,7 +20,7 @@ final class ServiceProviderManager private $notifyServiceProvider; - public function __construct(NotifySweetAlertServiceProvider $notifyServiceProvider) + public function __construct(FlasherSweetAlertServiceProvider $notifyServiceProvider) { $this->notifyServiceProvider = $notifyServiceProvider; } @@ -36,7 +36,7 @@ final class ServiceProviderManager public function register() { $provider = $this->resolveServiceProvider(); - $provider->registerNotifySweetAlertServices(); + $provider->registerServices(); } /** diff --git a/composer.json b/composer.json index e3df1526..06b76dca 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "php-flasher/flasher-laravel-sweet-alert", + "name": "php-flasher/flasher-sweet-alert-laravel", "description": "Laravel Flasher adapter package for php-flasher/flasher-sweet-alert", "keywords": [ "yoeunes", @@ -29,27 +29,26 @@ "license": "MIT", "require": { "php": ">=5.3", - "php-flasher/flasher-laravel": "^1.0.4", - "php-flasher/flasher-sweet-alert": "^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-sweet-alert": "dev-main" }, "autoload": { "psr-4": { - "Flasher\\Laravel\\SweetAlert\\": "src/" + "Flasher\\Laravel\\SweetAlert\\": "", + "exclude-from-classmap": [ + "/Tests/" + ] } }, "autoload-dev": { "psr-4": { - "Flasher\\Laravel\\SweetAlert\\Tests\\": "tests/" + "Flasher\\Laravel\\SweetAlert\\Tests\\": "Tests/" } }, "extra": { "laravel": { "providers": [ - "Flasher\\Laravel\\SweetAlert\Flasher\PrimeSweetAlertServiceProvider" + "Flasher\\SweetAlert\\Laravel\\FlasherSweetAlertServiceProvider" ] } },