protected function validate() { parent::validate(); if ($this->getIsValid() && !$this->getIsEmpty() && $this->getFormat() == 'US') { if (!preg_match('\\d{3}-\\d{3}-\\d{4}', $this->getValue())) { $this->errors[] = 'error.invalidPhone'; } } }