Test Failed
Push — master ( 6bac61...6350a6 )
by Kirill
03:02
created

DependentTypeDefinitionNode   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
dl 19
loc 19
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A getOffset() 10 10 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
 * 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\SDL\Frontend\AST\Dependent;
11
12
use Railt\Parser\Ast\Rule;
13
use Railt\Parser\Ast\RuleInterface;
14
use Railt\SDL\Frontend\AST\ProvidesType;
15
use Railt\SDL\Frontend\AST\ProvidesDescription;
16
use Railt\SDL\Frontend\AST\ProvidesName;
17
use Railt\SDL\Frontend\AST\Support\DependentNameProvider;
18
use Railt\SDL\Frontend\AST\Support\DescriptionProvider;
19
20
/**
21
 * Class DependentTypeDefinitionNode
22
 */
23 View Code Duplication
abstract class DependentTypeDefinitionNode extends Rule implements ProvidesName, ProvidesDescription, ProvidesType
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...
24
{
25
    use DependentNameProvider;
26
    use DescriptionProvider;
27
28
    /**
29
     * @return int
30
     */
31
    public function getOffset(): int
32
    {
33
        $node = $this->getNameNode();
34
35
        if ($node instanceof RuleInterface) {
36
            return $node->getOffset();
37
        }
38
39
        return parent::getOffset();
40
    }
41
}
42