| Conditions | 3 |
| Paths | 1 |
| Total Lines | 14 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 29 | public function get( $post_id, $meta_key ) { |
||
| 30 | |||
| 31 | $entity_service = $this->entity_service; |
||
| 32 | |||
| 33 | // Map each returned value to a Wordlift_Property_Entity_Reference. |
||
| 34 | return array_map( function ( $item ) use ( $entity_service ) { |
||
| 35 | |||
| 36 | // If the $item is a number and it's an existing post, return the |
||
| 37 | // URI of the referenced entity. Otherwise return the value. |
||
| 38 | return is_numeric( $item ) && NULL !== get_post( $item ) |
||
| 39 | ? new Wordlift_Property_Entity_Reference( $entity_service->get_uri( $item ) ) |
||
| 40 | : $item; |
||
| 41 | }, get_post_meta( $post_id, $meta_key ) ); |
||
| 42 | } |
||
| 43 | |||
| 45 |