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

NamedIdentifier::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 7
ccs 0
cts 6
cp 0
crap 2
rs 10
c 0
b 0
f 0
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