setMessage( "'%elementLabel%' is less than %min% characters long. (%actualLength% character(s) entered)", self::TOO_SHORT ); $this->setMessage( "'%elementLabel%' is more than %max% characters long. (%actualLength% characters entered)", self::TOO_LONG ); $this->_messageVariables['elementLabel'] = '_elementLabel'; $this->_messageVariables['actualLength'] = '_actualLength'; if (array_key_exists('elementLabel', $options)) { $this->setElementLabel($options['elementLabel']); unset($options['elementLabel']); } else { $this->setElementLabel('NOT DEFINED'); } parent::__construct($options); } public function setElementLabel($label) { $this->_elementLabel = $label; return $this; } public function getElementLabel() { return $this->_elementLabel; } public function isValid($value) { if (!is_string($value)) { $this->_error(self::INVALID); return false; } if (null !== $this->_encoding) { $this->_actualLength = iconv_strlen($value, $this->_encoding); } else { $this->_actualLength = iconv_strlen($value); } return parent::isValid($value); } }