protected function doClean($value) { $clean = (string) $value; parent::doClean($clean); $length = function_exists('mb_strlen') ? mb_strlen($clean, $this->getCharset()) : strlen($clean); if ($this->hasOption('required') && $length == 0) { throw new sfValidatorError($this, 'required', array('value' => $value, 'required' => $this->getOption('required'))); } if ($this->hasOption('max_length') && $length > $this->getOption('max_length')) { throw new sfValidatorError($this, 'max_length', array('value' => $value, 'max_length' => $this->getOption('max_length'))); } return $clean; }
protected function doClean($values) { $values = parent::doClean($values); return implode($this->getOption('glue'), $values); }