Completed
Push — develop ( e382f7...b48d9b )
by Paul
02:10
created

DocumentationNodeParser::invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace PhpUnitGen\Parser\NodeParser;
4
5
use PhpParser\Comment\Doc;
6
use PhpUnitGen\Model\ModelInterface\FunctionModelInterface;
7
8
/**
9
 * Class DocumentationNodeParser.
10
 *
11
 * @author     Paul Thébaud <[email protected]>.
12
 * @copyright  2017-2018 Paul Thébaud <[email protected]>.
13
 * @license    https://opensource.org/licenses/MIT The MIT license.
14
 * @link       https://github.com/paul-thebaud/phpunit-generator
15
 * @since      Class available since Release 2.0.0.
16
 */
17
class DocumentationNodeParser
18
{
19
    /**
20
     * Parse a node to update the parent node model.
21
     *
22
     * @param Doc                    $node   The node to parse.
23
     * @param FunctionModelInterface $parent The parent node.
24
     *
25
     * @return FunctionModelInterface The updated parent.
26
     */
27
    public function invoke(Doc $node, FunctionModelInterface $parent): FunctionModelInterface
28
    {
29
        $parent->setDocumentation($node->getText());
30
        return $parent;
31
    }
32
}
33