Skip to content

Commit

Permalink
Add data sanitize in validator
Browse files Browse the repository at this point in the history
  • Loading branch information
dvlpp committed Nov 3, 2015
1 parent f2e666d commit 2c89247
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Dvlpp/Sharp/Validation/SharpValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,17 @@ public function validate($input, $instanceId = null)
$this->getInstanceId() ? $this->getUpdateRules() : $this->getCreationRules()
);

// Sanitize ?
$input = $this->sanitize($input);

// and validate
$validation = Validator::make($input, $rules, $this->getMessages());

if ($validation->fails()) {
throw new ValidationException($validation->messages());
}

return true;
return $input;
}

public function isCreation()
Expand Down Expand Up @@ -93,4 +96,9 @@ public function getMessages()
{
return $this->messages;
}

public function sanitize(Array $input)
{
return $input;
}
}

0 comments on commit 2c89247

Please sign in to comment.