ValueNodeParser   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 14
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A invoke() 0 4 3
1
<?php
2
3
/**
4
 * This file is part of PhpUnitGen.
5
 *
6
 * (c) 2017-2018 Paul Thébaud <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE.md
9
 * file that was distributed with this source code.
10
 */
11
12
namespace PhpUnitGen\Parser\NodeParser;
13
14
use PhpParser\Node;
15
use PhpUnitGen\Exception\Exception;
16
use PhpUnitGen\Model\PropertyInterface\NodeInterface;
17
use PhpUnitGen\Model\PropertyInterface\VariableLikeInterface;
18
19
/**
20
 * Class ValueNodeParser.
21
 *
22
 * @author     Paul Thébaud <[email protected]>.
23
 * @copyright  2017-2018 Paul Thébaud <[email protected]>.
24
 * @license    https://opensource.org/licenses/MIT The MIT license.
25
 * @link       https://github.com/paul-thebaud/phpunit-generator
26
 * @since      Class available since Release 2.0.0.
27
 */
28
class ValueNodeParser extends AbstractNodeParser
29
{
30
    /**
31
     * Parse a node to update the parent node model.
32
     *
33
     * @param mixed         $node   The node to parse.
34
     * @param NodeInterface $parent The parent node.
35
     *
36
     * This method do nothing because parsing expr is hard and useless for PhpUnitGen.
37
     */
38
    public function invoke($node, NodeInterface $parent): void
39
    {
40
        if (! $node instanceof Node\Expr || ! $parent instanceof VariableLikeInterface) {
41
            throw new Exception('ValueNodeParser is made to parse a expression node');
42
        }
43
    }
44
}
45