Completed
Pull Request — master (#2)
by Colin
04:54
created
src/DependencyInjection/Compiler/CommonMarkExtensionPass.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,16 +19,16 @@
 block discarded – undo
19 19
 {
20 20
     public function process(ContainerBuilder $container)
21 21
     {
22
-        $extensions = [];
22
+        $extensions = [ ];
23 23
         foreach ($container->findTaggedServiceIds('webuni_commonmark.extension') as $id => $tag) {
24
-            $alias = isset($tag[0]['alias']) ? $tag[0]['alias'] : $id;
25
-            $extensions[$alias] = $id;
24
+            $alias = isset($tag[ 0 ][ 'alias' ]) ? $tag[ 0 ][ 'alias' ] : $id;
25
+            $extensions[ $alias ] = $id;
26 26
         }
27 27
 
28 28
         if ($container->hasDefinition('webuni_commonmark.default_environment')) {
29 29
             $definition = $container->getDefinition('webuni_commonmark.default_environment');
30 30
             foreach ($extensions as $alias => $id) {
31
-                $definition->addMethodCall('addExtension', [new Reference($id)]);
31
+                $definition->addMethodCall('addExtension', [ new Reference($id) ]);
32 32
             }
33 33
         }
34 34
 
Please login to merge, or discard this patch.
src/DependencyInjection/Configuration.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -32,18 +32,18 @@  discard block
 block discarded – undo
32 32
                     ->end()
33 33
                 ->end()
34 34
                 ->arrayNode('converters')
35
-                    ->defaultValue(['default' => [
35
+                    ->defaultValue([ 'default' => [
36 36
                         'converter'   => 'webuni_commonmark.converter',
37 37
                         'environment' => 'webuni_commonmark.default_environment',
38 38
                         'parser'      => 'webuni_commonmark.docparser',
39 39
                         'renderer'    => 'webuni_commonmark.htmlrenderer',
40
-                        'config'      => [],
41
-                        'extensions'  => [],
42
-                    ]])
40
+                        'config'      => [ ],
41
+                        'extensions'  => [ ],
42
+                    ] ])
43 43
                     ->beforeNormalization()
44 44
                         ->always()
45
-                        ->then(function ($v) {
46
-                            return array_merge(['default' => null], $v);
45
+                        ->then(function($v) {
46
+                            return array_merge([ 'default' => null ], $v);
47 47
                         })
48 48
                     ->end()
49 49
                     ->prototype('array')
@@ -55,11 +55,11 @@  discard block
 block discarded – undo
55 55
                             ->scalarNode('renderer')->defaultValue('webuni_commonmark.htmlrenderer')->end()
56 56
                             ->arrayNode('config')
57 57
                                 ->prototype('variable')
58
-                                    ->defaultValue([])
58
+                                    ->defaultValue([ ])
59 59
                                 ->end()
60 60
                             ->end()
61 61
                             ->arrayNode('extensions')
62
-                                ->defaultValue([])
62
+                                ->defaultValue([ ])
63 63
                                 ->prototype('scalar')->end()
64 64
                             ->end()
65 65
                         ->end()
Please login to merge, or discard this patch.
src/ConverterRegistry.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -20,18 +20,18 @@
 block discarded – undo
20 20
      *
21 21
      * @param Converter[] $converters
22 22
      */
23
-    public function __construct(array $converters = [])
23
+    public function __construct(array $converters = [ ])
24 24
     {
25 25
         $this->converters = $converters;
26 26
     }
27 27
 
28 28
     public function has($name)
29 29
     {
30
-        return isset($this->converters[$name]);
30
+        return isset($this->converters[ $name ]);
31 31
     }
32 32
 
33 33
     public function get($name)
34 34
     {
35
-        return $this->converters[$name];
35
+        return $this->converters[ $name ];
36 36
     }
37 37
 }
Please login to merge, or discard this patch.
src/DependencyInjection/WebuniCommonMarkExtension.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -27,17 +27,17 @@  discard block
 block discarded – undo
27 27
         $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
28 28
         $loader->load('services.xml');
29 29
 
30
-        if ($mergedConfig['extensions']['attributes'] && class_exists(AttributesExtension::class)) {
30
+        if ($mergedConfig[ 'extensions' ][ 'attributes' ] && class_exists(AttributesExtension::class)) {
31 31
             $loader->load('extensions/attributes.xml');
32 32
         }
33 33
 
34
-        if ($mergedConfig['extensions']['table'] && class_exists(TableExtension::class)) {
34
+        if ($mergedConfig[ 'extensions' ][ 'table' ] && class_exists(TableExtension::class)) {
35 35
             $loader->load('extensions/table.xml');
36 36
         }
37 37
 
38
-        $converters = [];
39
-        foreach ($mergedConfig['converters'] as $name => $config) {
40
-            $converters[$name] = new Reference($this->createConverter($name, $config, $container));
38
+        $converters = [ ];
39
+        foreach ($mergedConfig[ 'converters' ] as $name => $config) {
40
+            $converters[ $name ] = new Reference($this->createConverter($name, $config, $container));
41 41
         }
42 42
 
43 43
         $registry = $container->getDefinition('webuni_commonmark.converter_registry');
@@ -51,24 +51,24 @@  discard block
 block discarded – undo
51 51
 
52 52
     private function createConverter($name, array $config, ContainerBuilder $container)
53 53
     {
54
-        $environment = new DefinitionDecorator($config['environment']);
54
+        $environment = new DefinitionDecorator($config[ 'environment' ]);
55 55
         $environment->setPublic(false);
56
-        $environment->addMethodCall('mergeConfig', [$config['config']]);
57
-        $environment->addTag('webuni_commonmark.environment.extensions', $config['extensions']);
56
+        $environment->addMethodCall('mergeConfig', [ $config[ 'config' ] ]);
57
+        $environment->addTag('webuni_commonmark.environment.extensions', $config[ 'extensions' ]);
58 58
         // $environment->addTag('webuni_commonmark.environment', ['parent' => $config['environment'], 'extensions' => [$config['extensions']]);
59 59
 
60
-        $environmentName = 'webuni_commonmark.'.$name.'_environment'.$config['environment'];
60
+        $environmentName = 'webuni_commonmark.'.$name.'_environment'.$config[ 'environment' ];
61 61
         $container->setDefinition($environmentName, $environment);
62 62
 
63
-        $parser = new DefinitionDecorator($config['parser']);
63
+        $parser = new DefinitionDecorator($config[ 'parser' ]);
64 64
         $parser->setPublic(false);
65 65
         $parser->replaceArgument(0, new Reference($environmentName));
66 66
 
67
-        $renderer = new DefinitionDecorator($config['renderer']);
67
+        $renderer = new DefinitionDecorator($config[ 'renderer' ]);
68 68
         $renderer->setPublic(false);
69 69
         $renderer->replaceArgument(0, new Reference($environmentName));
70 70
 
71
-        $converter = new DefinitionDecorator($config['converter']);
71
+        $converter = new DefinitionDecorator($config[ 'converter' ]);
72 72
         $converter->setPublic(true);
73 73
         $converter->replaceArgument(0, $parser);
74 74
         $converter->replaceArgument(1, $renderer);
Please login to merge, or discard this patch.