Issues (57)

src/Repositories/Example.php (5 issues)

1
<?php declare(strict_types = 1);
0 ignored issues
show
Expected 1 line before declare statement, found 0.
Loading history...
2
3
namespace App\Repositories;
4
5
use App\Entities\Example as Entity;
6
use App\Entities\Examples;
7
use WPSteak\Repositories\AbstractPost;
8
9
/** @codeCoverageIgnore */
10
class Example extends AbstractPost {
11
12
	public function find_one_by_post( \WP_Post $post ): ?Entity {
13
		return new Entity( $post, $this->meta->get( (int) $post->ID, 'address', true ) );
14
	}
15
16
	public function find_by_author_id( int $author_id, int $quantity ): Examples {
17
		$posts = $this->get_posts(
18
			[
19
				'numberposts' => $quantity,
20
				'author' => $author_id,
21
			],
0 ignored issues
show
Trailing comma after the last parameter in function call is disallowed.
Loading history...
22
		);
23
24
		return new Examples(
25
			...array_map(
26
				fn ( \WP_Post $post ) => new Entity(
27
					$post,
28
					$this->meta->get( (int) $post->ID, 'address', true ),
0 ignored issues
show
Trailing comma after the last parameter in function call is disallowed.
Loading history...
29
				),
30
				$posts,
0 ignored issues
show
Trailing comma after the last parameter in function call is disallowed.
Loading history...
31
			),
0 ignored issues
show
Trailing comma after the last parameter in function call is disallowed.
Loading history...
32
		);
33
	}
34
35
}
36