Total Complexity | 3 |
Total Lines | 49 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
14 | final class ValidTernary implements Scalar |
||
15 | { |
||
16 | /** |
||
17 | * Ctor. |
||
18 | * |
||
19 | * @template TKey |
||
20 | * @template TValue |
||
21 | * @phpstan-param Iterator<TKey, TValue> $origin |
||
22 | * @phpstan-param Closure(Iterator<TKey, TValue>):T $cons |
||
23 | * @phpstan-param Closure(Iterator<TKey, TValue>):T $alter |
||
24 | * @param Iterator $origin iterator which validity is checked. |
||
25 | * @param Closure $cons consequent path if iterator is valid. |
||
26 | * @param Closure $alter alternative path if iterator is not valid. |
||
27 | */ |
||
28 | public function __construct( |
||
29 | /** |
||
30 | * Iterator which validity is checked. |
||
31 | * |
||
32 | * @phpstan-var Iterator<TKey, TValue> |
||
33 | * @var Iterator |
||
34 | */ |
||
35 | private Iterator $origin, |
||
36 | |||
37 | /** |
||
38 | * Consequent path if iterator is valid. |
||
39 | * |
||
40 | * @phpstan-var Closure(Iterator<TKey, TValue>):T |
||
41 | * @var Closure |
||
42 | */ |
||
43 | private Closure $cons, |
||
44 | |||
45 | /** |
||
46 | * Alternate path if iterator is not valid. |
||
47 | * |
||
48 | * @phpstan-var Closure(Iterator<TKey, TValue>):T |
||
49 | * @var Closure |
||
50 | */ |
||
51 | private Closure $alter |
||
52 | ) { |
||
53 | } |
||
54 | |||
55 | public function value(): mixed |
||
63 | } |
||
64 | } |
||
65 |