| @@ 24-35 (lines=12) @@ | ||
| 21 | return $book; |
|
| 22 | } |
|
| 23 | ||
| 24 | public function includeAuthor(array $book) |
|
| 25 | { |
|
| 26 | if (!array_key_exists('_author', $book)) { |
|
| 27 | return; |
|
| 28 | } |
|
| 29 | ||
| 30 | if ($book['_author'] === null) { |
|
| 31 | return $this->null(); |
|
| 32 | } |
|
| 33 | ||
| 34 | return $this->item($book['_author'], new JsonApiAuthorTransformer(), 'people'); |
|
| 35 | } |
|
| 36 | ||
| 37 | public function includeAuthorWithMeta(array $book) |
|
| 38 | { |
|
| @@ 37-49 (lines=13) @@ | ||
| 34 | return $this->item($book['_author'], new JsonApiAuthorTransformer(), 'people'); |
|
| 35 | } |
|
| 36 | ||
| 37 | public function includeAuthorWithMeta(array $book) |
|
| 38 | { |
|
| 39 | if (!array_key_exists('_author', $book)) { |
|
| 40 | return; |
|
| 41 | } |
|
| 42 | ||
| 43 | if ($book['_author'] === null) { |
|
| 44 | return $this->null(); |
|
| 45 | } |
|
| 46 | ||
| 47 | return $this->item($book['_author'], new JsonApiAuthorTransformer(), 'people') |
|
| 48 | ->setMeta(['foo' => 'bar']); |
|
| 49 | } |
|
| 50 | ||
| 51 | public function includeCoAuthor(array $book) |
|
| 52 | { |
|
| @@ 51-62 (lines=12) @@ | ||
| 48 | ->setMeta(['foo' => 'bar']); |
|
| 49 | } |
|
| 50 | ||
| 51 | public function includeCoAuthor(array $book) |
|
| 52 | { |
|
| 53 | if (!array_key_exists('_co_author', $book)) { |
|
| 54 | return; |
|
| 55 | } |
|
| 56 | ||
| 57 | if ($book['_co_author'] === null) { |
|
| 58 | return $this->null(); |
|
| 59 | } |
|
| 60 | ||
| 61 | return $this->item($book['_co_author'], new JsonApiAuthorTransformer(), 'people'); |
|
| 62 | } |
|
| 63 | } |
|
| 64 | ||