1 | <?php |
||
10 | class RickAndMortyApiWrapper |
||
11 | { |
||
12 | /** |
||
13 | * The Guzzle instance used for HTTP requests |
||
14 | * @var \GuzzleHttp\Client |
||
15 | */ |
||
16 | private $client; |
||
17 | |||
18 | /** |
||
19 | * Guzzle HTTP request options |
||
20 | * @var array |
||
21 | */ |
||
22 | private $options = [ |
||
23 | 'base_uri' => 'https://rickandmortyapi.com/api/', |
||
24 | ]; |
||
25 | |||
26 | /** |
||
27 | * RickAndMortyApiWrapper constructor. |
||
28 | * @param array $options |
||
29 | */ |
||
30 | public function __construct($options = []) |
||
35 | |||
36 | /** |
||
37 | * @return Client |
||
38 | */ |
||
39 | public function getClient(): Client |
||
43 | |||
44 | /** |
||
45 | * @param Client $client |
||
46 | * @return RickAndMortyApiWrapper |
||
47 | */ |
||
48 | public function setClient(Client $client): RickAndMortyApiWrapper |
||
54 | |||
55 | /** |
||
56 | * @return array |
||
57 | */ |
||
58 | public function getOptions(): array |
||
62 | |||
63 | /** |
||
64 | * Set Guzzle options |
||
65 | * @param array $options |
||
66 | * @return RickAndMortyApiWrapper |
||
67 | */ |
||
68 | public function setOptions(array $options): RickAndMortyApiWrapper |
||
74 | |||
75 | /** |
||
76 | * Wrapper for Character API |
||
77 | * @return Character |
||
78 | */ |
||
79 | public function character() |
||
83 | |||
84 | /** |
||
85 | * Wrapper for Location API |
||
86 | * @return Location |
||
87 | */ |
||
88 | public function location() |
||
92 | |||
93 | /** |
||
94 | * Wrapper for Episode API |
||
95 | * @return Episode |
||
96 | */ |
||
97 | public function episode() |
||
101 | } |
||
102 |