GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

SymfonyContainerResolver   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 40.74 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 11
loc 27
c 0
b 0
f 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getRelationProvider() 11 11 2

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
namespace Hateoas\Configuration\Provider\Resolver;
4
5
use Hateoas\Configuration\RelationProvider as RelationProviderConfiguration;
6
use Symfony\Component\DependencyInjection\ContainerInterface;
7
8
/**
9
 * @author Adrien Brault <[email protected]>
10
 */
11
class SymfonyContainerResolver implements RelationProviderResolverInterface
12
{
13
    /**
14
     * @var ContainerInterface
15
     */
16
    private $container;
17
18
    public function __construct(ContainerInterface $container)
19
    {
20
        $this->container = $container;
21
    }
22
23
    /**
24
     * {@inheritdoc}
25
     */
26 View Code Duplication
    public function getRelationProvider(RelationProviderConfiguration $configuration, $object)
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...
27
    {
28
        if (!preg_match('/^(?P<service>[a-z0-9_.]+):(?P<method>[a-z0-9_]+)$/i', $configuration->getName(), $matches)) {
29
            return null;
30
        }
31
32
        return array(
33
            $this->container->get($matches['service']),
34
            $matches['method']
35
        );
36
    }
37
}
38