/** * Sets the validation failure message template for a particular key * Adds the ability to set messages to the attached hostname validator * * @param string $messageString * @param string $messageKey OPTIONAL * @return AbstractValidator Provides a fluent interface */ public function setMessage($messageString, $messageKey = null) { if ($messageKey === null) { $this->options['hostnameValidator']->setMessage($messageString); parent::setMessage($messageString); return $this; } if (!isset($this->messageTemplates[$messageKey])) { $this->options['hostnameValidator']->setMessage($messageString, $messageKey); } else { parent::setMessage($messageString, $messageKey); } return $this; }
/** * Sets the validation failure message template for a particular key * Adds the ability to set messages to the attached hostname validator * * @param string $messageString * @param string $messageKey OPTIONAL * @return \Zend\Validator\AbstractValidator Provides a fluent interface * @throws \Zend\Validator\Exception */ public function setMessage($messageString, $messageKey = null) { if ($messageKey === null) { $this->_options['hostname']->setMessage($messageString); parent::setMessage($messageString); return $this; } if (!isset($this->_messageTemplates[$messageKey])) { $this->_options['hostname']->setMessage($messageString, $messageKey); } $this->_messageTemplates[$messageKey] = $messageString; return $this; }