Passed
Push — master ( 0971b0...b7d7cf )
by Kirill
03:21
created

ArgumentDefinition   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 66.67%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 4
dl 26
loc 26
ccs 4
cts 6
cp 0.6667
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 6 6 1
A getType() 4 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
 * This file is part of Railt package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
declare(strict_types=1);
9
10
namespace Railt\Reflection\Definition\Dependent;
11
12
use Railt\Reflection\Contracts\Definition\Dependent\ArgumentDefinition as ArgumentDefinitionInterface;
13
use Railt\Reflection\Contracts\Definition\TypeDefinition;
14
use Railt\Reflection\Contracts\Type as TypeInterface;
15
use Railt\Reflection\Definition\Behaviour\HasDefaultValue;
16
use Railt\Reflection\Definition\Behaviour\HasTypeIndication;
17
use Railt\Reflection\Type;
18
19
/**
20
 * Class ArgumentDefinition
21
 */
22 View Code Duplication
class ArgumentDefinition extends AbstractDependentTypeDefinition implements ArgumentDefinitionInterface
0 ignored issues
show
Duplication introduced by
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...
23
{
24
    use HasTypeIndication;
25
    use HasDefaultValue;
26
27
    /**
28
     * ArgumentDefinition constructor.
29
     * @param TypeDefinition $parent
30
     * @param string $name
31
     * @param string $type
32
     */
33 9
    public function __construct(TypeDefinition $parent, string $name, string $type)
34
    {
35 9
        parent::__construct($parent, $name);
36
37 9
        $this->withTypeDefinition($type);
38 9
    }
39
40
    /**
41
     * @return TypeInterface
42
     */
43
    public static function getType(): TypeInterface
44
    {
45
        return Type::of(Type::ARGUMENT);
46
    }
47
}
48