diff --git a/Autoload/LegacyClassLoaderInterface.php b/Autoload/LegacyClassLoaderInterface.php index e1abae9..cf8ed69 100644 --- a/Autoload/LegacyClassLoaderInterface.php +++ b/Autoload/LegacyClassLoaderInterface.php @@ -11,6 +11,7 @@ */ interface LegacyClassLoaderInterface { + /** * Autoload the legacy code. * @@ -31,4 +32,5 @@ public function isAutoloaded(); * @param LegacyKernelInterface $kernel */ public function setKernel(LegacyKernelInterface $kernel); + } diff --git a/DependencyInjection/Compiler/KernelConfigurationPass.php b/DependencyInjection/Compiler/KernelConfigurationPass.php index bf1b598..05879af 100644 --- a/DependencyInjection/Compiler/KernelConfigurationPass.php +++ b/DependencyInjection/Compiler/KernelConfigurationPass.php @@ -16,7 +16,6 @@ class KernelConfigurationPass implements CompilerPassInterface { - /** * You can modify the container here before it is dumped to PHP code. * @@ -26,32 +25,31 @@ class KernelConfigurationPass implements CompilerPassInterface */ public function process(ContainerBuilder $container) { - $kernelId = $container->getParameter('legacy_bridge_bundle.legacy_kernel.id'); $kernelOptions = $container->getParameter('legacy_bridge_bundle.legacy_kernel.options'); $classLoaderId = $this->getClassLoaderId($container); $container->setAlias('legacy_bridge_bundle.legacy_kernel', $kernelId); - if (empty($kernelOptions) === false) { + if (empty($kernelOptions) === FALSE) { $definition = $container->findDefinition($kernelId); $definition->addMethodCall('setOptions', [$kernelOptions]); } - if ($classLoaderId !== null) { + if ($classLoaderId !== NULL) { $definition = $container->findDefinition($kernelId); $definition->addMethodCall('setClassLoader', [new Reference($classLoaderId)]); } - } - private function getClassLoaderId(ContainerBuilder $container) { + } + private function getClassLoaderId(ContainerBuilder $container) + { try { return $container->getParameter('legacy_bridge_bundle.legacy_kernel.class_loader.id'); } catch (\Exception $exception) { - return null; + return NULL; } }//end getClassLoaderId() - } diff --git a/DependencyInjection/Compiler/LoaderInjectorPass.php b/DependencyInjection/Compiler/LoaderInjectorPass.php index 01bef12..6878cd9 100644 --- a/DependencyInjection/Compiler/LoaderInjectorPass.php +++ b/DependencyInjection/Compiler/LoaderInjectorPass.php @@ -28,6 +28,7 @@ class LoaderInjectorPass implements CompilerPassInterface public function __construct(ClassLoader $loader) { $this->loader = $loader; + } /** @@ -40,6 +41,7 @@ public function process(ContainerBuilder $container) foreach ($taggedServices as $id => $attributes) { $container->getDefinition($id)->addMethodCall('setLoader', [new Reference('composer.loader')]); } + } } diff --git a/DependencyInjection/Compiler/ReplaceRouterPass.php b/DependencyInjection/Compiler/ReplaceRouterPass.php index a121e86..93feb8d 100644 --- a/DependencyInjection/Compiler/ReplaceRouterPass.php +++ b/DependencyInjection/Compiler/ReplaceRouterPass.php @@ -13,7 +13,6 @@ class ReplaceRouterPass implements CompilerPassInterface { - /** * Process container. * @@ -25,12 +24,11 @@ class ReplaceRouterPass implements CompilerPassInterface */ public function process(ContainerBuilder $container) { - // When our router service is defined we replace the default router listener. - if ($container->hasDefinition('legacy_bridge_bundle.router_listener') === true) { + if ($container->hasDefinition('legacy_bridge_bundle.router_listener') === TRUE) { // First get te default router_listener. $routerListener = $container->getDefinition('router_listener'); - + // Then get our custom route listener and inject the default route listener. $definition = $container->getDefinition('legacy_bridge_bundle.router_listener'); $definition->replaceArgument(0, $routerListener); @@ -41,5 +39,4 @@ public function process(ContainerBuilder $container) }//end process() - }//end class diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 6029e6a..52b2575 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -12,7 +12,6 @@ class Configuration implements ConfigurationInterface { - /** * {@inheritDoc} */ @@ -21,31 +20,7 @@ public function getConfigTreeBuilder() $treeBuilder = new TreeBuilder('legacy_bridge_bundle'); $rootNode = $treeBuilder->getRootNode(); - $rootNode - ->children() - ->scalarNode('root_dir') - ->info('The path where the legacy app lives') - ->isRequired() - ->end() - ->arrayNode('legacy_kernel') - ->children() - ->scalarNode('id') - ->info('The legacy kernel id') - ->isRequired() - ->end() - ->arrayNode('options') - ->children() - ->scalarNode('application') - ->info('The legacy application') - ->end() - ->scalarNode('environment') - ->info('The environment') - ->end() - ->booleanNode('debug') - ->info('Whether to enable debug') - ->end() - ->end() - ->end(); + $rootNode->children()->scalarNode('root_dir')->info('The path where the legacy app lives')->isRequired()->end()->arrayNode('legacy_kernel')->children()->scalarNode('id')->info('The legacy kernel id')->isRequired()->end()->arrayNode('options')->children()->scalarNode('application')->info('The legacy application')->end()->scalarNode('environment')->info('The environment')->end()->booleanNode('debug')->info('Whether to enable debug')->end()->end()->end(); return $treeBuilder; diff --git a/DependencyInjection/LegacyBridgeBundleExtension.php b/DependencyInjection/LegacyBridgeBundleExtension.php index d2eaf83..d25c59d 100644 --- a/DependencyInjection/LegacyBridgeBundleExtension.php +++ b/DependencyInjection/LegacyBridgeBundleExtension.php @@ -11,14 +11,12 @@ use Symfony\Component\DependencyInjection\Loader; use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; - /** * This is the class that loads and manages your bundle configuration */ class LegacyBridgeBundleExtension extends Extension { - /** * Loads a specific configuration. * @@ -31,18 +29,15 @@ class LegacyBridgeBundleExtension extends Extension */ public function load(array $configs, ContainerBuilder $container) { - $loader = new XmlFileLoader( $container, new FileLocator(__DIR__.'/../Resources/config') ); $loader->load('services.xml'); - // Register composer class loader. $container->register('composer.loader', 'Composer\Autoload\ClassLoader'); }//end load() - } diff --git a/Event/LegacyKernelBootEvent.php b/Event/LegacyKernelBootEvent.php index b397e35..09f37c8 100644 --- a/Event/LegacyKernelBootEvent.php +++ b/Event/LegacyKernelBootEvent.php @@ -15,6 +15,7 @@ */ class LegacyKernelBootEvent extends Event { + /** * @var Request */ @@ -33,6 +34,7 @@ public function __construct(Request $request, array $options = array()) { $this->request = $request; $this->options = $options; + } /** @@ -41,6 +43,7 @@ public function __construct(Request $request, array $options = array()) public function getRequest() { return $this->request; + } /** @@ -49,6 +52,7 @@ public function getRequest() public function getOptions() { return $this->options; + } /** @@ -57,6 +61,7 @@ public function getOptions() public function setOptions($options) { $this->options = $options; + } /** @@ -66,6 +71,7 @@ public function setOptions($options) public function setOption($name, $value) { $this->options[$name] = $value; + } } diff --git a/Kernel/LegacyKernel.php b/Kernel/LegacyKernel.php index cacbcff..022286f 100644 --- a/Kernel/LegacyKernel.php +++ b/Kernel/LegacyKernel.php @@ -11,10 +11,11 @@ */ abstract class LegacyKernel implements LegacyKernelInterface { + /** * @var bool */ - protected $isBooted = false; + protected $isBooted = FALSE; /** * @var string @@ -37,6 +38,7 @@ abstract class LegacyKernel implements LegacyKernelInterface public function isBooted() { return $this->isBooted; + } /** @@ -45,6 +47,7 @@ public function isBooted() public function getRootDir() { return $this->rootDir; + } /** @@ -53,6 +56,7 @@ public function getRootDir() public function setRootDir($rootDir) { $this->rootDir = $rootDir; + } /** @@ -62,6 +66,7 @@ public function setClassLoader(LegacyClassLoaderInterface $classLoader) { $classLoader->setKernel($this); $this->classLoader = $classLoader; + } /** @@ -70,5 +75,7 @@ public function setClassLoader(LegacyClassLoaderInterface $classLoader) public function setOptions(array $options = array()) { $this->options = $options; + } + } diff --git a/Kernel/LegacyKernelInterface.php b/Kernel/LegacyKernelInterface.php index 69f62c7..7d67b54 100644 --- a/Kernel/LegacyKernelInterface.php +++ b/Kernel/LegacyKernelInterface.php @@ -17,7 +17,6 @@ interface LegacyKernelInterface extends HttpKernelInterface { - /** * Boot the legacy kernel. * @@ -29,7 +28,6 @@ interface LegacyKernelInterface extends HttpKernelInterface */ public function boot(ContainerInterface $container); - /** * Check whether the legacy kernel is already booted or not. * @@ -37,7 +35,6 @@ public function boot(ContainerInterface $container); */ public function isBooted(); - /** * Return the directory where the legacy app lives. * @@ -45,7 +42,6 @@ public function isBooted(); */ public function getRootDir(); - /** * Set the directory where the legacy app lives. * @@ -53,7 +49,6 @@ public function getRootDir(); */ public function setRootDir($rootDir); - /** * Set the class loader to use to load the legacy project. * @@ -61,7 +56,6 @@ public function setRootDir($rootDir); */ public function setClassLoader(LegacyClassLoaderInterface $classLoader); - /** * Return the name of the kernel. * @@ -69,7 +63,6 @@ public function setClassLoader(LegacyClassLoaderInterface $classLoader); */ public function getName(); - /** * Set kernel options * @@ -77,5 +70,4 @@ public function getName(); */ public function setOptions(array $options=[]); - }//end interface diff --git a/LegacyBridgeBundle.php b/LegacyBridgeBundle.php index f4e678a..3af38a3 100644 --- a/LegacyBridgeBundle.php +++ b/LegacyBridgeBundle.php @@ -28,9 +28,10 @@ class LegacyBridgeBundle extends Bundle /** * @param ClassLoader $loader */ - public function __construct(ClassLoader $loader = null) + public function __construct(ClassLoader $loader = NULL) { $this->loader = $loader; + } /** @@ -39,16 +40,19 @@ public function __construct(ClassLoader $loader = null) public function build(ContainerBuilder $container) { // The loader can be null when clearing the cache. - if (null !== $this->loader) { + if (NULL !== $this->loader) { $container->addCompilerPass(new LoaderInjectorPass($this->loader)); } $container->addCompilerPass(new KernelConfigurationPass()); $container->addCompilerPass(new ReplaceRouterPass()); + } public function getContainerExtension() { return new LegacyBridgeBundleExtension(); + } + } diff --git a/phpcs.xml b/phpcs.xml index e8faa98..2008356 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -1,157 +1,108 @@ - - + + - Ruleset for PHPCS analysis of the application. - - - / - tests - - - - - - - - - error + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - - - - - - - - - - - - - - + - - + + - - - + + + + + + - + + - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + - - - - - - - + - - - - error - - - - - error - - - - - tests/bootstrap.php - + + + + + + + + + +