Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
75.00% |
3 / 4 |
|
75.00% |
3 / 4 |
CRAP | |
0.00% |
0 / 1 |
Calculator | |
75.00% |
3 / 4 |
|
75.00% |
3 / 4 |
4.25 | |
0.00% |
0 / 1 |
add | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
multiply | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
sum | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
squareRoot | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | namespace Apie\IntegrationTests\Apie\TypeDemo\Actions; |
3 | |
4 | use Apie\Core\Attributes\Context; |
5 | use Apie\Core\Attributes\Route; |
6 | |
7 | final class Calculator |
8 | { |
9 | #[Route('/calc/{numberOne}/plus/{numberTwo}')] |
10 | public function add(#[Context()] float $numberOne, #[Context()] float $numberTwo): float |
11 | { |
12 | return $numberOne + $numberTwo; |
13 | } |
14 | |
15 | #[Route('/calc/{numberOne}/times/{numberTwo}')] |
16 | public function multiply(#[Context()] float $numberOne, #[Context()] float $numberTwo): float |
17 | { |
18 | return $numberOne * $numberTwo; |
19 | } |
20 | |
21 | public function sum(float... $numbers): float |
22 | { |
23 | return array_sum($numbers); |
24 | } |
25 | |
26 | public function squareRoot(float $numberOne): float |
27 | { |
28 | return sqrt($numberOne); |
29 | } |
30 | } |