Completed
Push — master ( 3708b9...fb0aff )
by Enrico
03:36
created

HasMoreThanOneProperty   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 27
ccs 8
cts 8
cp 1
rs 10
c 1
b 0
f 0
wmc 3
lcom 0
cbo 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A pass() 0 9 2
A getRegister() 0 6 1
1
<?php
2
/**
3
 * @author Leonardo da Mata https://github.com/barroca <[email protected]>
4
 */
5
namespace PHPSA\Analyzer\Pass\Statement;
6
7
use PhpParser\Node\Stmt\Property;
8
use PHPSA\Analyzer\Pass;
9
use PHPSA\Context;
10
11
class HasMoreThanOneProperty implements Pass\AnalyzerPassInterface
12
{
13
    /**
14
     * @param Property $prop
15
     * @param Context $context
16
     * @return bool
17
     */
18 6
    public function pass(Property $prop, Context $context)
19
    {
20 6
        if (count($prop->props) > 1) {
21 2
            $context->notice('limit.properties', 'Number of properties larger than one.', $prop);
22 2
            return true;
23
        }
24
25 6
        return false;
26
    }
27
28
    /**
29
     * @return array
30
     */
31 1
    public function getRegister()
32
    {
33
        return [
34 1
            Property::class,
35 1
        ];
36
    }
37
}
38