From 519953830c545bf972c95967803dd8cdca056235 Mon Sep 17 00:00:00 2001 From: Khoubza Younes Date: Sun, 6 Dec 2020 17:29:32 +0100 Subject: [PATCH] update namespaces --- DependencyInjection/Configuration.php | 4 ++-- ...yfExtension.php => FlasherNotyfExtension.php} | 12 +++++------- NotifyNotyfBundle.php => FlasherNotyfBundle.php | 2 +- Resources/config/config.yaml | 16 ++++++++++++++++ Resources/config/services.yaml | 16 ---------------- Tests/.gitkeep | 0 composer.json | 16 ++++++++-------- 7 files changed, 32 insertions(+), 34 deletions(-) rename DependencyInjection/{NotifyNotyfExtension.php => FlasherNotyfExtension.php} (72%) rename NotifyNotyfBundle.php => FlasherNotyfBundle.php (70%) create mode 100644 Resources/config/config.yaml delete mode 100644 Resources/config/services.yaml create mode 100644 Tests/.gitkeep diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index e2f5d9d7..6eab5cda 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -12,13 +12,13 @@ final class Configuration implements ConfigurationInterface */ public function getConfigTreeBuilder() { - $treeBuilder = new TreeBuilder('notify_notyf'); + $treeBuilder = new TreeBuilder('flasher_notyf'); if (\method_exists($treeBuilder, 'getRootNode')) { $rootNode = $treeBuilder->getRootNode(); } else { // BC layer for symfony/config 4.1 and older - $rootNode = $treeBuilder->root('notify_notyf'); + $rootNode = $treeBuilder->root('flasher_notyf'); } $rootNode diff --git a/DependencyInjection/NotifyNotyfExtension.php b/DependencyInjection/FlasherNotyfExtension.php similarity index 72% rename from DependencyInjection/NotifyNotyfExtension.php rename to DependencyInjection/FlasherNotyfExtension.php index 9e837371..1f6da0e6 100644 --- a/DependencyInjection/NotifyNotyfExtension.php +++ b/DependencyInjection/FlasherNotyfExtension.php @@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; use Symfony\Component\DependencyInjection\Loader; use Symfony\Component\HttpKernel\DependencyInjection\Extension; -final class NotifyNotyfExtension extends Extension implements PrependExtensionInterface +final class FlasherNotyfExtension extends Extension implements PrependExtensionInterface { /** * {@inheritdoc} @@ -18,7 +18,7 @@ final class NotifyNotyfExtension extends Extension implements PrependExtensionIn public function load(array $configs, ContainerBuilder $container) { $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); - $loader->load('services.yaml'); + $loader->load('config.yaml'); $configuration = new Configuration(); $this->processConfiguration($configuration, $configs); @@ -29,16 +29,14 @@ final class NotifyNotyfExtension extends Extension implements PrependExtensionIn */ public function prepend(ContainerBuilder $container) { - if (!$container->hasExtension('notify')) { - throw new \RuntimeException('[Flasher\SymfonyFlasher\PrimeBundle] is not registered'); + if (!$container->hasExtension('flasher')) { + throw new \RuntimeException('[Flasher\Symfony\FlasherBundle] is not registered'); } $configs = $container->getExtensionConfig($this->getAlias()); $config = $this->processConfiguration(new Configuration(), $configs); - $notifyConfig = $container->getExtensionConfig('notify'); - - $container->prependExtensionConfig('notify', array( + $container->prependExtensionConfig('flasher', array( 'adapters' => array( 'notyf' => $config, ), diff --git a/NotifyNotyfBundle.php b/FlasherNotyfBundle.php similarity index 70% rename from NotifyNotyfBundle.php rename to FlasherNotyfBundle.php index 0e907069..168d6335 100644 --- a/NotifyNotyfBundle.php +++ b/FlasherNotyfBundle.php @@ -4,6 +4,6 @@ namespace Flasher\Notyf\Symfony; use Symfony\Component\HttpKernel\Bundle\Bundle; -class NotifyNotyfBundle extends Bundle +class FlasherNotyfBundle extends Bundle { } diff --git a/Resources/config/config.yaml b/Resources/config/config.yaml new file mode 100644 index 00000000..95624abe --- /dev/null +++ b/Resources/config/config.yaml @@ -0,0 +1,16 @@ +services: + flasher.factory.notyf: + parent: 'flasher.abstract_factory' + class: Flasher\Notyf\Prime\NotyfProducer + tags: + - { name: 'flasher.factory' } + + flasher.renderer.notyf: + class: Flasher\Notyf\Prime\NotyfRenderer + arguments: + - '@flasher.config' + tags: + - { name: 'flasher.renderer' } + + Flasher\Notyf\Prime\NotyfProducer: '@flasher.factory.notyf' + Flasher\Notyf\Prime\NotyfRenderer: '@flasher.renderer.notyf' diff --git a/Resources/config/services.yaml b/Resources/config/services.yaml deleted file mode 100644 index 2ee52567..00000000 --- a/Resources/config/services.yaml +++ /dev/null @@ -1,16 +0,0 @@ -services: - flasher.factory.notyf: - parent: 'flasher.factory.abstract' - class: Flasher\Notyf\Prime\Factory\NotyfProducer - tags: - - { name: 'flasher.factory', alias: 'notyf' } - - flasher.renderer.notyf: - class: Flasher\Notyf\Prime\Renderer\NotyfRenderer - arguments: - - '@flasher.config' - tags: - - { name: 'flasher.renderer', alias: 'notyf' } - - Flasher\Notyf\Prime\Factory\NotyfProducer: '@flasher.factory.notyf' - Flasher\Notyf\Prime\Renderer\NotyfRenderer: '@flasher.renderer.notyf' diff --git a/Tests/.gitkeep b/Tests/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/composer.json b/composer.json index d4604617..3825bbaa 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "php-flasher/flasher-symfony-notyf", + "name": "php-flasher/flasher-notyf-symfony", "type": "symfony-bundle", "description": "Symfony Flasher adapter for Sweet Alert 2 library for php-flasher/flasher-symfony", "keywords": [ @@ -31,20 +31,20 @@ "license": "MIT", "require": { "php": ">=5.3", - "php-flasher/flasher-symfony": "^1.0", - "php-flasher/flasher-notyf": "^1.0" - }, - "require-dev": { - "phpunit/phpunit": "4.8.36" + "php-flasher/flasher-symfony": "dev-main", + "php-flasher/flasher-notyf": "dev-main" }, "autoload": { "psr-4": { - "Flasher\\Symfony\\Notyf\\": "src/" + "Flasher\\Notyf\\Symfony\\": "", + "exclude-from-classmap": [ + "/Tests/" + ] } }, "autoload-dev": { "psr-4": { - "Flasher\\Symfony\\Notyf\\Tests\\": "tests/" + "Flasher\\Notyf\\Symfony\\Tests\\": "Tests/" } }, "config": {