/** * Return ModelInterface * * @param * int|null Id of resource to get * @return ModelInterface */ protected function _get($id = null) { $api = $this; $this->api->setApi('get', function ($params) use($api) { $url = $api->getUrl(); if (isset($params[0])) { $url .= '/' . $params[0]; } return array('url' => $url, 'header' => array('Content-Type' => 'application/json'), 'method' => 'GET', 'response' => array('format' => 'json', 'valid_codes' => array(200, 203))); }); if ($result = $this->api->get($id)) { $resultSet = clone $this->getResultSetPrototype(); $resultSet->initialize($result['Data']); return $resultSet->current(); } return $result; }