Conditions | 5 |
Paths | 9 |
Total Lines | 16 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
17 | public function get($metaKey, array $args = []) |
||
18 | { |
||
19 | if (empty($metaKey)) { |
||
20 | return; |
||
21 | } |
||
22 | |||
23 | $args = $this->normalize($args); |
||
24 | $metaKey = $this->buildMetaKey($metaKey, $args['prefix']); |
||
25 | $metaValue = get_post_meta($args['id'], $metaKey, $args['single']); |
||
26 | |||
27 | if (is_string($metaValue)) { |
||
28 | $metaValue = trim($metaValue); |
||
29 | } |
||
30 | return empty($metaValue) && !in_array($metaValue, [0,'0']) |
||
31 | ? $args['fallback'] |
||
32 | : $metaValue; |
||
33 | } |
||
61 |