Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function isValid($email, $checkDNS = false, $strict = false)
 {
     try {
         $this->parser->parse((string) $email);
         $this->warnings = $this->parser->getWarnings();
     } catch (\Exception $e) {
         $rClass = new \ReflectionClass($this);
         $this->error = $rClass->getConstant($e->getMessage());
         return false;
     }
     $dnsProblemExists = $checkDNS ? !$this->checkDNS() : false;
     if ($this->hasWarnings() && (int) max($this->warnings) > $this->threshold) {
         $this->error = self::ERR_DEPREC_REACHED;
         return false;
     }
     return $strict ? !$this->hasWarnings() && !$dnsProblemExists : true;
 }