} } else { throw new InvalidArgumentException('Need arguments to UPDATA data !'); } } catch (InvalidArgumentException $e) { print $e->getMessage(); exit; } break; case 'post': try { $comment = new Comment(); $data_comment = $http->getRequestVars(); $commentObject = initObject($data_comment, $comment, true); if (!emptyObject($commentObject)) { $userMapper = new UserMapper(); if ($userMapper->sendComment($commentObject)) { Rest::sendResponse(200); } } else { throw new InvalidArgumentException('Need arguments to POST data !'); } } catch (InvalidArgumentException $e) { print $e->getMessage(); exit; } break; default: Rest::sendResponse(501); break; }