Completed
Push — master ( 261a9c...7019d5 )
by Tobias
05:31
created

FormTrait::isKnownNode()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 6
cts 6
cp 1
rs 9.9332
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 2
1
<?php
2
3
/*
4
 * This file is part of the PHP Translation package.
5
 *
6
 * (c) PHP Translation team <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Translation\Extractor\Visitor\Php\Symfony;
13
14
use PhpParser\Node;
15
use PhpParser\Node\Stmt;
16
17
trait FormTrait
18
{
19
    private $isFormType = false;
20
21
    /**
22
     * Check if this node is a form type.
23
     *
24
     * @param Node $node
25
     *
26
     * @return bool
27
     */
28 21
    private function isFormType(Node $node)
29
    {
30
        // only Traverse *Type
31 21
        if ($node instanceof Stmt\Class_) {
32 21
            $this->isFormType = 'Type' === substr($node->name, -4);
33
        }
34
35 21
        return $this->isFormType;
36
    }
37
}
38