1 | <?php |
||
17 | class Kirki_Output { |
||
18 | |||
19 | /** |
||
20 | * The Kirki configuration used in the field. |
||
21 | * |
||
22 | * @access protected |
||
23 | * @var string |
||
24 | */ |
||
25 | protected $config_id = 'global'; |
||
26 | |||
27 | /** |
||
28 | * The field's `output` argument. |
||
29 | * |
||
30 | * @access protected |
||
31 | * @var array |
||
32 | */ |
||
33 | protected $output = array(); |
||
34 | |||
35 | /** |
||
36 | * An array of the generated styles. |
||
37 | * |
||
38 | * @access protected |
||
39 | * @var array |
||
40 | */ |
||
41 | protected $styles = array(); |
||
42 | |||
43 | /** |
||
44 | * The value. |
||
45 | * |
||
46 | * @access protected |
||
47 | * @var string|array |
||
48 | */ |
||
49 | protected $value; |
||
50 | |||
51 | /** |
||
52 | * The class constructor. |
||
53 | * |
||
54 | * @access public |
||
55 | * @param string $config_id The config ID. |
||
56 | * @param array $output The output argument. |
||
57 | * @param string|array $value The value. |
||
58 | */ |
||
59 | public function __construct( $config_id, $output, $value ) { |
||
67 | |||
68 | /** |
||
69 | * If we have a sanitize_callback defined, apply it to the value. |
||
70 | * |
||
71 | * @param array $output The output args. |
||
72 | * @param string|array $value The value. |
||
73 | * |
||
74 | * @return string|array |
||
75 | */ |
||
76 | protected function apply_sanitize_callback( $output, $value ) { |
||
90 | |||
91 | /** |
||
92 | * If we have a value_pattern defined, apply it to the value. |
||
93 | * |
||
94 | * @param array $output The output args. |
||
95 | * @param string|array $value The value. |
||
96 | * |
||
97 | * @return string|array |
||
98 | */ |
||
99 | protected function apply_value_pattern( $output, $value ) { |
||
110 | |||
111 | /** |
||
112 | * Parses the output arguments. |
||
113 | * Calls the process_output method for each of them. |
||
114 | * |
||
115 | * @access protected |
||
116 | */ |
||
117 | protected function parse_output() { |
||
167 | |||
168 | /** |
||
169 | * Parses an output and creates the styles array for it. |
||
170 | * |
||
171 | * @access protected |
||
172 | * @param array $output The field output. |
||
173 | * @param string $value The value. |
||
174 | * |
||
175 | * @return void |
||
176 | */ |
||
177 | protected function process_output( $output, $value ) { |
||
188 | |||
189 | /** |
||
190 | * Some CSS properties are unique. |
||
191 | * We need to tweak the value to make everything works as expected. |
||
192 | * |
||
193 | * @access protected |
||
194 | * @param string $property The CSS property. |
||
195 | * @param string $value The value. |
||
196 | * |
||
197 | * @return array |
||
198 | */ |
||
199 | protected function process_property_value( $property, $value ) { |
||
212 | |||
213 | /** |
||
214 | * Returns the value. |
||
215 | * |
||
216 | * @access protected |
||
217 | * @param string|array $value The value. |
||
218 | * @param array $output The field "output". |
||
219 | * @return string|array |
||
220 | */ |
||
221 | protected function process_value( $value, $output ) { |
||
227 | |||
228 | /** |
||
229 | * Exploses the private $styles property to the world |
||
230 | * |
||
231 | * @access protected |
||
232 | * @return array |
||
233 | */ |
||
234 | public function get_styles() { |
||
237 | } |
||
238 | } // End if(). |
||
239 |
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.