Exemplo n.º 1
0
 /**
  * @param $type
  * @param array $userDetails
  * @return bool
  * @throws EntityNotValidException
  */
 private function validateUser($type, array $userDetails = array())
 {
     if ($type == "register") {
         $validateUser = new RegisterUser($userDetails);
     } else {
         $validateUser = new UpdateUser($userDetails);
     }
     $validateUser->init();
     //Initializes the rules into the array from the config file
     if (!$validateUser->passes()) {
         $exception = new EntityNotValidException();
         $exception->setValidationErrors($validateUser->errors);
         throw $exception;
     }
     return true;
 }
 /**
  * @param $input
  * @return bool
  * @throws EntityNotValidException
  */
 private function validatePermission($input)
 {
     $permission = new CreatePermission($input);
     if (!$permission->passes()) {
         $exception = new EntityNotValidException();
         $exception->setValidationErrors($permission->errors);
         throw $exception;
     }
     return true;
 }