1 | <?php |
||
20 | class Filter |
||
21 | { |
||
22 | /** |
||
23 | * @var FilterPluginManager |
||
24 | */ |
||
25 | protected $filters; |
||
26 | |||
27 | /** |
||
28 | * @param FilterPluginManager $filters |
||
29 | */ |
||
30 | public function __construct(FilterPluginManager $filters) |
||
34 | |||
35 | /** |
||
36 | * Apply functions and filters on variables |
||
37 | * |
||
38 | * Call function if exists else call filter. |
||
39 | * |
||
40 | * @param Translation $translation Variables with values to modify |
||
41 | * @param array $spec Filter options |
||
42 | * @return $this |
||
43 | */ |
||
44 | public function apply(Translation $translation, array $spec) |
||
54 | |||
55 | /** |
||
56 | * @param array $spec |
||
57 | * @param mixed $key |
||
58 | * @param Translation $translation |
||
59 | * @return $this |
||
60 | * @throws Exception\InvalidInstructionException |
||
61 | */ |
||
62 | protected function iterateFilterSpec(array $spec, $key, Translation $translation) |
||
86 | |||
87 | /** |
||
88 | * Call ZF filter |
||
89 | * |
||
90 | * @param string $filter |
||
91 | * @param mixed $key |
||
92 | * @param Translation $translation |
||
93 | * @param array $options |
||
94 | * @return $this |
||
95 | */ |
||
96 | protected function callFilter($filter, $key, Translation $translation, array $options) |
||
109 | } |
||
110 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.