Completed
Push — master ( 010fb4...bcd1e3 )
by David
02:17
created

ConfiguredClientsStrategyListener   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 30.43 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 7
loc 23
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A onEvent() 0 4 1
A getSubscribedEvents() 7 7 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
declare(strict_types=1);
4
5
namespace Http\HttplugBundle\Discovery;
6
7
use Http\Discovery\HttpClientDiscovery;
8
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
9
10
/**
11
 * @author Wouter de Jong <[email protected]>
12
 */
13
class ConfiguredClientsStrategyListener implements EventSubscriberInterface
14
{
15
    /**
16
     * Make sure to use the custom strategy.
17
     */
18 14
    public function onEvent()
19
    {
20 14
        HttpClientDiscovery::prependStrategy(ConfiguredClientsStrategy::class);
21 14
    }
22
23
    /**
24
     * Whenever these events occur we make sure to add the custom strategy to the discovery.
25
     *
26
     * {@inheritdoc}
27
     */
28 5 View Code Duplication
    public static function getSubscribedEvents()
0 ignored issues
show
Duplication introduced by
This method 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...
29
    {
30
        return [
31 5
            'kernel.request' => ['onEvent', 1024],
32
            'console.command' => ['onEvent', 1024],
33
        ];
34
    }
35
}
36