Directive   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 29
Duplicated Lines 31.03 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 63.64%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 3
dl 9
loc 29
ccs 7
cts 11
cp 0.6364
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 9 9 2
A build() 0 4 1
A addArguments() 0 4 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
 * Date: 3/17/17
4
 *
5
 * @author Volodymyr Rashchepkin <[email protected]>
6
 */
7
8
namespace Youshido\GraphQL\Directive;
9
10
use Youshido\GraphQL\Config\Directive\DirectiveConfig;
11
use Youshido\GraphQL\Type\Traits\ArgumentsAwareObjectTrait;
12
use Youshido\GraphQL\Type\Traits\AutoNameTrait;
13
14
class Directive implements DirectiveInterface
15
{
16
17
    use ArgumentsAwareObjectTrait;
0 ignored issues
show
Deprecated Code introduced by
The trait Youshido\GraphQL\Type\Tr...gumentsAwareObjectTrait has been deprecated with message: To be removed during the release optimization

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...
18
    use AutoNameTrait;
19
20
    protected $isFinal = false;
21
22 3 View Code Duplication
    public function __construct(array $config = [])
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...
23
    {
24 3
        if (empty($config['name'])) {
25
            $config['name'] = $this->getName();
26
        }
27
28 3
        $this->config = new DirectiveConfig($config, $this, $this->isFinal);
29 3
        $this->build($this->config);
30 3
    }
31
32 3
    public function build(DirectiveConfig $config)
0 ignored issues
show
Unused Code introduced by
The parameter $config is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
33
    {
34
35 3
    }
36
37
    public function addArguments($argumentsList)
38
    {
39
        return $this->getConfig()->addArguments($argumentsList);
40
    }
41
42
}
43