FormTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
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 17
c 0
b 0
f 0
ccs 4
cts 4
cp 1
rs 10

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 24
    private function isFormType(Node $node): bool
25
    {
26
        // only Traverse *Type
27 24
        if ($node instanceof Stmt\Class_) {
28 24
            $this->isFormType = 'Type' === substr($node->name, -4);
29
        }
30
31 24
        return $this->isFormType;
32
    }
33
}
34