Conditions | 7 |
Paths | 7 |
Total Lines | 22 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 13 |
CRAP Score | 7 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php namespace Arcanedev\Units\Traits; |
||
20 | 136 | protected static function calculate($a, $operator, $b) |
|
21 | { |
||
22 | switch ($operator) { |
||
23 | 136 | case '+': |
|
24 | 40 | return $a + $b; |
|
25 | |||
26 | 104 | case '-': |
|
27 | 24 | return $a - $b; |
|
28 | |||
29 | 80 | case 'x': |
|
30 | 74 | case '*': |
|
31 | 24 | return $a * $b; |
|
32 | |||
33 | 56 | case '/': |
|
34 | 24 | return $a / $b; |
|
35 | |||
36 | 32 | case '^': |
|
37 | 24 | return pow($a, $b); |
|
38 | } |
||
39 | |||
40 | 8 | return $a; |
|
41 | } |
||
42 | } |
||
43 |