Completed
Push — master ( 6ee4e9...166b13 )
by dan
02:00
created

Factory/Channel/SlackBroadcasterFactory.php (5 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace IrishDan\NotificationBundle\DependencyInjection\Factory\Broadcaster;
4
5
use IrishDan\NotificationBundle\DependencyInjection\Factory\BroadcasterFactoryInterface;
6
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
7
use Symfony\Component\DependencyInjection\ContainerBuilder;
8
use Symfony\Component\DependencyInjection\DefinitionDecorator;
9
use Symfony\Component\DependencyInjection\Reference;
10
11 View Code Duplication
class SlackBroadcasterFactory implements BroadcasterFactoryInterface
0 ignored issues
show
Comprehensibility Best Practice introduced by
The type IrishDan\NotificationBun...SlackBroadcasterFactory has been defined more than once; this definition is ignored, only the first definition in DependencyInjection/Fact...kBroadcasterFactory.php (L11-38) is considered.

This check looks for classes that have been defined more than once.

If you can, we would recommend to use standard object-oriented programming techniques. For example, to avoid multiple types, it might make sense to create a common interface, and then multiple, different implementations for that interface.

This also has the side-effect of providing you with better IDE auto-completion, static analysis and also better OPCode caching from PHP.

Loading history...
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
12
{
13
    public function getKey()
14
    {
15
        return 'slack';
16
    }
17
18
    public function create(ContainerBuilder $container, $id, array $config)
19
    {
20
        $container
21
            ->setDefinition($id, new DefinitionDecorator('notification.broadcaster.slack'))
0 ignored issues
show
Deprecated Code introduced by
The class Symfony\Component\Depend...ion\DefinitionDecorator has been deprecated with message: The DefinitionDecorator class is deprecated since version 3.3 and will be removed in 4.0. Use the Symfony\Component\DependencyInjection\ChildDefinition class instead.

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
22
            ->replaceArgument(0, new Reference(sprintf('notification.%s_adapter', $config['adapter'])))
23
            // ->replaceArgument(1, $config['key'])
0 ignored issues
show
Unused Code Comprehensibility introduced by
75% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
24
            // ->replaceArgument(2, $config['expires'])
0 ignored issues
show
Unused Code Comprehensibility introduced by
75% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
25
        ;
26
    }
27
28
    public function addConfiguration(NodeDefinition $node)
29
    {
30
        // $node
31
        //     ->children()
32
        //         // ->scalarNode('adapter')->isRequired()->end()
33
        //         // ->scalarNode('key')->defaultValue('flysystem')->end()
34
        //         // ->scalarNode('expires')->defaultNull()->end()
35
        //     ->end()
36
        // ;
37
    }
38
}
39