| @@ 8-31 (lines=24) @@ | ||
| 5 | use GuzzleHttp\Client; |
|
| 6 | use Zmaglica\RickAndMortyApiWrapper\Model\Episode as EpisodeModel; |
|
| 7 | ||
| 8 | class Episode extends AbstractApi |
|
| 9 | { |
|
| 10 | public function __construct(Client $client) |
|
| 11 | { |
|
| 12 | $this->client = $client; |
|
| 13 | $this->uri = 'episode'; |
|
| 14 | $this->arguments = []; |
|
| 15 | $this->supportedFilters = [ |
|
| 16 | 'name', |
|
| 17 | 'episode', |
|
| 18 | ]; |
|
| 19 | $this->model = EpisodeModel::class; |
|
| 20 | } |
|
| 21 | ||
| 22 | /** |
|
| 23 | * Get residents of location |
|
| 24 | * @param null $id |
|
| 25 | * @return mixed |
|
| 26 | */ |
|
| 27 | public function getCharacters($id = null) |
|
| 28 | { |
|
| 29 | return $this->get($id)->getCharacters(); |
|
| 30 | } |
|
| 31 | } |
|
| 32 | ||
| @@ 8-32 (lines=25) @@ | ||
| 5 | use GuzzleHttp\Client; |
|
| 6 | use Zmaglica\RickAndMortyApiWrapper\Model\Location as LocationModel; |
|
| 7 | ||
| 8 | class Location extends AbstractApi |
|
| 9 | { |
|
| 10 | public function __construct(Client $client) |
|
| 11 | { |
|
| 12 | $this->client = $client; |
|
| 13 | $this->uri = 'location'; |
|
| 14 | $this->arguments = []; |
|
| 15 | $this->supportedFilters = [ |
|
| 16 | 'name', |
|
| 17 | 'type', |
|
| 18 | 'dimension', |
|
| 19 | ]; |
|
| 20 | $this->model = LocationModel::class; |
|
| 21 | } |
|
| 22 | ||
| 23 | /** |
|
| 24 | * Get residents of location |
|
| 25 | * @param null $id |
|
| 26 | * @return mixed |
|
| 27 | */ |
|
| 28 | public function getResidents($id = null) |
|
| 29 | { |
|
| 30 | return $this->get($id)->getResidents(); |
|
| 31 | } |
|
| 32 | } |
|
| 33 | ||