| Conditions | 6 |
| Paths | 4 |
| Total Lines | 25 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 15 |
| CRAP Score | 6.0087 |
| Changes | 0 | ||
| 1 | <?php |
||
| 36 | 4 | public function apply(AbstractNode $node) |
|
| 37 | { |
||
| 38 | try { |
||
| 39 | 4 | $threshold = $this->getIntProperty('maximum'); |
|
| 40 | $comparision = 1; |
||
| 41 | 4 | } catch (\OutOfBoundsException $e) { |
|
| 42 | 4 | $threshold = $this->getIntProperty('minimum'); |
|
| 43 | 4 | $comparision = 2; |
|
| 44 | } |
||
| 45 | |||
| 46 | 4 | $dit = $node->getMetric('dit'); |
|
| 47 | 4 | if (($comparision === 1 && $dit > $threshold) || |
|
| 48 | 4 | ($comparision === 2 && $dit >= $threshold) |
|
| 49 | ) { |
||
| 50 | 2 | $this->addViolation( |
|
| 51 | 2 | $node, |
|
| 52 | array( |
||
| 53 | 2 | $node->getType(), |
|
| 54 | 2 | $node->getName(), |
|
| 55 | 2 | $dit, |
|
| 56 | 2 | $threshold |
|
| 57 | ) |
||
| 58 | ); |
||
| 59 | } |
||
| 60 | 4 | } |
|
| 61 | } |
||
| 62 |