Completed
Push — master ( c1a156...8cadde )
by Kirill
08:14
created

TypeDefinitionNode::getOffset()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10

Duplication

Lines 10
Ratio 100 %

Code Coverage

Tests 4
CRAP Score 2.032

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 0
dl 10
loc 10
ccs 4
cts 5
cp 0.8
crap 2.032
rs 9.9332
c 0
b 0
f 0
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\Ast\Definition;
11
12
use Railt\Parser\Ast\Rule;
13
use Railt\Parser\Ast\RuleInterface;
14
use Railt\SDL\Ast\ProvidesDefinition;
15
use Railt\SDL\Ast\ProvidesDescription;
16
use Railt\SDL\Ast\ProvidesDirectiveNodes;
17
use Railt\SDL\Ast\ProvidesName;
18
use Railt\SDL\Ast\Support\DescriptionProvider;
19
use Railt\SDL\Ast\Support\DirectivesProvider;
20
use Railt\SDL\Ast\Support\TypeNameProvider;
21
22
/**
23
 * Class TypeDefinitionNode
24
 */
25 View Code Duplication
abstract class TypeDefinitionNode extends Rule implements
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...
26
    ProvidesName,
27
    ProvidesDefinition,
28
    ProvidesDescription,
29
    ProvidesDirectiveNodes
30
{
31
    use TypeNameProvider;
32
    use DirectivesProvider;
33
    use DescriptionProvider;
34
35
    /**
36
     * @return int
37
     */
38 119
    public function getOffset(): int
39
    {
40 119
        $node = $this->getTypeNameNode();
41
42 119
        if ($node instanceof RuleInterface) {
43 119
            return $node->getOffset();
44
        }
45
46
        return parent::getOffset();
47
    }
48
}
49