| Conditions | 4 |
| Paths | 5 |
| Total Lines | 15 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | public function get( $metaKey, array $args = [] ) |
||
| 14 | { |
||
| 15 | if( empty( $metaKey ))return; |
||
| 16 | |||
| 17 | $args = $this->normalize( $args ); |
||
| 18 | $metaKey = $this->buildMetaKey( $metaKey, $args['prefix'] ); |
||
| 19 | $metaValue = get_post_meta( $args['id'], $metaKey, $args['single'] ); |
||
| 20 | |||
| 21 | if( is_string( $metaValue )) { |
||
| 22 | $metaValue = trim( $metaValue ); |
||
| 23 | } |
||
| 24 | return empty( $metaValue ) |
||
| 25 | ? $args['fallback'] |
||
| 26 | : $metaValue; |
||
| 27 | } |
||
| 28 | |||
| 55 |