Exemplo n.º 1
0
 /**
  * Validate
  *
  * @param int|string $rawvalue
  * @return int|string
  */
 public function validate($rawvalue)
 {
     $rawvalue = parent::validate($rawvalue);
     $mail = $this->config['prefix'] . $rawvalue . $this->config['postfix'];
     if (!mail_isvalid($mail)) {
         throw new ValidationException('Mail invalid', $mail);
     }
     return $rawvalue;
 }
Exemplo n.º 2
0
 /**
  * The final string should be an URL
  *
  * @param string $rawvalue
  * @return int|string|void
  */
 public function validate($rawvalue)
 {
     $rawvalue = parent::validate($rawvalue);
     $url = $this->buildURL($rawvalue);
     $schemes = getSchemes();
     $regex = '^(' . join('|', $schemes) . '):\\/\\/.+';
     if (!preg_match("/{$regex}/i", $url)) {
         throw new ValidationException('Url invalid', $url);
     }
     return $rawvalue;
 }