| 1 | <?php |
||
| 2 | /** |
||
| 3 | * Post. |
||
| 4 | * |
||
| 5 | * @package App |
||
| 6 | */ |
||
| 7 | |||
| 8 | declare(strict_types=1); |
||
| 9 | |||
| 10 | namespace App\Repositories; |
||
| 11 | |||
| 12 | use App\Entities\Post as Entity; |
||
| 13 | use WPSteak\Entities\Collection; |
||
|
0 ignored issues
–
show
|
|||
| 14 | use WPSteak\Repositories\AbstractPost; |
||
|
0 ignored issues
–
show
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. 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 | * Post class. |
||
| 18 | */ |
||
| 19 | class Post extends AbstractPost { |
||
| 20 | |||
| 21 | /** |
||
| 22 | * Find one. |
||
| 23 | * |
||
| 24 | * @param \WP_Post|int $post The post object or id. |
||
| 25 | * @return Entity|null |
||
| 26 | 2 | */ |
|
| 27 | 2 | public function find_one( $post ) : ?Entity { |
|
| 28 | $post = $this->get_post( $post ); |
||
| 29 | 2 | ||
| 30 | 1 | if ( empty( $post ) ) { |
|
| 31 | return null; |
||
| 32 | } |
||
| 33 | 1 | ||
| 34 | return ( new Entity() )->set_post( $post ); |
||
| 35 | } |
||
| 36 | |||
| 37 | /** |
||
| 38 | * Find by author id. |
||
| 39 | * |
||
| 40 | * @param integer $author_id Author id. |
||
| 41 | * @param integer $quantity Quantity. |
||
| 42 | * @return Collection |
||
| 43 | 1 | */ |
|
| 44 | 1 | public function find_by_author_id( int $author_id, int $quantity ) : Collection { |
|
| 45 | $posts = $this->get_posts( |
||
| 46 | 1 | [ |
|
| 47 | 1 | 'numberposts' => $quantity, |
|
| 48 | 'author' => $author_id, |
||
| 49 | ] |
||
| 50 | ); |
||
| 51 | 1 | ||
| 52 | $collection = new Collection(); |
||
| 53 | 1 | ||
| 54 | 1 | foreach ( $posts as $post ) { |
|
| 55 | $collection->add_entity( ( new Entity() )->set_post( $post ) ); |
||
| 56 | } |
||
| 57 | 1 | ||
| 58 | return $collection; |
||
| 59 | } |
||
| 60 | } |
||
| 61 |
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:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths