endpoint) { $this->assign(self::first(self::list($endpoint, $params))); } } public static function first(array $array): array { return $array && is_array(array_values($array)[0]) ? $array[0] : $array; } public static function list(Endpoints $endpoint, array $params = []): array { $resp = (new Client())->call($endpoint->value)->params($params)->get(); return $resp->ok ? $resp->json() : []; } public function assign(array $row): self { $this->row = $row; return $this; } public function get(string $key): mixed { return $this->row[$key] ?? null; } }