Completed
Pull Request — develop (#1321)
by
unknown
02:53
created

Wordlift_Required_Property_Service   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 19
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A get() 0 12 2
1
<?php
2
/**
3
 * Process required references returning a {@link Wordlift_Property_Entity_Reference}
4
 *
5
 * @since 3.29.1
6
 */
7
class Wordlift_Required_Property_Service extends Wordlift_Entity_Property_Service {
8
9
	/**
10
	 * {@inheritdoc}
11
	 */
12
	public function get( $post_id, $meta_key ) {
13
14
		return array_map( function ( $item ) {
15
16
			// If this is an entity reference, set that this entity is always required in SD output.
17
			if ( $item instanceof Wordlift_Property_Entity_Reference ) {
18
				$item->set_required( true );
19
			}
20
21
			return $item;
22
		}, parent::get( $post_id, $meta_key ) );
23
	}
24
25
}
26