update namespaces

This commit is contained in:
Khoubza Younes
2020-12-06 17:29:32 +01:00
parent e60e45f11a
commit 6b872d2cd0
7 changed files with 41 additions and 43 deletions
@@ -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',
);
+15 -15
View File
@@ -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));
}
+6 -6
View File
@@ -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));
}
}
+4 -4
View File
@@ -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');
}
}
@@ -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();
}
+3 -3
View File
@@ -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();
}
/**
+9 -10
View File
@@ -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"
]
}
},