Completed
Push — master ( 550011...0647fd )
by Théo
16:20 queued 07:57
created

NamedIdentifier   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 17
ccs 0
cts 10
cp 0
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 7 1
A getOriginalNode() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the humbug/php-scoper package.
7
 *
8
 * Copyright (c) 2017 Théo FIDRY <[email protected]>,
9
 *                    Pádraic Brady <[email protected]>
10
 *
11
 * For the full copyright and license information, please view the LICENSE
12
 * file that was distributed with this source code.
13
 */
14
15
namespace Humbug\PhpScoper\PhpParser\Node;
16
17
use PhpParser\Node\Identifier;
18
use PhpParser\Node\Name;
19
20
/**
21
 * Small wrapper to treat an identifier as a name node.
22
 */
23
final class NamedIdentifier extends Name
24
{
25
    private $originalNode;
26
27
    public static function create(Identifier $node): self
28
    {
29
        $instance = new self($node->name, $node->getAttributes());
30
        $instance->originalNode = $node;
31
32
        return $instance;
33
    }
34
35
    public function getOriginalNode(): Identifier
36
    {
37
        return $this->originalNode;
38
    }
39
}
40