Example #1
0
 /**
  * Zip validator.
  *
  * @param $zip
  * @return bool
  */
 public function validateZip($zip)
 {
     $zip = $this->clearZip($zip);
     if ($this->country->getZipLength() && strlen($zip) !== $this->country->getZipLength()) {
         $this->addError(sprintf("Wrong zip length: in %s zip length is %s not %s.", $this->country->getId(), $this->country->getZipLength(), strlen($zip)));
         return false;
     }
     return $zip;
 }