public static function getInstance($fullpath, Method $method, $response) { if ($method->equals(Method::DELETE)) { return true; } $endpoint = explode('/', preg_replace("/[0-9]+/", "Id", rtrim($fullpath, '/'))); if (count($endpoint) - 2 >= 0 && end($endpoint) === 'Id') { $path = mb_convert_case($endpoint[count($endpoint) - 2], MB_CASE_TITLE) . end($endpoint); } else { $path = mb_convert_case(end($endpoint), MB_CASE_TITLE); } $class = __NAMESPACE__ . '\\' . $path . $method->value(); return new $class($response); }
private function __construct($path) { $this->_path = $path; $this->_method = Method::GET(); $this->_query = array(); $this->_header = array(); $this->_content = array(); }
protected function getRequest($path = '') { return $this->exec($path, Method::GET(), $this->request($path)->setQuery($this->paramWithReset())); }
public function createTask(Param\CreateTask $param) { $this->setParam($param); return $this->postRequest(Method::POST(), 'tasks'); }