update namespaces

This commit is contained in:
Khoubza Younes
2020-12-06 17:29:32 +01:00
parent 9eec400167
commit 4cb2fe47c9
9 changed files with 46 additions and 48 deletions
@@ -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',
);
+17 -17
View File
@@ -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));
}
}
+6 -6
View File
@@ -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));
}
}
+4 -4
View File
@@ -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');
}
}
@@ -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();
}
+3 -3
View File
@@ -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();
}
/**
+1 -1
View File
@@ -2,7 +2,7 @@
namespace Flasher\Notyf\Laravel\Tests;
class NotifyNotyfServiceProviderTest extends TestCase
final class NotifyNotyfServiceProviderTest extends TestCase
{
public function testContainerContainNotifyServices()
{
+1 -1
View File
@@ -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
+10 -11
View File
@@ -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"
]
}
},