From ed2b4a3178b595d57388a5947b71a91108997070 Mon Sep 17 00:00:00 2001 From: Olivier MELLINGER <parktrip@gmail.com> Date: Mon, 6 Feb 2017 09:05:04 +0100 Subject: [PATCH 1/7] Remove configuration in getServiceConfig() --- Module.php | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/Module.php b/Module.php index 1c183bf..790fd61 100755 --- a/Module.php +++ b/Module.php @@ -12,8 +12,7 @@ class Module implements AutoloaderProviderInterface, ConfigProviderInterface, - BootstrapListenerInterface, - ServiceProviderInterface + BootstrapListenerInterface { /** * Listen to the bootstrap event @@ -43,25 +42,6 @@ public function getConfig() return require __DIR__ . '/configs/module.config.php'; } - /** - * Expected to return \Zend\ServiceManager\Config object or array to - * seed such an object. - * - * @return array|\Zend\ServiceManager\Config - */ - public function getServiceConfig() - { - return [ - 'factories' => [ - 'AsseticBundle\Configuration' => function (ServiceLocatorInterface $serviceLocator) { - $configuration = $serviceLocator->get('Configuration'); - - return new Configuration($configuration['assetic_configuration']); - } - ], - ]; - } - /** * Return an array for passing to Zend\Loader\AutoloaderFactory. * From c2431998d943df1851cb8423a3da1c37e4389330 Mon Sep 17 00:00:00 2001 From: Olivier MELLINGER <parktrip@gmail.com> Date: Mon, 6 Feb 2017 09:06:52 +0100 Subject: [PATCH 2/7] Add factory configuration line in module.config.php --- configs/module.config.php | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/module.config.php b/configs/module.config.php index 99ee8f1..afea7f7 100644 --- a/configs/module.config.php +++ b/configs/module.config.php @@ -16,6 +16,7 @@ 'Assetic\AssetManager' => 'Zend\ServiceManager\Factory\InvokableFactory', 'AsseticBundle\Listener' => 'Zend\ServiceManager\Factory\InvokableFactory', 'AsseticBundle\Cli' => 'AsseticBundle\Cli\ApplicationFactory', + 'AsseticBundle\Configuration' => 'AsseticBundle\Factory\ConfigurationFactory', ], ], From 7e41101b9e32c5120d10c081b70ab00a5ee20e9f Mon Sep 17 00:00:00 2001 From: Olivier MELLINGER <parktrip@gmail.com> Date: Mon, 6 Feb 2017 09:08:13 +0100 Subject: [PATCH 3/7] Create Configuration factory --- .../Factory/ConfigurationFactory.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/AsseticBundle/Factory/ConfigurationFactory.php diff --git a/src/AsseticBundle/Factory/ConfigurationFactory.php b/src/AsseticBundle/Factory/ConfigurationFactory.php new file mode 100644 index 0000000..e744eb5 --- /dev/null +++ b/src/AsseticBundle/Factory/ConfigurationFactory.php @@ -0,0 +1,15 @@ +<?php +namespace AsseticBundle\Factory; + +use AsseticBundle\Configuration; +use Interop\Container\ContainerInterface; +use Zend\ServiceManager\Factory\FactoryInterface; + +class ConfigurationFactory implements FactoryInterface +{ + public function __invoke(ContainerInterface $container, $requestedName, array $options = null) + { + $configuration = $container->get('Configuration'); + return new Configuration($configuration['assetic_configuration']); + } +} From 681999dd05704359a4387eaf2ccd0b689b51cd5d Mon Sep 17 00:00:00 2001 From: Olivier MELLINGER <parktrip@gmail.com> Date: Mon, 6 Feb 2017 14:15:13 +0100 Subject: [PATCH 4/7] Remove useless 'use' statement --- Module.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/Module.php b/Module.php index 790fd61..fbbd163 100755 --- a/Module.php +++ b/Module.php @@ -6,8 +6,6 @@ use Zend\ModuleManager\Feature\AutoloaderProviderInterface; use Zend\ModuleManager\Feature\BootstrapListenerInterface; use Zend\ModuleManager\Feature\ConfigProviderInterface; -use Zend\ModuleManager\Feature\ServiceProviderInterface; -use Zend\ServiceManager\ServiceLocatorInterface; class Module implements AutoloaderProviderInterface, From 4fe9ddc1177f00d9efc11d83cf6d5c6b121984e8 Mon Sep 17 00:00:00 2001 From: Olivier MELLINGER <parktrip@gmail.com> Date: Mon, 6 Feb 2017 14:15:47 +0100 Subject: [PATCH 5/7] add space (cs-fixer) --- src/AsseticBundle/Factory/ConfigurationFactory.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/AsseticBundle/Factory/ConfigurationFactory.php b/src/AsseticBundle/Factory/ConfigurationFactory.php index e744eb5..010fcfc 100644 --- a/src/AsseticBundle/Factory/ConfigurationFactory.php +++ b/src/AsseticBundle/Factory/ConfigurationFactory.php @@ -10,6 +10,7 @@ class ConfigurationFactory implements FactoryInterface public function __invoke(ContainerInterface $container, $requestedName, array $options = null) { $configuration = $container->get('Configuration'); + return new Configuration($configuration['assetic_configuration']); } } From 6f745072102071c13825875a4a116c5958057400 Mon Sep 17 00:00:00 2001 From: Olivier MELLINGER <parktrip@gmail.com> Date: Mon, 6 Feb 2017 14:22:05 +0100 Subject: [PATCH 6/7] Update ConfigurationFactory.php --- src/AsseticBundle/Factory/ConfigurationFactory.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/AsseticBundle/Factory/ConfigurationFactory.php b/src/AsseticBundle/Factory/ConfigurationFactory.php index 010fcfc..e744eb5 100644 --- a/src/AsseticBundle/Factory/ConfigurationFactory.php +++ b/src/AsseticBundle/Factory/ConfigurationFactory.php @@ -10,7 +10,6 @@ class ConfigurationFactory implements FactoryInterface public function __invoke(ContainerInterface $container, $requestedName, array $options = null) { $configuration = $container->get('Configuration'); - return new Configuration($configuration['assetic_configuration']); } } From e84ee34a3eedc6d2c42d7ae2d13ef75f9fd9a0ff Mon Sep 17 00:00:00 2001 From: MELLINGER Olivier <olivier.mellinger@ext.ec.europa.eu> Date: Mon, 6 Feb 2017 15:01:43 +0100 Subject: [PATCH 7/7] trying to fix cs --- src/AsseticBundle/Factory/ConfigurationFactory.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/AsseticBundle/Factory/ConfigurationFactory.php b/src/AsseticBundle/Factory/ConfigurationFactory.php index e744eb5..12bf4bd 100644 --- a/src/AsseticBundle/Factory/ConfigurationFactory.php +++ b/src/AsseticBundle/Factory/ConfigurationFactory.php @@ -1,4 +1,5 @@ <?php + namespace AsseticBundle\Factory; use AsseticBundle\Configuration; @@ -10,6 +11,7 @@ class ConfigurationFactory implements FactoryInterface public function __invoke(ContainerInterface $container, $requestedName, array $options = null) { $configuration = $container->get('Configuration'); + return new Configuration($configuration['assetic_configuration']); } }