1 | <?php |
||
17 | class AbstractResource |
||
18 | { |
||
19 | /** |
||
20 | * The API client. |
||
21 | * |
||
22 | * @var Client |
||
23 | */ |
||
24 | protected $client; |
||
25 | |||
26 | /** |
||
27 | * Serializer interface to serialize / deserialize the request / responses. |
||
28 | * |
||
29 | * @var SerializerInterface |
||
30 | */ |
||
31 | protected $serializer; |
||
32 | |||
33 | /** |
||
34 | * Constructor. |
||
35 | * |
||
36 | * @param Client $client The API client. |
||
37 | * @param SerializerInterface $serializer Serializer interface to serialize / deserialize the request / responses. |
||
38 | */ |
||
39 | public function __construct(Client $client, SerializerInterface $serializer = null) |
||
44 | |||
45 | private function buildSerializer(): SerializerInterface |
||
49 | |||
50 | /** |
||
51 | * Create an ApiException from a client exception. |
||
52 | * |
||
53 | * @param ClientException $e The client exception. |
||
54 | * @return ApiException |
||
55 | * @throws \Speicher210\KontaktIO\Exception\ApiKeyInvalidException |
||
56 | */ |
||
57 | protected function createApiException(ClientException $e): ApiException |
||
80 | } |
||
81 |
Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code: