also looking at this
initialize progress
#1
17 files
+581
-48
Review threads live on the whole diff, not on one commit, so none are shown here - a thread's line means something in the branch's final form, and painting it into an intermediate step would put it on code it is not about.
| @@ -2,6 +2,7 @@ | ||
| 2 | 2 | |
| 3 | 3 | namespace Meema\MeemaApi; |
| 4 | 4 | |
| 5 | use Dotenv\Dotenv; | |
| 5 | 6 | use GuzzleHttp\Client as GuzzleClient; |
| 6 | 7 | use Meema\MeemaApi\Models\Folder; |
| 7 | 8 | |
| @@ -29,19 +30,31 @@ class Client | ||
| 29 | 30 | */ |
| 30 | 31 | public function __construct($accessKey) |
| 31 | 32 | { |
| 33 | $this->initializeEnv(); | |
| 34 | ||
| 32 | 35 | $this->accessKey = $accessKey; |
| 33 | 36 | $this->client = new GuzzleClient([ |
| 34 | 'base_uri' => 'http://meema-api.test/api/', | |
| 37 | 'base_uri' => $_ENV['BASE_URL'], | |
| 35 | 38 | ]); |
| 36 | 39 | } |
| 37 | 40 | |
| 41 | /** | |
| 42 | * Initialize env variables. | |
| 43 | * | |
| 44 | * @return void | |
| 45 | */ | |
| 46 | public function initializeEnv(): void | |
| 47 | { | |
| 48 | $dotenv = Dotenv::createImmutable(dirname(__DIR__)); | |
| 49 | $dotenv->load(); | |
| 50 | } | |
| 51 | ||
| 38 | 52 | /** |
| 39 | 53 | * Handle the API request. |
| 40 | 54 | * |
| 41 | 55 | * @param string $method |
| 42 | 56 | * @param string $path |
| 43 | 57 | * |
| 44 | * @return array | |
| 45 | 58 | */ |
| 46 | 59 | public function request($method, $path, $data = null) |
| 47 | 60 | { |