Test Setup Failed
Push — develop ( 67f164...d5fe8d )
by Elvis Henrique
03:02
created

Page::find_one()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
ccs 4
cts 4
cp 1
crap 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
use WPSteak\Repositories\AbstractPost;
0 ignored issues
show
Bug introduced by
The type WPSteak\Repositories\AbstractPost was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
14
15
/**
16
 * Page class.
17
 */
18
class Page extends AbstractPost {
19
20
	/**
21
	 * Find one.
22
	 *
23
	 * @param \WP_Post|int $post The post object or id.
24
	 * @return Entity|null
25 2
	 */
26 2
	public function find_one( $post ) : ?Entity {
27
		$post = $this->get_post( $post );
28 2
29 1
		if ( empty( $post ) ) {
30
			return null;
31
		}
32 1
33
		return ( new Entity() )->set_post( $post );
34
	}
35
}
36