Completed
Push — master ( b64f8f...06557d )
by Tobias
02:24
created

FormTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 21
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A isFormType() 0 9 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 18
    private function isFormType(Node $node)
29
    {
30
        // only Traverse *Type
31 18
        if ($node instanceof Stmt\Class_) {
32 18
            $this->isFormType = 'Type' === substr($node->name, -4);
33
        }
34
35 18
        return $this->isFormType;
36
    }
37
}
38