Completed
Push — master ( 228e92...6a576a )
by David
02:49
created

Wordlift_Location_Property_Service::get()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 6
nc 1
nop 2
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
1
<?php
2
/**
3
 * This file is part of the properties group of files which handle the location
4
 * property of entities.
5
 *
6
 * @since   3.8.0
7
 * @package Wordlift
8
 */
9
10
/**
11
 * Process references to locations either returning a {@link Wordlift_Property_Entity_Reference}
12
 * instance or a place name.
13
 *
14
 * @since 3.8.0
15
 */
16
class Wordlift_Location_Property_Service extends Wordlift_Entity_Property_Service {
17
//	/**
18
//	 * A {@link Wordlift_Entity_Service} instance.
19
//	 * @since  3.8.0
20
//	 * @access private
21
//	 * @var \Wordlift_Entity_Service $entity_service A {@link Wordlift_Entity_Service} instance.
22
//	 */
23
//	private $entity_service;
24
//
25
//	/**
26
//	 * Wordlift_Location_Property_Service constructor.
27
//	 *
28
//	 * @since 3.8.0
29
//	 *
30
//	 * @param \Wordlift_Entity_Service $entity_service A {@link Wordlift_Entity_Service} instance.
31
//	 */
32
//	public function __construct( $entity_service ) {
33
//
34
//		$this->entity_service = $entity_service;
35
//
36
//	}
37
38
	/**
39
	 * {@inheritdoc}
40
	 */
41
	public function get( $post_id, $meta_key ) {
42
43
		return array_map( function ( $item ) {
44
45
			return $item instanceof Wordlift_Property_Entity_Reference
46
				? $item
47
				: array( '@type' => 'Place', 'name' => $item );
48
		}, parent::get( $post_id, $meta_key ) );
49
	}
50
51
}
52