/** * Set to * * @param string $email * @param string $name * @return Email */ public function setTo($email, $name = '') { if (Validation::isEmail($email)) { empty($name) ? $this->emails[] = $email : ($this->emails[$name] = $email); } return $this; }
public function defaultAction() { if (helpers\Input::exists() && helpers\Token::check(helpers\Input::get('token'))) { $valid = helpers\Validation::check(array('username' => array('required' => true, 'name' => 'Username'), 'password' => array('required' => true, 'name' => 'Password'))); if (empty($valid->errors())) { } else { foreach ($valid->errors() as $error) { } } } }
public static function isValid(Attributes $object) { if (array_key_exists('Required', $object->_allOptions)) { if (!Validation::Email($object->_value)) { ModelState::addError("O campo " . $object->_displayName . " deve ser um e-mail."); } } else { if (!Validation::Email($object->_value) && $object->_value != '') { ModelState::addError("O campo " . $object->_displayName . " deve ser um e-mail."); } } }
public static function isValid(Attributes $object) { $explode = explode(',', $object->_arg); if (count($explode) == 2) { $min = $explode[0]; $max = $explode[1]; } else { $max = $object->_arg; $min = 0; } if (!Validation::Lenght($object->_value, $max, $min) && ($object->_required || Validation::Required($object->_value))) { ModelState::addError("O campo " . $object->_displayName . " deve conter " . ($min > 0 ? "no mínimo " . $min . " e " : "") . "no máximo " . $max . " caracteres."); } }
public static function isValid(Attributes $object) { $explode = explode(',', $object->_arg); if (count($explode) == 2) { $min = $explode[0]; $max = $explode[1]; } else { $max = $object->_arg; $min = 0; } if (!Validation::Number($object->_value)) { return ModelState::addError("O campo " . $object->_displayName . " deve ser um número."); } if (!Validation::Range($object->_value, $max, $min)) { ModelState::addError("O campo " . $object->_displayName . " deve estar dentro do intervalo de " . $min . " e " . $max . "."); } }
public static function isValid(Attributes $object) { if (!Validation::Required($object->_value)) { ModelState::addError("O campo " . $object->_displayName . " é obrigatório."); } }
public static function isValid(Attributes $object) { if (!Validation::Date($object->_value)) { ModelState::addError("O campo " . $object->_displayName . " deve ser uma data."); } }