/** * Request method * * @param string $httpMethod * @param string $path * @param array $params * @param string $version * @param bool $isAuthorization * * @return Response * @throws ClientException * @throws AuthorizeException * @throws ServerException * @throws Error */ public function request($httpMethod = 'GET', $path = '', $params = array(), $version = '', $isAuthorization = false) { if ($httpMethod != 'GET') { $post_params = array(); if (!$isAuthorization) { $post_params['access_token'] = $this->accessToken; $api_callback = ApiHelper::getBetween($path, 'admin/', '.json'); $parser = explode('/', $api_callback); $api_callback = substr($parser[0], 0, -1); //get singular string by remove last s //TODO: get proper singular string for '-es' case. if (!empty($params)) { $post_params[$api_callback] = $params; } } else { $post_params['staff'] = $params; } $params = $post_params; } else { //add access_token to GET api $params['access_token'] = $this->accessToken; } return $this->strategy->request($httpMethod, $this->apiUrl . $path, $params, $version, $isAuthorization); }