Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
37.50% covered (danger)
37.50%
3 / 8
60.00% covered (warning)
60.00%
3 / 5
CRAP
0.00% covered (danger)
0.00%
0 / 1
Calculator
37.50% covered (danger)
37.50%
3 / 8
60.00% covered (warning)
60.00%
3 / 5
11.10
0.00% covered (danger)
0.00%
0 / 1
 add
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 multiply
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 sum
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 squareRoot
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 expensiveBackgroundCalculation
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2namespace Apie\IntegrationTests\Apie\TypeDemo\Actions;
3
4use Apie\Core\Attributes\Context;
5use Apie\Core\Attributes\Description;
6use Apie\Core\Attributes\Route;
7use Apie\Core\BackgroundProcess\SequentialBackgroundProcess;
8use Apie\Core\Lists\ItemHashmap;
9use Apie\Fixtures\BackgroundProcess\SequentialExample;
10
11final class Calculator
12{
13    #[Route('/calc/{numberOne}/plus/{numberTwo}')]
14    public function add(#[Context()] float $numberOne, #[Context()] float $numberTwo): float
15    {
16        return $numberOne + $numberTwo;
17    }
18
19    #[Route('/calc/{numberOne}/times/{numberTwo}')]
20    public function multiply(#[Context()] float $numberOne, #[Context()] float $numberTwo): float
21    {
22        return $numberOne * $numberTwo;
23    }
24
25    public function sum(float... $numbers): float
26    {
27        return array_sum($numbers);
28    }
29
30    public function squareRoot(float $numberOne): float
31    {
32        return sqrt($numberOne);
33    }
34
35    #[Description('Runs an expensive background calculation')]
36    public function expensiveBackgroundCalculation(int $payload): SequentialBackgroundProcess
37    {
38        return new SequentialBackgroundProcess(
39            new SequentialExample(),
40            new ItemHashmap(['payload' => $payload])
41        );
42    }
43}