NamedIdentifier   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 6
c 2
b 0
f 0
dl 0
loc 15
ccs 6
cts 6
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getOriginalNode() 0 3 1
A create() 0 6 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 Identifier $originalNode;
26
27 299
    public static function create(Identifier $node): self
28
    {
29 299
        $instance = new self($node->name, $node->getAttributes());
30 299
        $instance->originalNode = $node;
31
32 299
        return $instance;
33
    }
34
35 292
    public function getOriginalNode(): Identifier
36
    {
37 292
        return $this->originalNode;
38
    }
39
}
40