1 | <?php |
||
6 | class YieldableUtils |
||
7 | { |
||
8 | /** |
||
9 | * Recursively normalize value. |
||
10 | * Generator Closure -> GeneratorContainer |
||
11 | * Array -> Array (children's are normalized) |
||
12 | * Others -> Others |
||
13 | * @param mixed $value |
||
14 | * @param mixed $yield_key |
||
15 | * @return mixed |
||
16 | */ |
||
17 | 33 | public static function normalize($value, $yield_key = null) |
|
34 | |||
35 | /** |
||
36 | * Recursively search yieldable values. |
||
37 | * Each entries are assoc those contain keys 'value' and 'keylist'. |
||
38 | * value -> the value itself. |
||
39 | * keylist -> position of the value. nests are represented as array values. |
||
40 | * @param mixed $value Must be already normalized. |
||
41 | * @param array $keylist Internally used. |
||
42 | * @param array &$runners Running cURL or Generator identifiers. |
||
43 | * @return array |
||
44 | */ |
||
45 | 31 | public static function getYieldables($value, array $keylist = [], array &$runners = []) |
|
66 | |||
67 | /** |
||
68 | * Return function that apply changes in yieldables. |
||
69 | * @param mixed $yielded |
||
70 | * @param array $yieldables |
||
71 | * @param callable|null $next |
||
72 | * @return mixed |
||
73 | */ |
||
74 | 23 | public static function getApplier($yielded, array $yieldables, callable $next = null) |
|
88 | |||
89 | /** |
||
90 | * Return Deferred that absorbs rejects. |
||
91 | * @param Deferred $original_dfd |
||
92 | * @return Deferred |
||
93 | */ |
||
94 | 10 | public static function safeDeferred(Deferred $original_dfd) |
|
103 | } |
||
104 |