1 | <?php |
||
24 | class ParamsExpander |
||
25 | { |
||
26 | |||
27 | /** |
||
28 | * Expand params to annotation values. |
||
29 | * When annotation is used with multi top values, this will help assign this values to annotation. |
||
30 | * Examples of multi valued params include: |
||
31 | * |
||
32 | * ``` |
||
33 | * @Annotation(Class\Literal, 2) |
||
34 | * @Annotation(class = Class\Literal, items = 2) |
||
35 | * ``` |
||
36 | * |
||
37 | * Example of use: |
||
38 | * ``` |
||
39 | * $data = ParamsExpander::expand($annotation, ['class', 'items']) |
||
40 | * ``` |
||
41 | * This will assign `$annotation->class` and `$annotation->items` with named or anonymous params (based on order of params). |
||
42 | * @param AnnotationInterface $annotation |
||
43 | * @param string[] $params List of parameters names in order. |
||
44 | * @param mixed[] $values Values used to expand params, if not set `$annotation->value` will be used if available. |
||
45 | * @return mixed[] Expanded params |
||
46 | */ |
||
47 | 1 | public static function expand(AnnotationInterface $annotation, $params, $values = []) |
|
73 | |||
74 | } |
||
75 |