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

Example   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 9
dl 0
loc 21
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A find_one() 0 13 2
1
<?php
2
/**
3
 * Example.
4
 *
5
 * @package App
6
 */
7
8
declare(strict_types=1);
9
10
namespace App\Repositories;
11
12
use App\Entities\Example as Entity;
13
use WPSteak\Entities\Collection;
0 ignored issues
show
Bug introduced by
The type WPSteak\Entities\Collection 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
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...
15
16
/**
17
 * Example class.
18
 */
19
class Example extends AbstractPost {
20
21
	/**
22
	 * Find one.
23
	 *
24
	 * @param \WP_Post|int $post The post object or id.
25
	 * @return Entity|null
26
	 */
27
	public function find_one( $post ) : ?Entity {
28
		$post = $this->get_post( $post );
29
30
		if ( empty( $post ) ) {
31
			return null;
32
		}
33
34
		$entity = new Entity();
35
		$entity
36
			->set_address( $this->meta->get( (int) $post->ID, 'address', true ) )
37
			->set_post( $post );
38
39
		return $entity;
40
	}
41
}
42