Completed
Push — master ( 5db201...585add )
by David
08:20
created

Wordlift_Storage   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
get() 0 1 ?
A get_first() 0 10 2
1
<?php
2
/**
3
 * Storage: Storage Abstract Class.
4
 *
5
 * @since      3.15.0
6
 * @package    Wordlift
7
 * @subpackage Wordlift/includes/linked-data/storage
8
 */
9
10
/**
11
 * Define the {@link Wordlift_Storage} abstract class.
12
 *
13
 * @since      3.15.0
14
 * @package    Wordlift
15
 * @subpackage Wordlift/includes/linked-data/storage
16
 */
17
abstract class Wordlift_Storage {
18
19
	/**
20
	 * Get the values for the property of the {@link WP_Post}.
21
	 *
22
	 * @since 3.15.0
23
	 *
24
	 * @param int $post_id The {@link WP_Post}'s id.
25
	 *
26
	 * @return array
27
	 */
28
	abstract public function get( $post_id );
29
30
	/**
31
	 * Get the first value for a property.
32
	 *
33
	 * @since 3.15.0
34
	 *
35
	 * @param int $post_id The {@link WP_Post}'s id.
36
	 *
37
	 * @return string The first property value or an empty string.
38
	 */
39
	public function get_first( $post_id ) {
40
41
		$values = $this->get( $post_id );
42
43
		if ( empty( $values ) ) {
44
			return '';
45
		}
46
47
		return $values[0];
48
	}
49
50
}
51