Exemplo n.º 1
0
 protected function check(UserFilterBuilder $ufb)
 {
     if ($ufb->blank($this->envfield) || $ufb->blank($this->envfieldcomp) || $ufb->blank($this->envfieldtype)) {
         $this->empty = true;
         return true;
     }
     $this->val = $ufb->i($this->envfield);
     $this->comp = $ufb->v($this->envfieldcomp);
     $this->type = $ufb->v($this->envfieldtype);
     if (!in_array($this->type, self::$validtypes)) {
         return $this->raise("Le critère {$this->type} n'est pas valide pour le champ %s");
     }
     if (!in_array($this->comp, self::$validcomps)) {
         return $this->raise("Le critère {$this->comp} n'est pas valide pour le champ %s");
     }
     if (preg_match('/^[0-9]{2}$/', $this->val)) {
         $this->val += 1900;
     }
     if ($this->val < 1900 || $this->val > 9999) {
         return $this->raise("Le champ %s doit être une année à 4 chiffres.");
     }
     return true;
 }