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;
 }
Example #2
0
 public function let(Country $country)
 {
     $country->setZipLength(8);
     $this->beConstructedWith($country);
 }
Example #3
0
 /**
  * Get all available countries.
  *
  * @return mixed
  */
 public function getAvailableCountries()
 {
     return $this->country->all();
 }