Failed Conditions
Push — develop ( d7a728...605806 )
by Elvis Henrique
04:12
created

AbstractPost   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
eloc 5
dl 0
loc 36
c 0
b 0
f 0
ccs 0
cts 7
cp 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A get_posts() 0 2 1
A get_post() 0 2 1
A __construct() 0 2 1
1
<?php
2
/**
3
 * Abstract post.
4
 *
5
 * @package App
6
 */
7
8
declare(strict_types=1);
9
10
namespace App\Repositories;
11
12
use App\Services\Meta\PostInterface as MetaInterface;
13
14
/**
15
 * Abstract post class.
16
 */
17
abstract class AbstractPost {
18
19
	/**
20
	 * Meta.
21
	 *
22
	 * @var MetaInterface
23
	 */
24
	protected $meta;
25
26
	/**
27
	 * Construct.
28
	 *
29
	 * @param MetaInterface $meta Meta.
30
	 */
31
	public function __construct( MetaInterface $meta ) {
32
		$this->meta = $meta;
33
	}
34
35
	/**
36
	 * Get post.
37
	 *
38
	 * @param integer $id Id.
39
	 * @return \WP_Post|null
40
	 */
41
	protected function get_post( int $id ) : ?\WP_Post {
42
		return get_post( $id );
43
	}
44
45
	/**
46
	 * Get posts.
47
	 *
48
	 * @param array $args Args.
49
	 * @return \WP_Post[]
50
	 */
51
	protected function get_posts( array $args ) : array {
52
		return get_posts( $args );
53
	}
54
}
55