/** * Get all the products. * @param array $options * @return array */ public function all($options = array()) { $request = new Request($this->client); $path = "/products"; $data = array(); $response = $request->get($path, $data, $options); $returnValues = array(); // Handling for field products $a = array(); $body = $response->getBody(); foreach ($body['products'] as $v) { $tmp = new Product($this->client); $tmp->fillWithData($v); $a[] = $tmp; } $returnValues['Products'] = $a; return array_values($returnValues)[0]; }