Conditions | 2 |
Paths | 2 |
Total Lines | 15 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
43 | 1 | public function find_by_author_id( int $author_id, int $quantity ) : Collection { |
|
44 | 1 | $posts = $this->get_posts( |
|
45 | [ |
||
46 | 1 | 'numberposts' => $quantity, |
|
47 | 1 | 'author' => $author_id, |
|
48 | ] |
||
49 | ); |
||
50 | |||
51 | 1 | $collection = new Collection(); |
|
52 | |||
53 | 1 | foreach ( $posts as $post ) { |
|
54 | 1 | $collection->add_entity( ( new Entity() )->set_post( $post ) ); |
|
55 | } |
||
56 | |||
57 | 1 | return $collection; |
|
58 | } |
||
60 |