@@ -15,33 +15,33 @@ |
||
15 | 15 | /** |
16 | 16 | * {@inheritdoc} |
17 | 17 | */ |
18 | - public function get( $id, $meta_key, $type ) { |
|
18 | + public function get($id, $meta_key, $type) { |
|
19 | 19 | |
20 | 20 | $entity_service = Wordlift_Entity_Service::get_instance(); |
21 | 21 | |
22 | 22 | // Map each returned value to a Wordlift_Property_Entity_Reference. |
23 | 23 | return array_map( |
24 | - function ( $item ) use ( $entity_service ) { |
|
24 | + function($item) use ($entity_service) { |
|
25 | 25 | |
26 | 26 | $regex = '/^(post|term)_(\d+)$/m'; |
27 | - if ( preg_match( $regex, $item, $matches ) ) { |
|
27 | + if (preg_match($regex, $item, $matches)) { |
|
28 | 28 | |
29 | - $object_type = Object_Type_Enum::from_string( $matches[1] ); |
|
29 | + $object_type = Object_Type_Enum::from_string($matches[1]); |
|
30 | 30 | $identifier = (int) $matches[2]; |
31 | - if ( Object_Type_Enum::POST === $object_type ) { |
|
32 | - return new Post_Reference( $identifier ); |
|
33 | - } elseif ( Object_Type_Enum::TERM === $object_type ) { |
|
34 | - return new Term_Reference( $identifier ); |
|
31 | + if (Object_Type_Enum::POST === $object_type) { |
|
32 | + return new Post_Reference($identifier); |
|
33 | + } elseif (Object_Type_Enum::TERM === $object_type) { |
|
34 | + return new Term_Reference($identifier); |
|
35 | 35 | } |
36 | 36 | } |
37 | 37 | |
38 | 38 | // If the $item is a number and it's an existing post, return the |
39 | 39 | // URI of the referenced entity. Otherwise return the value. |
40 | - return is_numeric( $item ) && null !== get_post( $item ) |
|
41 | - ? new Wordlift_Property_Entity_Reference( $entity_service->get_uri( $item ), (int) $item ) |
|
40 | + return is_numeric($item) && null !== get_post($item) |
|
41 | + ? new Wordlift_Property_Entity_Reference($entity_service->get_uri($item), (int) $item) |
|
42 | 42 | : $item; |
43 | 43 | }, |
44 | - parent::get( $id, $meta_key, $type ) |
|
44 | + parent::get($id, $meta_key, $type) |
|
45 | 45 | ); |
46 | 46 | } |
47 | 47 |