From c8523b3b06030912117fe3db0821a5ad71485ee9 Mon Sep 17 00:00:00 2001 From: Martz Date: Sun, 5 Feb 2023 17:55:36 +0100 Subject: [PATCH] start with Collection Class --- src/Client.php | 6 +++--- src/Collection.php | 17 +++++++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 src/Collection.php diff --git a/src/Client.php b/src/Client.php index 17971bc..97a31dc 100644 --- a/src/Client.php +++ b/src/Client.php @@ -11,6 +11,7 @@ class Client { $this->response = '{}'; $this->url = $url; + $this->users = []; } public function collection(string $collection, int $page = 1) @@ -18,10 +19,9 @@ class Client $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $this->url."/api/collections/".$collection."/records?page=".$page); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - $this->response = curl_exec($ch); + $collection = new Collection(curl_exec($ch)); curl_close($ch); - return json_decode($this->response, JSON_FORCE_OBJECT); + return json_decode($collection, JSON_FORCE_OBJECT); } - } diff --git a/src/Collection.php b/src/Collection.php new file mode 100644 index 0000000..e4d5ac0 --- /dev/null +++ b/src/Collection.php @@ -0,0 +1,17 @@ +json = $data; + } + + public function authWithPassword(){ + var_dump($this->json); + } +}