| Conditions | 4 |
| Paths | 6 |
| Total Lines | 19 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 27 | public function calculate(ResultCollection $results) { |
||
| 28 | |||
| 29 | $ca = $ce = $i = 0; |
||
| 30 | |||
| 31 | foreach($results as $result) { |
||
| 32 | $r = $result->getCoupling(); |
||
| 33 | if(is_object($r)) { |
||
| 34 | $ce += $r->getEfferentCoupling(); |
||
| 35 | $ca += $r->getAfferentCoupling(); |
||
| 36 | } |
||
| 37 | } |
||
| 38 | |||
| 39 | $result = new Result; |
||
| 40 | if($ca + $ce > 0) { |
||
| 41 | $i = round($ce / ($ca + $ce), 2); |
||
| 42 | } |
||
| 43 | $result->setInstability($i); |
||
| 44 | return $result; |
||
| 45 | } |
||
| 46 | |||
| 48 |