| 1 | <?php |
||
| 18 | class PhpCalculator implements CalculatorInterface |
||
| 19 | { |
||
| 20 | /** |
||
| 21 | * {@inheritdoc} |
||
| 22 | */ |
||
| 23 | public static function isSupported() |
||
| 27 | |||
| 28 | /** |
||
| 29 | * {@inheritdoc} |
||
| 30 | */ |
||
| 31 | 2 | public function compare($a, $b) |
|
| 32 | { |
||
| 33 | 2 | return ($a < $b) ? -1 : (($a > $b) ? 1 : 0); |
|
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * {@inheritdoc} |
||
| 38 | */ |
||
| 39 | 1 | public function add($amount, $addend) |
|
| 40 | { |
||
| 41 | 1 | $result = $amount + $addend; |
|
| 42 | |||
| 43 | 1 | return $result; |
|
| 44 | } |
||
| 45 | |||
| 46 | /** |
||
| 47 | * {@inheritdoc} |
||
| 48 | */ |
||
| 49 | 1 | public function subtract($amount, $subtrahend) |
|
| 50 | { |
||
| 51 | 1 | $result = $amount - $subtrahend; |
|
| 52 | |||
| 53 | 1 | return $result; |
|
| 54 | } |
||
| 55 | |||
| 56 | /** |
||
| 57 | * {@inheritdoc} |
||
| 58 | */ |
||
| 59 | 6 | public function multiply($amount, $multiplier) |
|
| 65 | |||
| 66 | /** |
||
| 67 | * {@inheritdoc} |
||
| 68 | */ |
||
| 69 | 5 | public function divide($amount, $divisor) |
|
| 75 | |||
| 76 | /** |
||
| 77 | * {@inheritdoc} |
||
| 78 | */ |
||
| 79 | public function ceil($number) |
||
| 83 | |||
| 84 | /** |
||
| 85 | * {@inheritdoc} |
||
| 86 | */ |
||
| 87 | public function floor($number) |
||
| 91 | |||
| 92 | /** |
||
| 93 | * {@inheritdoc} |
||
| 94 | */ |
||
| 95 | public function absolute($number) |
||
| 99 | |||
| 100 | /** |
||
| 101 | * {@inheritdoc} |
||
| 102 | */ |
||
| 103 | public function round($number, $roundingMode) |
||
| 107 | } |
||
| 108 |