1 | <?php |
||
14 | class Client implements ClientInterface |
||
15 | { |
||
16 | /** |
||
17 | * The default ttl for cached responses (24 hours). |
||
18 | * |
||
19 | * @link http://developer.marvel.com/documentation/attribution Marvel's rules for caching. |
||
20 | * |
||
21 | * @const integer |
||
22 | */ |
||
23 | const MAX_TTL = 86400; |
||
24 | |||
25 | /** |
||
26 | * The public api key issued by Marvel. |
||
27 | * |
||
28 | * @var string |
||
29 | */ |
||
30 | private $publicApiKey; |
||
31 | |||
32 | /** |
||
33 | * The private api key issued by Marvel. |
||
34 | * |
||
35 | * @var string |
||
36 | */ |
||
37 | private $privateApiKey; |
||
38 | |||
39 | /** |
||
40 | * Guzzle HTTP Client implementation. |
||
41 | * |
||
42 | * @var GuzzleClientInterface |
||
43 | */ |
||
44 | private $guzzleClient; |
||
45 | |||
46 | /** |
||
47 | * Cache implementation. |
||
48 | * |
||
49 | * @var CacheInterface |
||
50 | */ |
||
51 | private $cache; |
||
52 | |||
53 | /** |
||
54 | * The Marvel API url. |
||
55 | * |
||
56 | * @const string |
||
57 | */ |
||
58 | const BASE_URL = 'http://gateway.marvel.com/v1/public/'; |
||
59 | |||
60 | /** |
||
61 | * Construct a new Client. |
||
62 | * |
||
63 | * @param string $privateApiKey The private api key issued by Marvel. |
||
64 | * @param string $publicApiKey The public api key issued by Marvel. |
||
65 | * @param GuzzleHttp\ClientInterface $guzzleClient Implementation of a Guzzle HTTP client. |
||
66 | * @param CacheInterface $cache Implementation of Cache. |
||
67 | */ |
||
68 | final public function __construct( |
||
79 | |||
80 | /** |
||
81 | * Execute a search request against the Marvel API. |
||
82 | * |
||
83 | * @param string $resource The API resource to search for. |
||
84 | * @param array $filters Array of search criteria to use in request. |
||
85 | * |
||
86 | * @return DataWrapperInterface|null |
||
87 | * |
||
88 | * @throws \InvalidArgumentException Thrown if $resource is empty or not a string. |
||
89 | */ |
||
90 | final public function search(string $resource, array $filters = []) |
||
105 | |||
106 | /** |
||
107 | * Execute a GET request against the Marvel API for a single resource. |
||
108 | * |
||
109 | * @param string $resource The API resource to search for. |
||
110 | * @param integer $id The id of the API resource. |
||
111 | * |
||
112 | * @return DataWrapperInterface|null |
||
113 | */ |
||
114 | final public function get(string $resource, int $id) |
||
132 | |||
133 | /** |
||
134 | * Send the given API Request. |
||
135 | * |
||
136 | * @param RequestInterface $request The request to send. |
||
137 | * |
||
138 | * @return ResponseInterface |
||
139 | */ |
||
140 | final private function send(RequestInterface $request) : ResponseInterface |
||
152 | |||
153 | /** |
||
154 | * Allow calls such as $client->characters(); |
||
155 | * |
||
156 | * @param string $name The name of the api resource. |
||
157 | * @param array $arguments The parameters to pass to get() or search(). |
||
158 | * |
||
159 | * @return Collection|EntityInterface |
||
160 | */ |
||
161 | final public function __call(string $name, array $arguments) |
||
181 | } |
||
182 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..