diff --git a/composer.json b/composer.json
index eedbe7b5..fac4e7c3 100644
--- a/composer.json
+++ b/composer.json
@@ -14,14 +14,11 @@
"require": {
"php": ">=5.3",
"ext-json": "*",
- "symfony/config": "^2.7|^3.0|^4.0|^5.0",
- "symfony/dependency-injection": "^2.7|^3.0|^4.0|^5.0",
- "symfony/http-kernel": "^2.7|^3.0|^4.0|^5.0",
- "symfony/yaml": "^2.7|^3.0|^4.0|^5.0",
- "twig/twig": "^1.34|^2.0|^3.0"
+ "illuminate/support": "4.0.*"
},
"require-dev": {
- "phpunit/phpunit": "^4.8|^5.0|^6.0|^7.0|^8.0|^9.0"
+ "phpunit/phpunit": "4.8.36",
+ "orchestra/testbench": "^2.0|^3.0|^4.0|^5.0|^6.0"
},
"autoload": {
"psr-4": {
diff --git a/src/Laravel/Resources/config/config.php b/src/Laravel/Resources/config/config.php
index 47c70476..0dbadb90 100644
--- a/src/Laravel/Resources/config/config.php
+++ b/src/Laravel/Resources/config/config.php
@@ -25,17 +25,32 @@ return array(
'adapters' => array(
'template' => array(
- 'default' => 'tailwindcss',
- 'views' => array(
- 'tailwindcss' => 'flasher::tailwindcss',
+ 'default' => 'tailwindcss',
+ 'templates' => array(
+ 'tailwindcss' => array(
+ 'view' => 'flasher::tailwindcss',
+ 'styles' => array(
+ 'https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css',
+ ),
+ ),
+ 'tailwindcss_bg' => array(
+ 'view' => 'flasher::tailwindcss_bg',
+ 'styles' => array(
+ 'https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css',
+ ),
+ ),
+ 'bootstrap' => array(
+ 'view' => 'flasher::bootstrap',
+ 'styles' => array(
+ 'https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.3/css/bootstrap.min.css',
+ ),
+ ),
),
- 'scripts' => array(
+ 'scripts' => array(
'/vendor/flasher/flasher-template.js',
),
- 'styles' => array(
- 'https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css',
- ),
- 'options' => array(
+ 'styles' => array(),
+ 'options' => array(
'timeout' => 5000,
'position' => 'top-right',
),
diff --git a/src/Laravel/Resources/views/bootstrap.blade.php b/src/Laravel/Resources/views/bootstrap.blade.php
new file mode 100644
index 00000000..68cdc05e
--- /dev/null
+++ b/src/Laravel/Resources/views/bootstrap.blade.php
@@ -0,0 +1,38 @@
+getType()) {
+ case 'success':
+ $title = 'Success';
+ $alertClass = 'alert-success';
+ $progressBackgroundColor = '#155724';
+ break;
+ case 'error':
+ $title = 'Error';
+ $alertClass = 'alert-danger';
+ $progressBackgroundColor = '#721c24';
+ break;
+ case 'warning':
+ $title = 'Warning';
+ $alertClass = 'alert-warning';
+ $progressBackgroundColor = '#856404';
+ break;
+ case 'info':
+ default:
+ $title = 'Info';
+ $alertClass = 'alert-info';
+ $progressBackgroundColor = '#0c5460';
+ break;
+ }
+?>
+
+
- {{ $envelope->getType() }}
+ {{ $title }}
{{ $envelope->getMessage() }}
diff --git a/src/Laravel/Resources/views/tailwindcss_bg.blade.php b/src/Laravel/Resources/views/tailwindcss_bg.blade.php
new file mode 100644
index 00000000..5d33e5d6
--- /dev/null
+++ b/src/Laravel/Resources/views/tailwindcss_bg.blade.php
@@ -0,0 +1,56 @@
+getType()) {
+ case 'success':
+ $title = 'Success';
+ $textColor = 'text-green-700';
+ $backgroundColor = 'bg-green-50';
+ $progressBackgroundColor = 'bg-green-200';
+ $borderColor = 'border-green-600';
+ $icon = '';
+ break;
+ case 'error':
+ $title = 'Error';
+ $textColor = 'text-red-700';
+ $backgroundColor = 'bg-red-50';
+ $progressBackgroundColor = 'bg-red-200';
+ $borderColor = 'border-red-600';
+ $icon = '';
+ break;
+ case 'warning':
+ $title = 'Warning';
+ $textColor = 'text-yellow-700';
+ $backgroundColor = 'bg-yellow-50';
+ $progressBackgroundColor = 'bg-yellow-200';
+ $borderColor = 'border-yellow-600';
+ $icon = '';
+ break;
+ case 'info':
+ default:
+ $title = 'Info';
+ $textColor = 'text-blue-700';
+ $backgroundColor = 'bg-blue-50';
+ $progressBackgroundColor = 'bg-blue-100';
+ $borderColor = 'border-blue-600';
+ $icon = '';
+ break;
+ }
+?>
+
+
+
+
+ {!! $icon !!}
+
+
+
+ {{ $title }}
+
+
+ {{ $envelope->getMessage() }}
+
+
+
+
+
+
+
diff --git a/src/Laravel/ServiceProvider/Providers/Laravel.php b/src/Laravel/ServiceProvider/Providers/Laravel.php
index 7cb104c3..9580b201 100644
--- a/src/Laravel/ServiceProvider/Providers/Laravel.php
+++ b/src/Laravel/ServiceProvider/Providers/Laravel.php
@@ -7,37 +7,47 @@ use Flasher\Laravel\FlasherServiceProvider;
use Flasher\Laravel\Storage\Storage;
use Flasher\Laravel\Template\BladeEngine;
use Flasher\Prime\EventDispatcher\EventDispatcher;
-use Flasher\Prime\EventDispatcher\EventListener\StampsListener;
use Flasher\Prime\EventDispatcher\EventListener\FilterListener;
use Flasher\Prime\EventDispatcher\EventListener\RemoveListener;
+use Flasher\Prime\EventDispatcher\EventListener\StampsListener;
use Flasher\Prime\EventDispatcher\EventListener\TemplateListener;
use Flasher\Prime\Factory\NotificationFactory;
use Flasher\Prime\Filter\Filter;
use Flasher\Prime\Flasher;
use Flasher\Prime\Renderer\Renderer;
use Flasher\Prime\Storage\StorageManager;
-use Flasher\Toastr\Prime\ToastrFactory;
use Illuminate\Container\Container;
use Illuminate\Foundation\Application;
use Illuminate\Support\Facades\Blade;
class Laravel implements ServiceProviderInterface
{
+ /**
+ * @var Container
+ */
protected $app;
+ /**
+ * @param Container $app
+ */
public function __construct(Container $app)
{
$this->app = $app;
}
+ /**
+ * @inheritDoc
+ */
public function shouldBeUsed()
{
return $this->app instanceof Application;
}
- public function publishes(FlasherServiceProvider $provider)
+ /**
+ * @inheritDoc
+ */
+ public function boot(FlasherServiceProvider $provider)
{
- $provider->mergeConfigFrom(flasher_path(__DIR__.'/../../Resources/config/config.php'), 'flasher');
$provider->loadTranslationsFrom(flasher_path(__DIR__.'/../../Resources/lang'), 'flasher');
$provider->loadViewsFrom(flasher_path(__DIR__.'/../../Resources/views'), 'flasher');
@@ -45,10 +55,17 @@ class Laravel implements ServiceProviderInterface
$provider->publishes(array(flasher_path(__DIR__.'/../../Resources/public') => public_path(flasher_path('vendor/flasher'))), 'flasher-public');
$provider->publishes(array(flasher_path(__DIR__.'/../../Resources/lang') => resource_path(flasher_path('lang/vendor/flasher'))), 'flasher-lang');
$provider->publishes(array(flasher_path(__DIR__.'/../../Resources/views') => resource_path(flasher_path('views/vendor/flasher'))), 'flasher-views');
+
+ $this->registerBladeDirectives();
}
- public function registerServices()
+ /**
+ * @inheritDoc
+ */
+ public function register(FlasherServiceProvider $provider)
{
+ $provider->mergeConfigFrom(flasher_path(__DIR__.'/../../Resources/config/config.php'), 'flasher');
+
$this->app->singleton('flasher.config', function (Application $app) {
return new Config($app['config'], '.');
});
@@ -56,7 +73,7 @@ class Laravel implements ServiceProviderInterface
$this->registerCommonServices();
}
- public function registerCommonServices()
+ protected function registerCommonServices()
{
$this->app->singleton('flasher', function (Application $app) {
$flasher = new Flasher($app['flasher.config']);
@@ -123,7 +140,7 @@ class Laravel implements ServiceProviderInterface
$this->app->bind('Flasher\Prime\Factory\NotificationFactoryInterface', 'flasher.notification_factory');
}
- public function registerBladeDirectives()
+ protected function registerBladeDirectives()
{
$startsWith = function($haystack, $needle) {
return substr_compare($haystack, $needle, 0, strlen($needle)) === 0;
diff --git a/src/Laravel/ServiceProvider/Providers/Laravel4.php b/src/Laravel/ServiceProvider/Providers/Laravel4.php
index 1cf6983e..4f6c5f18 100644
--- a/src/Laravel/ServiceProvider/Providers/Laravel4.php
+++ b/src/Laravel/ServiceProvider/Providers/Laravel4.php
@@ -10,17 +10,28 @@ use Illuminate\View\Compilers\BladeCompiler;
final class Laravel4 extends Laravel
{
+ /**
+ * @inheritDoc
+ */
public function shouldBeUsed()
{
return $this->app instanceof Application && 0 === strpos(Application::VERSION, '4.');
}
- public function publishes(FlasherServiceProvider $provider)
+ /**
+ * @inheritDoc
+ */
+ public function boot(FlasherServiceProvider $provider)
{
$provider->package('php-flasher/flasher-laravel', 'flasher', flasher_path(__DIR__.'/../../Resources'));
+
+ $this->registerBladeDirectives();
}
- public function registerServices()
+ /**
+ * @inheritDoc
+ */
+ public function register(FlasherServiceProvider $provider)
{
$this->app->singleton('flasher.config', function (Application $app) {
return new Config($app['config'], '::');
@@ -29,7 +40,7 @@ final class Laravel4 extends Laravel
$this->registerCommonServices();
}
- public function registerBladeDirectives()
+ protected function registerBladeDirectives()
{
$startsWith = function($haystack, $needle) {
return substr_compare($haystack, $needle, 0, strlen($needle)) === 0;
diff --git a/src/Laravel/ServiceProvider/Providers/Laravel50.php b/src/Laravel/ServiceProvider/Providers/Laravel50.php
index 538711c2..65a1ece4 100644
--- a/src/Laravel/ServiceProvider/Providers/Laravel50.php
+++ b/src/Laravel/ServiceProvider/Providers/Laravel50.php
@@ -9,18 +9,25 @@ use Illuminate\View\Compilers\BladeCompiler;
final class Laravel50 extends Laravel
{
+ /**
+ * @inheritDoc
+ */
public function shouldBeUsed()
{
return $this->app instanceof Application && 0 === strpos(Application::VERSION, '5.0');
}
- public function publishes(FlasherServiceProvider $provider)
+ /**
+ * @inheritDoc
+ */
+ public function boot(FlasherServiceProvider $provider)
{
- $provider->loadTranslationsFrom(flasher_path(__DIR__.'/../../Resources/lang'), 'flasher');
$provider->publishes(array(flasher_path(__DIR__.'/../../Resources/lang') => base_path(flasher_path('resources/lang/vendor/flasher'))));
+
+ $this->registerBladeDirectives();
}
- public function registerBladeDirectives()
+ protected function registerBladeDirectives()
{
$startsWith = function($haystack, $needle) {
return substr_compare($haystack, $needle, 0, strlen($needle)) === 0;
diff --git a/src/Laravel/ServiceProvider/Providers/Laravel51.php b/src/Laravel/ServiceProvider/Providers/Laravel51.php
index f4cc9c88..1ef161ec 100644
--- a/src/Laravel/ServiceProvider/Providers/Laravel51.php
+++ b/src/Laravel/ServiceProvider/Providers/Laravel51.php
@@ -7,14 +7,19 @@ use Illuminate\Foundation\Application;
final class Laravel51 extends Laravel
{
+ /**
+ * @inheritDoc
+ */
public function shouldBeUsed()
{
return $this->app instanceof Application && 0 === strpos(Application::VERSION, '5.1');
}
- public function publishes(FlasherServiceProvider $provider)
+ /**
+ * @inheritDoc
+ */
+ public function boot(FlasherServiceProvider $provider)
{
- $provider->loadTranslationsFrom(flasher_path(__DIR__.'/../../Resources/lang'), 'flasher');
$provider->publishes(array(flasher_path(__DIR__.'/../../Resources/lang') => base_path(flasher_path('resources/lang/vendor/flasher'))));
}
}
diff --git a/src/Laravel/ServiceProvider/Providers/Lumen.php b/src/Laravel/ServiceProvider/Providers/Lumen.php
deleted file mode 100644
index 6e15c8f1..00000000
--- a/src/Laravel/ServiceProvider/Providers/Lumen.php
+++ /dev/null
@@ -1,31 +0,0 @@
-app instanceof Application;
- }
-
- public function publishes(FlasherServiceProvider $provider)
- {
- $source = realpath($raw = flasher_path(__DIR__.'/../../../Resources/config/config.php')) ?: $raw;
-
- $this->app->configure('flasher');
-
- $provider->mergeConfigFrom($source, 'flasher');
- }
-
- public function registerServices()
- {
- $this->app->register('\Illuminate\Session\SessionServiceProvider');
- $this->app->configure('session');
-
- parent::registerServices();
- }
-}
diff --git a/src/Laravel/ServiceProvider/Providers/ServiceProviderInterface.php b/src/Laravel/ServiceProvider/Providers/ServiceProviderInterface.php
index f6213d72..780b4767 100644
--- a/src/Laravel/ServiceProvider/Providers/ServiceProviderInterface.php
+++ b/src/Laravel/ServiceProvider/Providers/ServiceProviderInterface.php
@@ -6,11 +6,18 @@ use Flasher\Laravel\FlasherServiceProvider;
interface ServiceProviderInterface
{
+ /**
+ * @return bool
+ */
public function shouldBeUsed();
- public function publishes(FlasherServiceProvider $provider);
+ /**
+ * @param FlasherServiceProvider $provider
+ */
+ public function boot(FlasherServiceProvider $provider);
- public function registerServices();
-
- public function registerBladeDirectives();
+ /**
+ * @param FlasherServiceProvider $provider
+ */
+ public function register(FlasherServiceProvider $provider);
}
diff --git a/src/Laravel/ServiceProvider/ServiceProviderManager.php b/src/Laravel/ServiceProvider/ServiceProviderManager.php
index 199f0614..3a64baa4 100644
--- a/src/Laravel/ServiceProvider/ServiceProviderManager.php
+++ b/src/Laravel/ServiceProvider/ServiceProviderManager.php
@@ -17,7 +17,6 @@ final class ServiceProviderManager
'Flasher\Laravel\ServiceProvider\Providers\Laravel50',
'Flasher\Laravel\ServiceProvider\Providers\Laravel51',
'Flasher\Laravel\ServiceProvider\Providers\Laravel',
- 'Flasher\Laravel\ServiceProvider\Providers\Lumen',
);
private $notifyServiceProvider;
@@ -30,15 +29,13 @@ final class ServiceProviderManager
public function boot()
{
$provider = $this->resolveServiceProvider();
-
- $provider->publishes($this->notifyServiceProvider);
- $provider->registerBladeDirectives();
+ $provider->boot($this->notifyServiceProvider);
}
public function register()
{
$provider = $this->resolveServiceProvider();
- $provider->registerServices();
+ $provider->register($this->notifyServiceProvider);
}
/**
diff --git a/src/Laravel/Tests/Config/ConfigTest.php b/src/Laravel/Tests/Config/ConfigTest.php
index a947f072..9a60c2bc 100644
--- a/src/Laravel/Tests/Config/ConfigTest.php
+++ b/src/Laravel/Tests/Config/ConfigTest.php
@@ -2,9 +2,9 @@
namespace Flasher\Laravel\Tests\Config;
-use Illuminate\Foundation\Application;
use Flasher\Laravel\Config\Config;
use Flasher\Laravel\Tests\TestCase;
+use Illuminate\Foundation\Application;
final class ConfigTest extends TestCase
{
@@ -13,8 +13,40 @@ final class ConfigTest extends TestCase
$separator = $this->isLaravel4() ? '::' : '.';
$config = new Config($this->app->make('config'), $separator);
- $this->assertEquals('toastr', $config->get('default'));
- $this->assertSame(array(), $config->get('adapters', array()));
+ $this->assertEquals('template', $config->get('default'));
+ $this->assertSame(array(
+ 'template' => array(
+ 'default' => 'tailwindcss',
+ 'templates' => array(
+ 'tailwindcss' => array(
+ 'view' => 'flasher::tailwindcss',
+ 'styles' => array(
+ 'https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css',
+ ),
+ ),
+ 'tailwindcss_bg' => array(
+ 'view' => 'flasher::tailwindcss_bg',
+ 'styles' => array(
+ 'https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css',
+ ),
+ ),
+ 'bootstrap' => array(
+ 'view' => 'flasher::bootstrap',
+ 'styles' => array(
+ 'https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.3/css/bootstrap.min.css',
+ ),
+ ),
+ ),
+ 'scripts' => array(
+ '/vendor/flasher/flasher-template.js',
+ ),
+ 'styles' => array(),
+ 'options' => array(
+ 'timeout' => 5000,
+ 'position' => 'top-right',
+ ),
+ ),
+ ), $config->get('adapters', array()));
}
private function isLaravel4()
diff --git a/src/Noty/Laravel/ServiceProvider/Providers/Laravel.php b/src/Noty/Laravel/ServiceProvider/Providers/Laravel.php
index 4731d8af..779db195 100644
--- a/src/Noty/Laravel/ServiceProvider/Providers/Laravel.php
+++ b/src/Noty/Laravel/ServiceProvider/Providers/Laravel.php
@@ -10,28 +10,47 @@ use Illuminate\Foundation\Application;
class Laravel implements ServiceProviderInterface
{
+ /**
+ * @var Container
+ */
protected $app;
+ /**
+ * @param Container $app
+ */
public function __construct(Container $app)
{
$this->app = $app;
}
+ /**
+ * @inheritDoc
+ */
public function shouldBeUsed()
{
return $this->app instanceof Application;
}
- public function publishConfig(FlasherNotyServiceProvider $provider)
+ /**
+ * @inheritDoc
+ */
+ public function boot(FlasherNotyServiceProvider $provider)
{
- $source = realpath($raw = flasher_path(__DIR__.'/../../Resources/config/config.php')) ?: $raw;
-
- $provider->publishes(array($source => config_path('flasher_noty.php')), 'config');
-
- $provider->mergeConfigFrom($source, 'flasher_noty');
+ $provider->publishes(array(flasher_path(__DIR__.'/../../Resources/config/config.php') => config_path('flasher_noty.php')), 'flasher-config');
}
- public function registerServices()
+ /**
+ * @inheritDoc
+ */
+ public function register(FlasherNotyServiceProvider $provider)
+ {
+ $provider->mergeConfigFrom(flasher_path(__DIR__.'/../../Resources/config/config.php'), 'flasher_noty');
+ $this->appendToFlasherConfig();
+
+ $this->registerServices();
+ }
+
+ protected function registerServices()
{
$this->app->singleton('flasher.noty', function (Container $app) {
return new NotyFactory($app['flasher.storage_manager']);
@@ -46,7 +65,7 @@ class Laravel implements ServiceProviderInterface
});
}
- public function mergeConfigFromNoty()
+ protected function appendToFlasherConfig()
{
$flasherConfig = $this->app['config']->get('flasher.adapters.noty', array());
diff --git a/src/Noty/Laravel/ServiceProvider/Providers/Laravel4.php b/src/Noty/Laravel/ServiceProvider/Providers/Laravel4.php
index 03bc8e41..4ab5934a 100644
--- a/src/Noty/Laravel/ServiceProvider/Providers/Laravel4.php
+++ b/src/Noty/Laravel/ServiceProvider/Providers/Laravel4.php
@@ -7,17 +7,32 @@ use Illuminate\Foundation\Application;
final class Laravel4 extends Laravel
{
+ /**
+ * @inheritDoc
+ */
public function shouldBeUsed()
{
return $this->app instanceof Application && 0 === strpos(Application::VERSION, '4.');
}
- public function publishConfig(FlasherNotyServiceProvider $provider)
+ /**
+ * @inheritDoc
+ */
+ public function boot(FlasherNotyServiceProvider $provider)
{
$provider->package('php-flasher/flasher-noty-laravel', 'flasher_noty', flasher_path(__DIR__.'/../../Resources'));
+ $this->appendToFlasherConfig();
}
- public function mergeConfigFromNoty()
+ /**
+ * @inheritDoc
+ */
+ public function register(FlasherNotyServiceProvider $provider)
+ {
+ $this->registerServices();
+ }
+
+ protected function appendToFlasherConfig()
{
$flasherConfig = $this->app['config']->get('flasher::config.adapters.noty', array());
diff --git a/src/Noty/Laravel/ServiceProvider/Providers/Lumen.php b/src/Noty/Laravel/ServiceProvider/Providers/Lumen.php
deleted file mode 100644
index 00dc3e28..00000000
--- a/src/Noty/Laravel/ServiceProvider/Providers/Lumen.php
+++ /dev/null
@@ -1,23 +0,0 @@
-app instanceof Application;
- }
-
- public function publishConfig(FlasherNotyServiceProvider $provider)
- {
- $source = realpath($raw = flasher_path(__DIR__.'/../../Resources/config/config.php')) ?: $raw;
-
- $this->app->configure('flasher_noty');
-
- $provider->mergeConfigFrom($source, 'flasher_noty');
- }
-}
diff --git a/src/Noty/Laravel/ServiceProvider/Providers/ServiceProviderInterface.php b/src/Noty/Laravel/ServiceProvider/Providers/ServiceProviderInterface.php
index 226da78c..10cfcfac 100644
--- a/src/Noty/Laravel/ServiceProvider/Providers/ServiceProviderInterface.php
+++ b/src/Noty/Laravel/ServiceProvider/Providers/ServiceProviderInterface.php
@@ -6,11 +6,18 @@ use Flasher\Noty\Laravel\FlasherNotyServiceProvider;
interface ServiceProviderInterface
{
+ /**
+ * @return bool
+ */
public function shouldBeUsed();
- public function publishConfig(FlasherNotyServiceProvider $provider);
+ /**
+ * @param FlasherNotyServiceProvider $provider
+ */
+ public function boot(FlasherNotyServiceProvider $provider);
- public function registerServices();
-
- public function mergeConfigFromNoty();
+ /**
+ * @param FlasherNotyServiceProvider $provider
+ */
+ public function register(FlasherNotyServiceProvider $provider);
}
diff --git a/src/Noty/Laravel/ServiceProvider/ServiceProviderManager.php b/src/Noty/Laravel/ServiceProvider/ServiceProviderManager.php
index 5c091f1c..7a548045 100644
--- a/src/Noty/Laravel/ServiceProvider/ServiceProviderManager.php
+++ b/src/Noty/Laravel/ServiceProvider/ServiceProviderManager.php
@@ -15,7 +15,6 @@ final class ServiceProviderManager
private $providers = array(
'Flasher\Noty\Laravel\ServiceProvider\Providers\Laravel4',
'Flasher\Noty\Laravel\ServiceProvider\Providers\Laravel',
- 'Flasher\Noty\Laravel\ServiceProvider\Providers\Lumen',
);
private $notifyServiceProvider;
@@ -28,15 +27,13 @@ final class ServiceProviderManager
public function boot()
{
$provider = $this->resolveServiceProvider();
-
- $provider->publishConfig($this->notifyServiceProvider);
- $provider->mergeConfigFromNoty();
+ $provider->boot($this->notifyServiceProvider);
}
public function register()
{
$provider = $this->resolveServiceProvider();
- $provider->registerServices();
+ $provider->register($this->notifyServiceProvider);
}
/**
diff --git a/src/Noty/Laravel/Tests/FlasherNotyServiceProviderTest.php b/src/Noty/Laravel/Tests/FlasherNotyServiceProviderTest.php
index d3d7bb8d..6f3a10c1 100644
--- a/src/Noty/Laravel/Tests/FlasherNotyServiceProviderTest.php
+++ b/src/Noty/Laravel/Tests/FlasherNotyServiceProviderTest.php
@@ -23,37 +23,35 @@ class FlasherNotyServiceProviderTest extends TestCase
$config = $this->app->make('flasher.config');
$expected = array(
- 'noty' => array(
- 'scripts' => array(
- 'https://cdnjs.cloudflare.com/ajax/libs/noty/3.1.4/noty.min.js',
- ),
- 'styles' => array(
- 'https://cdnjs.cloudflare.com/ajax/libs/noty/3.1.4/noty.min.css',
- ),
- 'options' => array(
- 'layout' => 'topRight',
- 'theme' => 'mint',
- 'timeout' => 5000,
- 'progressBar' => true,
- 'animation.open' => 'noty_effects_open',
- 'animation.close' => 'noty_effects_close',
- 'sounds.sources' => array(),
- 'closeWith' => array('click'),
- 'sounds.volume' => 1,
- 'sounds.conditions' => array(),
- 'docTitle.conditions' => array(),
- 'modal' => false,
- 'id' => false,
- 'force' => false,
- 'queue' => 'global',
- 'killer' => false,
- 'container' => false,
- 'buttons' => array(),
- 'visibilityControl' => false,
- ),
+ 'scripts' => array(
+ 'https://cdnjs.cloudflare.com/ajax/libs/noty/3.1.4/noty.min.js',
+ ),
+ 'styles' => array(
+ 'https://cdnjs.cloudflare.com/ajax/libs/noty/3.1.4/noty.min.css',
+ ),
+ 'options' => array(
+ 'layout' => 'topRight',
+ 'theme' => 'mint',
+ 'timeout' => 5000,
+ 'progressBar' => true,
+ 'animation.open' => 'noty_effects_open',
+ 'animation.close' => 'noty_effects_close',
+ 'sounds.sources' => array(),
+ 'closeWith' => array('click'),
+ 'sounds.volume' => 1,
+ 'sounds.conditions' => array(),
+ 'docTitle.conditions' => array(),
+ 'modal' => false,
+ 'id' => false,
+ 'force' => false,
+ 'queue' => 'global',
+ 'killer' => false,
+ 'container' => false,
+ 'buttons' => array(),
+ 'visibilityControl' => false,
),
);
- $this->assertEquals($expected, $config->get('adapters'));
+ $this->assertEquals($expected, $config->get('adapters.noty'));
}
}
diff --git a/src/Notyf/Laravel/ServiceProvider/Providers/Laravel.php b/src/Notyf/Laravel/ServiceProvider/Providers/Laravel.php
index fecf324e..555f2f23 100644
--- a/src/Notyf/Laravel/ServiceProvider/Providers/Laravel.php
+++ b/src/Notyf/Laravel/ServiceProvider/Providers/Laravel.php
@@ -10,25 +10,44 @@ use Illuminate\Foundation\Application;
class Laravel implements ServiceProviderInterface
{
+ /**
+ * @var Container
+ */
protected $app;
+ /**
+ * @param Container $app
+ */
public function __construct(Container $app)
{
$this->app = $app;
}
+ /**
+ * @inheritDoc
+ */
public function shouldBeUsed()
{
return $this->app instanceof Application;
}
- public function publishConfig(FlasherNotyfServiceProvider $provider)
+ /**
+ * @inheritDoc
+ */
+ public function boot(FlasherNotyfServiceProvider $provider)
{
- $source = realpath($raw = flasher_path(__DIR__.'/../../Resources/config/config.php')) ?: $raw;
+ $provider->publishes(array(flasher_path(__DIR__.'/../../Resources/config/config.php') => config_path('flasher_notyf.php')), 'flasher-config');
+ }
- $provider->publishes(array($source => config_path('flasher_notyf.php')), 'config');
+ /**
+ * @inheritDoc
+ */
+ public function register(FlasherNotyfServiceProvider $provider)
+ {
+ $provider->mergeConfigFrom(flasher_path(__DIR__.'/../../Resources/config/config.php'), 'flasher_notyf');
+ $this->appendToFlasherConfig();
- $provider->mergeConfigFrom($source, 'flasher_notyf');
+ $this->registerServices();
}
public function registerServices()
@@ -46,7 +65,7 @@ class Laravel implements ServiceProviderInterface
});
}
- public function mergeConfigFromNotyf()
+ protected function appendToFlasherConfig()
{
$flasherConfig = $this->app['config']->get('flasher.adapters.notyf', array());
diff --git a/src/Notyf/Laravel/ServiceProvider/Providers/Laravel4.php b/src/Notyf/Laravel/ServiceProvider/Providers/Laravel4.php
index c7219fa7..83003e32 100644
--- a/src/Notyf/Laravel/ServiceProvider/Providers/Laravel4.php
+++ b/src/Notyf/Laravel/ServiceProvider/Providers/Laravel4.php
@@ -7,17 +7,33 @@ use Illuminate\Foundation\Application;
final class Laravel4 extends Laravel
{
+ /**
+ * @inheritDoc
+ */
public function shouldBeUsed()
{
return $this->app instanceof Application && 0 === strpos(Application::VERSION, '4.');
}
- public function publishConfig(FlasherNotyfServiceProvider $provider)
+ /**
+ * @inheritDoc
+ */
+ public function boot(FlasherNotyfServiceProvider $provider)
{
$provider->package('php-flasher/flasher-notyf-laravel', 'flasher_notyf', flasher_path(__DIR__.'/../../Resources'));
+
+ $this->appendToFlasherConfig();
}
- public function mergeConfigFromNotyf()
+ /**
+ * @inheritDoc
+ */
+ public function register(FlasherNotyfServiceProvider $provider)
+ {
+ $this->registerServices();
+ }
+
+ protected function appendToFlasherConfig()
{
$flasherConfig = $this->app['config']->get('flasher::config.adapters.notyf', array());
diff --git a/src/Notyf/Laravel/ServiceProvider/Providers/Lumen.php b/src/Notyf/Laravel/ServiceProvider/Providers/Lumen.php
deleted file mode 100644
index cfbf502b..00000000
--- a/src/Notyf/Laravel/ServiceProvider/Providers/Lumen.php
+++ /dev/null
@@ -1,23 +0,0 @@
-app instanceof Application;
- }
-
- public function publishConfig(FlasherNotyfServiceProvider $provider)
- {
- $source = realpath($raw = flasher_path(__DIR__.'/../../Resources/config/config.php')) ?: $raw;
-
- $this->app->configure('flasher_notyf');
-
- $provider->mergeConfigFrom($source, 'flasher_notyf');
- }
-}
diff --git a/src/Notyf/Laravel/ServiceProvider/Providers/ServiceProviderInterface.php b/src/Notyf/Laravel/ServiceProvider/Providers/ServiceProviderInterface.php
index e1856407..dd04df28 100644
--- a/src/Notyf/Laravel/ServiceProvider/Providers/ServiceProviderInterface.php
+++ b/src/Notyf/Laravel/ServiceProvider/Providers/ServiceProviderInterface.php
@@ -6,11 +6,18 @@ use Flasher\Notyf\Laravel\FlasherNotyfServiceProvider;
interface ServiceProviderInterface
{
+ /**
+ * @return bool
+ */
public function shouldBeUsed();
- public function publishConfig(FlasherNotyfServiceProvider $provider);
+ /**
+ * @param FlasherNotyfServiceProvider $provider
+ */
+ public function boot(FlasherNotyfServiceProvider $provider);
- public function registerServices();
-
- public function mergeConfigFromNotyf();
+ /**
+ * @param FlasherNotyfServiceProvider $provider
+ */
+ public function register(FlasherNotyfServiceProvider $provider);
}
diff --git a/src/Notyf/Laravel/ServiceProvider/ServiceProviderManager.php b/src/Notyf/Laravel/ServiceProvider/ServiceProviderManager.php
index 2c326093..bba23a7e 100644
--- a/src/Notyf/Laravel/ServiceProvider/ServiceProviderManager.php
+++ b/src/Notyf/Laravel/ServiceProvider/ServiceProviderManager.php
@@ -7,6 +7,9 @@ use Flasher\Notyf\Laravel\ServiceProvider\Providers\ServiceProviderInterface;
final class ServiceProviderManager
{
+ /**
+ * @var ServiceProviderInterface
+ */
private $provider;
/**
@@ -18,8 +21,14 @@ final class ServiceProviderManager
'Flasher\Notyf\Laravel\ServiceProvider\Providers\Lumen',
);
+ /**
+ * @var FlasherNotyfServiceProvider
+ */
private $notifyServiceProvider;
+ /**
+ * @param FlasherNotyfServiceProvider $notifyServiceProvider
+ */
public function __construct(FlasherNotyfServiceProvider $notifyServiceProvider)
{
$this->notifyServiceProvider = $notifyServiceProvider;
@@ -28,15 +37,13 @@ final class ServiceProviderManager
public function boot()
{
$provider = $this->resolveServiceProvider();
-
- $provider->publishConfig($this->notifyServiceProvider);
- $provider->mergeConfigFromNotyf();
+ $provider->boot($this->notifyServiceProvider);
}
public function register()
{
$provider = $this->resolveServiceProvider();
- $provider->registerServices();
+ $provider->register($this->notifyServiceProvider);
}
/**
diff --git a/src/Notyf/Laravel/Tests/FlasherNotyfServiceProviderTest.php b/src/Notyf/Laravel/Tests/FlasherNotyfServiceProviderTest.php
index 134ffdbd..061b4e13 100644
--- a/src/Notyf/Laravel/Tests/FlasherNotyfServiceProviderTest.php
+++ b/src/Notyf/Laravel/Tests/FlasherNotyfServiceProviderTest.php
@@ -23,57 +23,55 @@ class FlasherNotyfServiceProviderTest extends TestCase
$config = $this->app->make('flasher.config');
$expected = array(
- 'notyf' => array(
- 'scripts' => array(
- 'https://cdn.jsdelivr.net/npm/notyf@3/notyf.min.js',
+ 'scripts' => array(
+ 'https://cdn.jsdelivr.net/npm/notyf@3/notyf.min.js',
+ ),
+ 'styles' => array(
+ 'https://cdn.jsdelivr.net/npm/notyf@3/notyf.min.css',
+ ),
+ 'options' => array(
+ 'duration' => 5000,
+ 'ripple' => true,
+ 'position' => array(
+ 'x' => 'right',
+ 'y' => 'top',
),
- 'styles' => array(
- 'https://cdn.jsdelivr.net/npm/notyf@3/notyf.min.css',
- ),
- 'options' => array(
- 'duration' => 5000,
- 'ripple' => true,
- 'position' => array(
- 'x' => 'right',
- 'y' => 'top',
+ 'dismissible' => false,
+ 'types' => array(
+ array(
+ 'type' => 'success',
+ 'className' => 'notyf__toast--success',
+ 'backgroundColor' => '#3dc763',
+ 'icon' => array(
+ 'className' => 'notyf__icon--success',
+ 'tagName' => 'i',
+ ),
),
- 'dismissible' => false,
- 'types' => array(
- array(
- 'type' => 'success',
- 'className' => 'notyf__toast--success',
- 'backgroundColor' => '#3dc763',
- 'icon' => array(
- 'className' => 'notyf__icon--success',
- 'tagName' => 'i',
- ),
- ),
- array(
- 'type' => 'error',
- 'className' => 'notyf__toast--error',
- 'backgroundColor' => '#ed3d3d',
- 'icon' => array(
- 'className' => 'notyf__icon--error',
- 'tagName' => 'i',
- ),
- ),
- array(
- 'type' => 'info',
- 'className' => 'notyf__toast--info',
- 'backgroundColor' => '#5784E5',
- 'icon' => false,
- ),
- array(
- 'type' => 'warning',
- 'className' => 'notyf__toast--warning',
- 'backgroundColor' => '#E3A008',
- 'icon' => false,
+ array(
+ 'type' => 'error',
+ 'className' => 'notyf__toast--error',
+ 'backgroundColor' => '#ed3d3d',
+ 'icon' => array(
+ 'className' => 'notyf__icon--error',
+ 'tagName' => 'i',
),
),
+ array(
+ 'type' => 'info',
+ 'className' => 'notyf__toast--info',
+ 'backgroundColor' => '#5784E5',
+ 'icon' => false,
+ ),
+ array(
+ 'type' => 'warning',
+ 'className' => 'notyf__toast--warning',
+ 'backgroundColor' => '#E3A008',
+ 'icon' => false,
+ ),
),
),
);
- $this->assertEquals($expected, $config->get('adapters'));
+ $this->assertEquals($expected, $config->get('adapters.notyf'));
}
}
diff --git a/src/Pnotify/Laravel/ServiceProvider/Providers/Laravel.php b/src/Pnotify/Laravel/ServiceProvider/Providers/Laravel.php
index 64e09b78..4f336b02 100644
--- a/src/Pnotify/Laravel/ServiceProvider/Providers/Laravel.php
+++ b/src/Pnotify/Laravel/ServiceProvider/Providers/Laravel.php
@@ -10,25 +10,44 @@ use Illuminate\Foundation\Application;
class Laravel implements ServiceProviderInterface
{
+ /**
+ * @var Container
+ */
protected $app;
+ /**
+ * @param Container $app
+ */
public function __construct(Container $app)
{
$this->app = $app;
}
+ /**
+ * @inheritDoc
+ */
public function shouldBeUsed()
{
return $this->app instanceof Application;
}
- public function publishConfig(FlasherPnotifyServiceProvider $provider)
+ /**
+ * @inheritDoc
+ */
+ public function boot(FlasherPnotifyServiceProvider $provider)
{
- $source = realpath($raw = flasher_path(__DIR__.'/../../Resources/config/config.php')) ?: $raw;
+ $provider->publishes(array(flasher_path(__DIR__.'/../../Resources/config/config.php') => config_path('flasher_pnotify.php')), 'config');
+ }
- $provider->publishes(array($source => config_path('flasher_pnotify.php')), 'config');
+ /**
+ * @inheritDoc
+ */
+ public function register(FlasherPnotifyServiceProvider $provider)
+ {
+ $provider->mergeConfigFrom(flasher_path(__DIR__.'/../../Resources/config/config.php'), 'flasher_pnotify');
+ $this->appendToFlasherConfig();
- $provider->mergeConfigFrom($source, 'flasher_pnotify');
+ $this->registerServices();
}
public function registerServices()
@@ -46,7 +65,7 @@ class Laravel implements ServiceProviderInterface
});
}
- public function mergeConfigFromPnotify()
+ protected function appendToFlasherConfig()
{
$flasherConfig = $this->app['config']->get('flasher.adapters.pnotify', array());
diff --git a/src/Pnotify/Laravel/ServiceProvider/Providers/Laravel4.php b/src/Pnotify/Laravel/ServiceProvider/Providers/Laravel4.php
index 2e7158f2..e2bcff80 100644
--- a/src/Pnotify/Laravel/ServiceProvider/Providers/Laravel4.php
+++ b/src/Pnotify/Laravel/ServiceProvider/Providers/Laravel4.php
@@ -7,17 +7,33 @@ use Illuminate\Foundation\Application;
final class Laravel4 extends Laravel
{
+ /**
+ * @inheritDoc
+ */
public function shouldBeUsed()
{
return $this->app instanceof Application && 0 === strpos(Application::VERSION, '4.');
}
- public function publishConfig(FlasherPnotifyServiceProvider $provider)
+ /**
+ * @inheritDoc
+ */
+ public function boot(FlasherPnotifyServiceProvider $provider)
{
$provider->package('php-flasher/flasher-pnotify-laravel', 'flasher_pnotify', flasher_path(__DIR__.'/../../Resources'));
+
+ $this->appendToFlasherConfig();
}
- public function mergeConfigFromPnotify()
+ /**
+ * @inheritDoc
+ */
+ public function register(FlasherPnotifyServiceProvider $provider)
+ {
+ $this->registerServices();
+ }
+
+ protected function appendToFlasherConfig()
{
$flasherConfig = $this->app['config']->get('flasher::config.adapters.pnotify', array());
diff --git a/src/Pnotify/Laravel/ServiceProvider/Providers/Lumen.php b/src/Pnotify/Laravel/ServiceProvider/Providers/Lumen.php
deleted file mode 100644
index 4ab456af..00000000
--- a/src/Pnotify/Laravel/ServiceProvider/Providers/Lumen.php
+++ /dev/null
@@ -1,23 +0,0 @@
-app instanceof Application;
- }
-
- public function publishConfig(FlasherPnotifyServiceProvider $provider)
- {
- $source = realpath($raw = flasher_path(__DIR__.'/../../Resources/config/config.php')) ?: $raw;
-
- $this->app->configure('flasher_pnotify');
-
- $provider->mergeConfigFrom($source, 'flasher_pnotify');
- }
-}
diff --git a/src/Pnotify/Laravel/ServiceProvider/Providers/ServiceProviderInterface.php b/src/Pnotify/Laravel/ServiceProvider/Providers/ServiceProviderInterface.php
index f09e2f3e..d98d9189 100644
--- a/src/Pnotify/Laravel/ServiceProvider/Providers/ServiceProviderInterface.php
+++ b/src/Pnotify/Laravel/ServiceProvider/Providers/ServiceProviderInterface.php
@@ -6,11 +6,18 @@ use Flasher\Pnotify\Laravel\FlasherPnotifyServiceProvider;
interface ServiceProviderInterface
{
+ /**
+ * @return bool
+ */
public function shouldBeUsed();
- public function publishConfig(FlasherPnotifyServiceProvider $provider);
+ /**
+ * @param FlasherPnotifyServiceProvider $provider
+ */
+ public function boot(FlasherPnotifyServiceProvider $provider);
- public function registerServices();
-
- public function mergeConfigFromPnotify();
+ /**
+ * @param FlasherPnotifyServiceProvider $provider
+ */
+ public function register(FlasherPnotifyServiceProvider $provider);
}
diff --git a/src/Pnotify/Laravel/ServiceProvider/ServiceProviderManager.php b/src/Pnotify/Laravel/ServiceProvider/ServiceProviderManager.php
index 4e98cfc6..6d27d789 100644
--- a/src/Pnotify/Laravel/ServiceProvider/ServiceProviderManager.php
+++ b/src/Pnotify/Laravel/ServiceProvider/ServiceProviderManager.php
@@ -7,6 +7,9 @@ use Flasher\Pnotify\Laravel\ServiceProvider\Providers\ServiceProviderInterface;
final class ServiceProviderManager
{
+ /**
+ * @var ServiceProviderInterface
+ */
private $provider;
/**
@@ -15,11 +18,16 @@ final class ServiceProviderManager
private $providers = array(
'Flasher\Pnotify\Laravel\ServiceProvider\Providers\Laravel4',
'Flasher\Pnotify\Laravel\ServiceProvider\Providers\Laravel',
- 'Flasher\Pnotify\Laravel\ServiceProvider\Providers\Lumen',
);
+ /**
+ * @var FlasherPnotifyServiceProvider
+ */
private $notifyServiceProvider;
+ /**
+ * @param FlasherPnotifyServiceProvider $notifyServiceProvider
+ */
public function __construct(FlasherPnotifyServiceProvider $notifyServiceProvider)
{
$this->notifyServiceProvider = $notifyServiceProvider;
@@ -28,15 +36,13 @@ final class ServiceProviderManager
public function boot()
{
$provider = $this->resolveServiceProvider();
-
- $provider->publishConfig($this->notifyServiceProvider);
- $provider->mergeConfigFromPnotify();
+ $provider->boot($this->notifyServiceProvider);
}
public function register()
{
$provider = $this->resolveServiceProvider();
- $provider->registerServices();
+ $provider->register($this->notifyServiceProvider);
}
/**
diff --git a/src/Pnotify/Laravel/Tests/FlasherPnotifyServiceProviderTest.php b/src/Pnotify/Laravel/Tests/FlasherPnotifyServiceProviderTest.php
index dcea6662..554da1ba 100644
--- a/src/Pnotify/Laravel/Tests/FlasherPnotifyServiceProviderTest.php
+++ b/src/Pnotify/Laravel/Tests/FlasherPnotifyServiceProviderTest.php
@@ -23,53 +23,51 @@ class FlasherPnotifyServiceProviderTest extends TestCase
$config = $this->app->make('flasher.config');
$expected = array(
- 'pnotify' => array(
- 'scripts' => array(
- 'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js',
- 'https://cdnjs.cloudflare.com/ajax/libs/pnotify/3.2.1/pnotify.js',
- ),
- 'styles' => array(
- 'https://cdnjs.cloudflare.com/ajax/libs/pnotify/3.2.1/pnotify.css',
- 'https://cdnjs.cloudflare.com/ajax/libs/pnotify/3.2.1/pnotify.brighttheme.css',
- ),
- 'options' => array(
- 'type' => 'notice',
- 'title' => false,
- 'titleTrusted' => false,
- 'text' => false,
- 'textTrusted' => false,
- 'styling' => 'brighttheme',
- 'icons' => 'brighttheme',
- 'mode' => 'no-preference',
- 'addClass' => '',
- 'addModalClass' => '',
- 'addModelessClass' => '',
- 'autoOpen' => true,
- 'width' => '360px',
- 'minHeight' => '16px',
- 'maxTextHeight' => '200px',
- 'icon' => true,
- 'animation' => 'fade',
- 'animateSpeed' => 'normal',
- 'shadow' => true,
- 'hide' => true,
- 'delay' => 5000,
- 'mouseReset' => true,
- 'closer' => true,
- 'closerHover' => true,
- 'sticker' => true,
- 'stickerHover' => true,
- 'labels' => array(
- 'close' => 'Close',
- 'stick' => 'Pin',
- 'unstick' => 'Unpin',
- ),
- 'remove' => true,
- 'destroy' => true,
+ 'scripts' => array(
+ 'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js',
+ 'https://cdnjs.cloudflare.com/ajax/libs/pnotify/3.2.1/pnotify.js',
+ ),
+ 'styles' => array(
+ 'https://cdnjs.cloudflare.com/ajax/libs/pnotify/3.2.1/pnotify.css',
+ 'https://cdnjs.cloudflare.com/ajax/libs/pnotify/3.2.1/pnotify.brighttheme.css',
+ ),
+ 'options' => array(
+ 'type' => 'notice',
+ 'title' => false,
+ 'titleTrusted' => false,
+ 'text' => false,
+ 'textTrusted' => false,
+ 'styling' => 'brighttheme',
+ 'icons' => 'brighttheme',
+ 'mode' => 'no-preference',
+ 'addClass' => '',
+ 'addModalClass' => '',
+ 'addModelessClass' => '',
+ 'autoOpen' => true,
+ 'width' => '360px',
+ 'minHeight' => '16px',
+ 'maxTextHeight' => '200px',
+ 'icon' => true,
+ 'animation' => 'fade',
+ 'animateSpeed' => 'normal',
+ 'shadow' => true,
+ 'hide' => true,
+ 'delay' => 5000,
+ 'mouseReset' => true,
+ 'closer' => true,
+ 'closerHover' => true,
+ 'sticker' => true,
+ 'stickerHover' => true,
+ 'labels' => array(
+ 'close' => 'Close',
+ 'stick' => 'Pin',
+ 'unstick' => 'Unpin',
),
+ 'remove' => true,
+ 'destroy' => true,
),
);
- $this->assertEquals($expected, $config->get('adapters'));
+ $this->assertEquals($expected, $config->get('adapters.pnotify'));
}
}
diff --git a/src/SweetAlert/Laravel/ServiceProvider/Providers/Laravel.php b/src/SweetAlert/Laravel/ServiceProvider/Providers/Laravel.php
index 924ea4e7..02b58949 100644
--- a/src/SweetAlert/Laravel/ServiceProvider/Providers/Laravel.php
+++ b/src/SweetAlert/Laravel/ServiceProvider/Providers/Laravel.php
@@ -10,25 +10,44 @@ use Illuminate\Foundation\Application;
class Laravel implements ServiceProviderInterface
{
+ /**
+ * @var Container
+ */
protected $app;
+ /**
+ * @param Container $app
+ */
public function __construct(Container $app)
{
$this->app = $app;
}
+ /**
+ * @inheritDoc
+ */
public function shouldBeUsed()
{
return $this->app instanceof Application;
}
- public function publishConfig(FlasherSweetAlertServiceProvider $provider)
+ /**
+ * @inheritDoc
+ */
+ public function boot(FlasherSweetAlertServiceProvider $provider)
{
- $source = realpath($raw = flasher_path(__DIR__.'/../../Resources/config/config.php')) ?: $raw;
+ $provider->publishes(array(flasher_path(__DIR__.'/../../Resources/config/config.php') => config_path('flasher_sweet_alert.php')), 'config');
+ }
- $provider->publishes(array($source => config_path('flasher_sweet_alert.php')), 'config');
+ /**
+ * @inheritDoc
+ */
+ public function register(FlasherSweetAlertServiceProvider $provider)
+ {
+ $provider->mergeConfigFrom(flasher_path(__DIR__.'/../../Resources/config/config.php'), 'flasher_sweet_alert');
+ $this->appendToFlasherConfig();
- $provider->mergeConfigFrom($source, 'flasher_sweet_alert');
+ $this->registerServices();
}
public function registerServices()
@@ -46,7 +65,7 @@ class Laravel implements ServiceProviderInterface
});
}
- public function mergeConfigFromSweetAlert()
+ public function appendToFlasherConfig()
{
$notifyConfig = $this->app['config']->get('flasher.adapters.sweet_alert', array());
diff --git a/src/SweetAlert/Laravel/ServiceProvider/Providers/Laravel4.php b/src/SweetAlert/Laravel/ServiceProvider/Providers/Laravel4.php
index 0a95e963..db223a67 100644
--- a/src/SweetAlert/Laravel/ServiceProvider/Providers/Laravel4.php
+++ b/src/SweetAlert/Laravel/ServiceProvider/Providers/Laravel4.php
@@ -7,17 +7,32 @@ use Illuminate\Foundation\Application;
final class Laravel4 extends Laravel
{
+ /**
+ * @inheritDoc
+ */
public function shouldBeUsed()
{
return $this->app instanceof Application && 0 === strpos(Application::VERSION, '4.');
}
- public function publishConfig(FlasherSweetAlertServiceProvider $provider)
+ /**
+ * @inheritDoc
+ */
+ public function boot(FlasherSweetAlertServiceProvider $provider)
{
$provider->package('php-flasher/flasher-sweet_alert-laravel', 'flasher_sweet_alert', flasher_path(__DIR__.'/../../Resources'));
+ $this->appendToFlasherConfig();
}
- public function mergeConfigFromSweetAlert()
+ /**
+ * @inheritDoc
+ */
+ public function register(FlasherSweetAlertServiceProvider $provider)
+ {
+ $this->registerServices();
+ }
+
+ public function appendToFlasherConfig()
{
$flasherConfig = $this->app['config']->get('flasher::config.adapters.sweet_alert', array());
diff --git a/src/SweetAlert/Laravel/ServiceProvider/Providers/Lumen.php b/src/SweetAlert/Laravel/ServiceProvider/Providers/Lumen.php
deleted file mode 100644
index adcb6e5d..00000000
--- a/src/SweetAlert/Laravel/ServiceProvider/Providers/Lumen.php
+++ /dev/null
@@ -1,23 +0,0 @@
-app instanceof Application;
- }
-
- public function publishConfig(FlasherSweetAlertServiceProvider $provider)
- {
- $source = realpath($raw = flasher_path(__DIR__.'/../../Resources/config/config.php')) ?: $raw;
-
- $this->app->configure('flasher_sweet_alert');
-
- $provider->mergeConfigFrom($source, 'flasher_sweet_alert');
- }
-}
diff --git a/src/SweetAlert/Laravel/ServiceProvider/Providers/ServiceProviderInterface.php b/src/SweetAlert/Laravel/ServiceProvider/Providers/ServiceProviderInterface.php
index f7d4ea9c..c325f590 100644
--- a/src/SweetAlert/Laravel/ServiceProvider/Providers/ServiceProviderInterface.php
+++ b/src/SweetAlert/Laravel/ServiceProvider/Providers/ServiceProviderInterface.php
@@ -6,11 +6,18 @@ use Flasher\SweetAlert\Laravel\FlasherSweetAlertServiceProvider;
interface ServiceProviderInterface
{
+ /**
+ * @return bool
+ */
public function shouldBeUsed();
- public function publishConfig(FlasherSweetAlertServiceProvider $provider);
+ /**
+ * @param FlasherSweetAlertServiceProvider $provider
+ */
+ public function boot(FlasherSweetAlertServiceProvider $provider);
- public function registerServices();
-
- public function mergeConfigFromSweetAlert();
+ /**
+ * @param FlasherSweetAlertServiceProvider $provider
+ */
+ public function register(FlasherSweetAlertServiceProvider $provider);
}
diff --git a/src/SweetAlert/Laravel/ServiceProvider/ServiceProviderManager.php b/src/SweetAlert/Laravel/ServiceProvider/ServiceProviderManager.php
index 7d482e1a..94375bc8 100644
--- a/src/SweetAlert/Laravel/ServiceProvider/ServiceProviderManager.php
+++ b/src/SweetAlert/Laravel/ServiceProvider/ServiceProviderManager.php
@@ -15,7 +15,6 @@ final class ServiceProviderManager
private $providers = array(
'Flasher\SweetAlert\Laravel\ServiceProvider\Providers\Laravel4',
'Flasher\SweetAlert\Laravel\ServiceProvider\Providers\Laravel',
- 'Flasher\SweetAlert\Laravel\ServiceProvider\Providers\Lumen',
);
private $notifyServiceProvider;
@@ -28,15 +27,13 @@ final class ServiceProviderManager
public function boot()
{
$provider = $this->resolveServiceProvider();
-
- $provider->publishConfig($this->notifyServiceProvider);
- $provider->mergeConfigFromSweetAlert();
+ $provider->boot($this->notifyServiceProvider);
}
public function register()
{
$provider = $this->resolveServiceProvider();
- $provider->registerServices();
+ $provider->register($this->notifyServiceProvider);
}
/**
diff --git a/src/SweetAlert/Laravel/Tests/FlasherSweetAlertServiceProviderTest.php b/src/SweetAlert/Laravel/Tests/FlasherSweetAlertServiceProviderTest.php
index b0800831..8d778cbf 100644
--- a/src/SweetAlert/Laravel/Tests/FlasherSweetAlertServiceProviderTest.php
+++ b/src/SweetAlert/Laravel/Tests/FlasherSweetAlertServiceProviderTest.php
@@ -23,39 +23,37 @@ class FlasherSweetAlertServiceProviderTest extends TestCase
$config = $this->app->make('flasher.config');
$expected = array(
- 'sweet_alert' => array(
- 'scripts' => array(
- 'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js',
- 'https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/10.10.2/sweetalert2.min.js',
- 'https://cdnjs.cloudflare.com/ajax/libs/promise-polyfill/8.2.0/polyfill.min.js',
+ 'scripts' => array(
+ 'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js',
+ 'https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/10.10.2/sweetalert2.min.js',
+ 'https://cdnjs.cloudflare.com/ajax/libs/promise-polyfill/8.2.0/polyfill.min.js',
+ ),
+ 'styles' => array(
+ 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css',
+ 'https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/10.10.2/sweetalert2.min.css',
+ ),
+ 'options' => array(
+ 'timer' => 5000,
+ //'width' => '32rem',
+ //'heightAuto' => true,
+ 'padding' => '1.25rem',
+ 'showConfirmButton' => false,
+ 'showCloseButton' => false,
+ 'toast' => true,
+ 'position' => 'top-end',
+ 'timerProgressBar' => true,
+ 'animation' => true,
+ 'showClass' => array(
+ 'popup' => 'animate__animated animate__fadeInDown',
),
- 'styles' => array(
- 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css',
- 'https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/10.10.2/sweetalert2.min.css',
- ),
- 'options' => array(
- 'timer' => 5000,
- //'width' => '32rem',
- //'heightAuto' => true,
- 'padding' => '1.25rem',
- 'showConfirmButton' => false,
- 'showCloseButton' => false,
- 'toast' => true,
- 'position' => 'top-end',
- 'timerProgressBar' => true,
- 'animation' => true,
- 'showClass' => array(
- 'popup' => 'animate__animated animate__fadeInDown',
- ),
- 'hideClass' => array(
- 'popup' => 'animate__animated animate__fadeOutUp',
- ),
- 'backdrop' => true,
- 'grow' => true,
+ 'hideClass' => array(
+ 'popup' => 'animate__animated animate__fadeOutUp',
),
+ 'backdrop' => true,
+ 'grow' => true,
),
);
- $this->assertEquals($expected, $config->get('adapters'));
+ $this->assertEquals($expected, $config->get('adapters.sweet_alert'));
}
}
diff --git a/src/Symfony/Resources/views/bootstrap.html.twig b/src/Symfony/Resources/views/bootstrap.html.twig
index 1da97730..8a5e85db 100644
--- a/src/Symfony/Resources/views/bootstrap.html.twig
+++ b/src/Symfony/Resources/views/bootstrap.html.twig
@@ -1,62 +1,30 @@
{% if 'success' == envelope.type %}
- {% set text_color = 'text-green-600' %}
- {% set background_color = 'bg-green-600' %}
- {% set progress_background_color = 'bg-green-100' %}
- {% set border_color = 'border-green-600' %}
- {% set icon = '
' %}
+ {% set title = 'Success' %}
+ {% set alert_class = 'alert-success' %}
+ {% set progress_bg_color = '#155724' %}
{% elseif 'error' == envelope.type %}
- {% set text_color = 'text-red-600' %}
- {% set background_color = 'bg-red-600' %}
- {% set progress_background_color = 'bg-red-100' %}
- {% set border_color = 'border-red-600' %}
- {% set icon = '
' %}
+ {% set title = 'Error' %}
+ {% set alert_class = 'alert-danger' %}
+ {% set progress_bg_color = '#721c24' %}
{% elseif 'warning' == envelope.type %}
- {% set text_color = 'text-yellow-600' %}
- {% set background_color = 'bg-yellow-600' %}
- {% set progress_background_color = 'bg-yellow-100' %}
- {% set border_color = 'border-yellow-600' %}
- {% set icon = '
' %}
+ {% set title = 'Warning' %}
+ {% set alert_class = 'alert-warning' %}
+ {% set progress_bg_color = '#856404' %}
{% else %}
- {% set text_color = 'text-blue-600' %}
- {% set background_color = 'bg-blue-600' %}
- {% set progress_background_color = 'bg-blue-100' %}
- {% set border_color = 'border-blue-600' %}
- {% set icon = '
' %}
+ {% set title = 'Info' %}
+ {% set alert_class = 'alert-info' %}
+ {% set progress_bg_color = '#0c5460' %}
{% endif %}
-
- Success! Indicates a successful or positive action.
-
-
-
-
-
-
-
-
-
-
-
- This is a basic toast message.
-
-
-
-
-
-
- See? This is another toast message.
-
-
-
-
+
+
+{# {{ title | trans }} ! #}
+ {{ envelope.message }}
+
+
+
+
+
diff --git a/src/Symfony/Resources/views/tailwindcss.html.twig b/src/Symfony/Resources/views/tailwindcss.html.twig
index 2c9ce051..ab57a3f7 100644
--- a/src/Symfony/Resources/views/tailwindcss.html.twig
+++ b/src/Symfony/Resources/views/tailwindcss.html.twig
@@ -1,22 +1,26 @@
{% if 'success' == envelope.type %}
+ {% set title = 'Success' %}
{% set text_color = 'text-green-600' %}
{% set background_color = 'bg-green-600' %}
{% set progress_background_color = 'bg-green-100' %}
{% set border_color = 'border-green-600' %}
{% set icon = '
' %}
{% elseif 'error' == envelope.type %}
+ {% set title = 'Error' %}
{% set text_color = 'text-red-600' %}
{% set background_color = 'bg-red-600' %}
{% set progress_background_color = 'bg-red-100' %}
{% set border_color = 'border-red-600' %}
{% set icon = '
' %}
{% elseif 'warning' == envelope.type %}
+ {% set title = 'Warning' %}
{% set text_color = 'text-yellow-600' %}
{% set background_color = 'bg-yellow-600' %}
{% set progress_background_color = 'bg-yellow-100' %}
{% set border_color = 'border-yellow-600' %}
{% set icon = '
' %}
{% else %}
+ {% set title = 'Info' %}
{% set text_color = 'text-blue-600' %}
{% set background_color = 'bg-blue-600' %}
{% set progress_background_color = 'bg-blue-100' %}
@@ -31,7 +35,7 @@
- {{ envelope.type }}
+ {{ title | trans }}
{{ envelope.message }}
diff --git a/src/Symfony/Resources/views/tailwindcss_bg.html.twig b/src/Symfony/Resources/views/tailwindcss_bg.html.twig
index 2aeed698..6dc98f6f 100644
--- a/src/Symfony/Resources/views/tailwindcss_bg.html.twig
+++ b/src/Symfony/Resources/views/tailwindcss_bg.html.twig
@@ -1,22 +1,26 @@
{% if 'success' == envelope.type %}
+ {% set title = 'Success' %}
{% set text_color = 'text-green-700' %}
{% set background_color = 'bg-green-50' %}
{% set progress_background_color = 'bg-green-200' %}
{% set border_color = 'border-green-600' %}
{% set icon = '' %}
{% elseif 'error' == envelope.type %}
+ {% set title = 'Error' %}
{% set text_color = 'text-red-700' %}
{% set background_color = 'bg-red-50' %}
{% set progress_background_color = 'bg-red-200' %}
{% set border_color = 'border-red-600' %}
{% set icon = '' %}
{% elseif 'warning' == envelope.type %}
+ {% set title = 'Warning' %}
{% set text_color = 'text-yellow-700' %}
{% set background_color = 'bg-yellow-50' %}
{% set progress_background_color = 'bg-yellow-200' %}
{% set border_color = 'border-yellow-600' %}
{% set icon = '' %}
{% else %}
+ {% set title = 'Info' %}
{% set text_color = 'text-blue-700' %}
{% set background_color = 'bg-blue-50' %}
{% set progress_background_color = 'bg-blue-200' %}
@@ -31,7 +35,7 @@
- {{ envelope.type }}
+ {{ title | trans }}
{{ envelope.message }}
diff --git a/src/Toastr/Laravel/ServiceProvider/Providers/Laravel.php b/src/Toastr/Laravel/ServiceProvider/Providers/Laravel.php
index e8174435..8162e7f8 100644
--- a/src/Toastr/Laravel/ServiceProvider/Providers/Laravel.php
+++ b/src/Toastr/Laravel/ServiceProvider/Providers/Laravel.php
@@ -10,28 +10,47 @@ use Illuminate\Foundation\Application;
class Laravel implements ServiceProviderInterface
{
+ /**
+ * @var Container
+ */
protected $app;
+ /**
+ * @param Container $app
+ */
public function __construct(Container $app)
{
$this->app = $app;
}
+ /**
+ * @inheritDoc
+ */
public function shouldBeUsed()
{
return $this->app instanceof Application;
}
- public function publishConfig(FlasherToastrServiceProvider $provider)
+ /**
+ * @inheritDoc
+ */
+ public function boot(FlasherToastrServiceProvider $provider)
{
- $source = realpath($raw = flasher_path(__DIR__.'/../../Resources/config/config.php')) ?: $raw;
-
- $provider->publishes(array($source => config_path('flasher_toastr.php')), 'config');
-
- $provider->mergeConfigFrom($source, 'flasher_toastr');
+ $provider->publishes(array(flasher_path(__DIR__.'/../../Resources/config/config.php') => config_path('flasher_toastr.php')), 'config');
}
- public function registerToastrServices()
+ /**
+ * @inheritDoc
+ */
+ public function register(FlasherToastrServiceProvider $provider)
+ {
+ $provider->mergeConfigFrom(flasher_path(__DIR__.'/../../Resources/config/config.php'), 'flasher_toastr');
+ $this->appendToFlasherConfig();
+
+ $this->registerServices();
+ }
+
+ public function registerServices()
{
$this->app->singleton('flasher.toastr', function (Container $app) {
return new ToastrFactory($app['flasher.storage_manager']);
@@ -46,7 +65,7 @@ class Laravel implements ServiceProviderInterface
});
}
- public function mergeConfigFromToastr()
+ public function appendToFlasherConfig()
{
$flasherConfig = $this->app['config']->get('flasher.adapters.toastr', array());
diff --git a/src/Toastr/Laravel/ServiceProvider/Providers/Laravel4.php b/src/Toastr/Laravel/ServiceProvider/Providers/Laravel4.php
index 11b1d21b..d7dcac9d 100644
--- a/src/Toastr/Laravel/ServiceProvider/Providers/Laravel4.php
+++ b/src/Toastr/Laravel/ServiceProvider/Providers/Laravel4.php
@@ -7,17 +7,32 @@ use Illuminate\Foundation\Application;
final class Laravel4 extends Laravel
{
+ /**
+ * @inheritDoc
+ */
public function shouldBeUsed()
{
return $this->app instanceof Application && 0 === strpos(Application::VERSION, '4.');
}
- public function publishConfig(FlasherToastrServiceProvider $provider)
+ /**
+ * @inheritDoc
+ */
+ public function boot(FlasherToastrServiceProvider $provider)
{
$provider->package('php-flasher/flasher-toastr-laravel', 'flasher_toastr', flasher_path(__DIR__.'/../../Resources'));
+ $this->appendToFlasherConfig();
}
- public function mergeConfigFromToastr()
+ /**
+ * @inheritDoc
+ */
+ public function register(FlasherToastrServiceProvider $provider)
+ {
+ $this->registerServices();
+ }
+
+ public function appendToFlasherConfig()
{
$flasherConfig = $this->app['config']->get('flasher::config.adapters.toastr', array());
diff --git a/src/Toastr/Laravel/ServiceProvider/Providers/Lumen.php b/src/Toastr/Laravel/ServiceProvider/Providers/Lumen.php
deleted file mode 100644
index 72a3471b..00000000
--- a/src/Toastr/Laravel/ServiceProvider/Providers/Lumen.php
+++ /dev/null
@@ -1,23 +0,0 @@
-app instanceof Application;
- }
-
- public function publishConfig(FlasherToastrServiceProvider $provider)
- {
- $source = realpath($raw = flasher_path(__DIR__.'/../../Resources/config/config.php')) ?: $raw;
-
- $this->app->configure('flasher_toastr');
-
- $provider->mergeConfigFrom($source, 'flasher_toastr');
- }
-}
diff --git a/src/Toastr/Laravel/ServiceProvider/Providers/ServiceProviderInterface.php b/src/Toastr/Laravel/ServiceProvider/Providers/ServiceProviderInterface.php
index 2e8b9a6b..874cd95c 100644
--- a/src/Toastr/Laravel/ServiceProvider/Providers/ServiceProviderInterface.php
+++ b/src/Toastr/Laravel/ServiceProvider/Providers/ServiceProviderInterface.php
@@ -6,11 +6,18 @@ use Flasher\Toastr\Laravel\FlasherToastrServiceProvider;
interface ServiceProviderInterface
{
+ /**
+ * @return bool
+ */
public function shouldBeUsed();
- public function publishConfig(FlasherToastrServiceProvider $provider);
+ /**
+ * @param FlasherToastrServiceProvider $provider
+ */
+ public function boot(FlasherToastrServiceProvider $provider);
- public function registerToastrServices();
-
- public function mergeConfigFromToastr();
+ /**
+ * @param FlasherToastrServiceProvider $provider
+ */
+ public function register(FlasherToastrServiceProvider $provider);
}
diff --git a/src/Toastr/Laravel/ServiceProvider/ServiceProviderManager.php b/src/Toastr/Laravel/ServiceProvider/ServiceProviderManager.php
index eecb02cd..008fdfff 100644
--- a/src/Toastr/Laravel/ServiceProvider/ServiceProviderManager.php
+++ b/src/Toastr/Laravel/ServiceProvider/ServiceProviderManager.php
@@ -7,6 +7,9 @@ use Flasher\Toastr\Laravel\ServiceProvider\Providers\ServiceProviderInterface;
final class ServiceProviderManager
{
+ /**
+ * @var ServiceProviderInterface
+ */
private $provider;
/**
@@ -15,11 +18,16 @@ final class ServiceProviderManager
private $providers = array(
'Flasher\Toastr\Laravel\ServiceProvider\Providers\Laravel4',
'Flasher\Toastr\Laravel\ServiceProvider\Providers\Laravel',
- 'Flasher\Toastr\Laravel\ServiceProvider\Providers\Lumen',
);
+ /**
+ * @var FlasherToastrServiceProvider
+ */
private $notifyServiceProvider;
+ /**
+ * @param FlasherToastrServiceProvider $notifyServiceProvider
+ */
public function __construct(FlasherToastrServiceProvider $notifyServiceProvider)
{
$this->notifyServiceProvider = $notifyServiceProvider;
@@ -28,15 +36,13 @@ final class ServiceProviderManager
public function boot()
{
$provider = $this->resolveServiceProvider();
-
- $provider->publishConfig($this->notifyServiceProvider);
- $provider->mergeConfigFromToastr();
+ $provider->boot($this->notifyServiceProvider);
}
public function register()
{
$provider = $this->resolveServiceProvider();
- $provider->registerToastrServices();
+ $provider->register($this->notifyServiceProvider);
}
/**
diff --git a/src/Toastr/Laravel/Tests/FlasherToastrServiceProviderTest.php b/src/Toastr/Laravel/Tests/FlasherToastrServiceProviderTest.php
index e8df0c5d..8303a83a 100644
--- a/src/Toastr/Laravel/Tests/FlasherToastrServiceProviderTest.php
+++ b/src/Toastr/Laravel/Tests/FlasherToastrServiceProviderTest.php
@@ -23,57 +23,55 @@ class FlasherToastrServiceProviderTest extends TestCase
$config = $this->app->make('flasher.config');
$expected = array(
- 'toastr' => array(
- 'scripts' => array(
- 'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js',
- 'https://cdnjs.cloudflare.com/ajax/libs/toastr.js/2.1.4/toastr.min.js',
- ),
- 'styles' => array(
- 'https://cdnjs.cloudflare.com/ajax/libs/toastr.js/2.1.4/toastr.min.css',
- ),
- 'options' => array(
- 'closeButton' => true,
- 'closeClass' => 'toast-close-button',
- 'closeDuration' => 300,
- 'closeEasing' => 'swing',
- 'closeHtml' => '',
- 'closeMethod' => 'fadeOut',
- 'closeOnHover' => true,
- 'containerId' => 'toast-container',
- 'debug' => false,
- 'escapeHtml' => false,
- 'extendedTimeOut' => 10000,
- 'hideDuration' => 1000,
- 'hideEasing' => 'linear',
- 'hideMethod' => 'fadeOut',
- 'iconClass' => 'toast-info',
- 'iconClasses' => array(
- 'error' => 'toast-error',
- 'info' => 'toast-info',
- 'success' => 'toast-success',
- 'warning' => 'toast-warning',
- ),
- 'messageClass' => 'toast-message',
- 'newestOnTop' => false,
- 'onHidden' => null,
- 'onShown' => null,
- 'positionClass' => 'toast-top-right',
- 'preventDuplicates' => false,
- 'progressBar' => true,
- 'progressClass' => 'toast-progress',
- 'rtl' => false,
- 'showDuration' => 300,
- 'showEasing' => 'swing',
- 'showMethod' => 'fadeIn',
- 'tapToDismiss' => true,
- 'target' => 'body',
- 'timeOut' => 5000,
- 'titleClass' => 'toast-title',
- 'toastClass' => 'toast',
+ 'scripts' => array(
+ 'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js',
+ 'https://cdnjs.cloudflare.com/ajax/libs/toastr.js/2.1.4/toastr.min.js',
+ ),
+ 'styles' => array(
+ 'https://cdnjs.cloudflare.com/ajax/libs/toastr.js/2.1.4/toastr.min.css',
+ ),
+ 'options' => array(
+ 'closeButton' => true,
+ 'closeClass' => 'toast-close-button',
+ 'closeDuration' => 300,
+ 'closeEasing' => 'swing',
+ 'closeHtml' => '',
+ 'closeMethod' => 'fadeOut',
+ 'closeOnHover' => true,
+ 'containerId' => 'toast-container',
+ 'debug' => false,
+ 'escapeHtml' => false,
+ 'extendedTimeOut' => 10000,
+ 'hideDuration' => 1000,
+ 'hideEasing' => 'linear',
+ 'hideMethod' => 'fadeOut',
+ 'iconClass' => 'toast-info',
+ 'iconClasses' => array(
+ 'error' => 'toast-error',
+ 'info' => 'toast-info',
+ 'success' => 'toast-success',
+ 'warning' => 'toast-warning',
),
+ 'messageClass' => 'toast-message',
+ 'newestOnTop' => false,
+ 'onHidden' => null,
+ 'onShown' => null,
+ 'positionClass' => 'toast-top-right',
+ 'preventDuplicates' => false,
+ 'progressBar' => true,
+ 'progressClass' => 'toast-progress',
+ 'rtl' => false,
+ 'showDuration' => 300,
+ 'showEasing' => 'swing',
+ 'showMethod' => 'fadeIn',
+ 'tapToDismiss' => true,
+ 'target' => 'body',
+ 'timeOut' => 5000,
+ 'titleClass' => 'toast-title',
+ 'toastClass' => 'toast',
),
);
- $this->assertEquals($expected, $config->get('adapters'));
+ $this->assertEquals($expected, $config->get('adapters.toastr'));
}
}