AbstractEntityRule   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 4
c 1
b 1
f 0
lcom 0
cbo 1
dl 0
loc 26
ccs 9
cts 9
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A isEntity() 0 18 4
1
<?php
2
3
namespace MS\PHPMD\Rule\Symfony2;
4
5
use PDepend\Source\AST\ASTClass;
6
use PHPMD\AbstractRule;
7
use PHPMD\Node\ClassNode;
8
use PHPMD\Rule\ClassAware;
9
10
/**
11
 * Class AbstractEntityRule
12
 *
13
 * @package MS\PHPMD\Rule\Symfony2
14
 */
15
abstract class AbstractEntityRule extends AbstractRule implements ClassAware
16
{
17
    /**
18
     * @param ClassNode|ASTClass $node
19
     *
20
     * @return bool
21
     */
22 11
    protected function isEntity(ClassNode $node)
23
    {
24 11
        $docComment = $node->getDocComment();
25
26 11
        if (0 < preg_match($this->getStringProperty('classIsEntityRegex'), $docComment)) {
27 2
            return true;
28
        }
29
30 9
        if (true === $node->isAbstract()) {
31 1
            return false;
32
        }
33
34 8
        if (0 < preg_match($this->getStringProperty('entityRegex'), $docComment)) {
35 6
            return true;
36
        }
37
38 2
        return false;
39
    }
40
}
41