/** * Executes an API call * @param string $method API method to call * @param array $params Array of parameters * @return array * @access private */ protected function execute($method, array $params = []) { $array = array($this->apiKey); if (!empty($params)) { $array[1] = $params; } if ($this->isBatch) { $this->client->call($method, $array); return $this; } else { $this->client->call($method, $array); $response = json_decode($this->client->output, true); return isset($response['result']) ? $response['result'] : $response['error']; } }