Total Complexity | 9 |
Total Lines | 53 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
18 | class Creator |
||
19 | { |
||
20 | /** |
||
21 | * @param mixed[] $programs |
||
22 | * @return array [programs, context] |
||
23 | */ |
||
24 | public static function context(array $programs) : array |
||
25 | { |
||
26 | $ctx = null; |
||
27 | |||
28 | foreach ($programs as $id => $program) { |
||
29 | if ($program instanceof Context) { |
||
30 | $ctx = $program; |
||
31 | unset($programs[$id]); |
||
32 | break; |
||
33 | } |
||
34 | } |
||
35 | |||
36 | return [$programs, $ctx]; |
||
37 | } |
||
38 | |||
39 | /** |
||
40 | * @param mixed[] $programs |
||
41 | * @param Context $ctx |
||
42 | * @return Promised[] |
||
43 | */ |
||
44 | public static function promises(array $programs, Context $ctx = null) : array |
||
49 | } |
||
50 | |||
51 | /** |
||
52 | * @param mixed $program |
||
53 | * @param array $args |
||
54 | * @param Context $ctx |
||
55 | * @return Promised |
||
56 | */ |
||
57 | public static function promised($program, array $args = [], Context $ctx = null) : Promised |
||
71 | } |
||
72 | } |
||
74 |