| Conditions | 4 |
| Paths | 5 |
| Total Lines | 14 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 0 | ||
| 1 | <?php |
||
| 19 | public function get( $metaKey, array $args = [] ) |
||
| 20 | { |
||
| 21 | if( empty( $metaKey ))return; |
||
| 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 ) |
||
| 31 | ? $args['fallback'] |
||
| 32 | : $metaValue; |
||
| 33 | } |
||
| 61 |