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

Page   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 5
dl 0
loc 16
c 0
b 0
f 0
ccs 5
cts 5
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A find_by_id() 0 8 2
1
<?php
2
/**
3
 * Page.
4
 *
5
 * @package App
6
 */
7
8
declare(strict_types=1);
9
10
namespace App\Repositories;
11
12
use App\Entities\Page as Entity;
13
14
/**
15
 * Page class.
16
 */
17
class Page extends AbstractPost {
18
19
	/**
20
	 * Find by id.
21
	 *
22
	 * @param integer $id Id.
23
	 * @return Entity|null
24
	 */
25 2
	public function find_by_id( int $id ) : ?Entity {
26 2
		$post = $this->get_post( $id );
27
28 2
		if ( ! $post ) {
0 ignored issues
show
introduced by
$post is of type WP_Post, thus it always evaluated to true.
Loading history...
29 1
			return null;
30
		}
31
32 1
		return ( new Entity() )->set_post( $post );
33
	}
34
}
35