Skip to content

Commit

Permalink
just little adjust
Browse files Browse the repository at this point in the history
  • Loading branch information
thalysontest committed Apr 30, 2018
1 parent addaa21 commit 86c0e8e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/app/Validation/EmailValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,23 @@ public static function validate(\stdClass $object) {
if (!isset($object->email))
self::setError(1, 'email', 'Not configured email field (implementation error)');

if (!isset($object->url_client))
self::setError(1, 'url_client', 'Not configured url_client field (implementation error)');
if (!isset($object->url))
self::setError(1, 'url', 'Not configured url field (implementation error)');

if (self::$countErrors > 0)
return ['success' => false, 'log' => self::getErrors()];

if (!v::notEmpty()->validate($object->email))
self::setError(2, 'email', 'Email field can not be empty');

if (!v::notEmpty()->validate($object->url_client))
self::setError(2, 'url_client', 'URL Client field can not be empty');
if (!v::notEmpty()->validate($object->url))
self::setError(2, 'url', 'URL Client field can not be empty');

if (!v::email()->validate($object->email))
self::setError(4, 'email', 'Invalid e-mail address');

if (!filter_var($object->url_client, FILTER_VALIDATE_URL))
self::setError(14, 'url_client', 'Client url is invalid');
if (!filter_var($object->url, FILTER_VALIDATE_URL))
self::setError(14, 'url', 'Client url is invalid');

return self::$countErrors > 0? ['success' => false, 'log' => self::getErrors()]: ['success' => true];
}
Expand Down

0 comments on commit 86c0e8e

Please sign in to comment.