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