- * @var \http\Client\Response $response
- * @return \seekat\API self
- */
- function import(Response $response) : API {
- //addcslashes($response, "\0..\40\42\47\134\140\177..\377")
-
- $this->__log->info(__FUNCTION__.": ". $response->getInfo(), [
- "url" => (string) $this->__url
- ]);
-
- if ($response->getResponseCode() >= 400) {
- $e = new RequestException($response);
-
- $this->__log->critical(__FUNCTION__.": ".$e->getMessage(), [
- "url" => (string) $this->__url,
- ]);
-
- throw $e;
- }
-
- if (!($type = $response->getHeader("Content-Type", Header::class))) {
- $e = new RequestException($response);
- $this->__log->error(
- __FUNCTION__.": Empty Content-Type -> ".$e->getMessage(), [
- "url" => (string) $this->__url,
- ]);
- throw $e;
- }
-
- try {
- $this->__type = new ContentType($type);
- $this->__data = $this->__type->parseBody($response->getBody());
-
- if (($link = $response->getHeader("Link", Header::class))) {
- $this->__links = new API\Links($link);
- }
- } catch (\Exception $e) {
- $this->__log->error(__FUNCTION__.": ".$e->getMessage(), [
- "url" => (string) $this->__url
- ]);
-
- throw $e;
- }
-
- return $this;
+ * @return int
+ */
+ function count() : int {
+ return count($this->data);
+ }
+
+ /**
+ * @return Url
+ */
+ function getUrl() : Url {
+ return $this->url;
+ }
+
+ /**
+ * @return LoggerInterface
+ */
+ function getLogger() : LoggerInterface {
+ return $this->logger;
+ }
+
+ /**
+ * @return Client
+ */
+ public function getClient(): Client {
+ return $this->client;