| Conditions | 4 |
| Paths | 6 |
| Total Lines | 16 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 34 | public function run($rating1, $rating2) |
||
| 35 | { |
||
| 36 | $distance = 0; |
||
| 37 | $commonRatings = false; |
||
| 38 | foreach ($rating1 as $key => $rating) { |
||
| 39 | if (isset($rating2[$key])) { |
||
| 40 | $distance += pow(abs($rating - $rating2[$key]), $this->r); |
||
| 41 | $commonRatings = true; |
||
| 42 | } |
||
| 43 | } |
||
| 44 | if ($commonRatings) { |
||
| 45 | return pow($distance, 1 / $this->r); |
||
| 46 | } |
||
| 47 | |||
| 48 | return false; |
||
| 49 | } |
||
| 50 | } |
||
| 51 |