Example #1
0
 /**
 	Attachs a value to the validator.
 
 	$mValue must be either a string, an instance of Printable or an object castable to string.
 
 	@param	$mValue	The value to attach.
 	@return	$this	Used to chain methods.
 	@throw	DomainException $mValue is not of a correct type.
 */
 public function setValue($mValue)
 {
     if (is_object($mValue)) {
         if ($mValue instanceof Printable) {
             $mValue = $mValue->toString();
         } elseif (method_exists($mValue, '__toString')) {
             $mValue = (string) $mValue;
         }
     }
     is_string($mValue) or burn('DomainException', _WT('$mValue is not of a correct type.'));
     return parent::setValue($mValue);
 }
Example #2
0
 /**
 	Validates the given input.
 
 	@throw	IllegalStateException	The validator is not attached to a form widget.
 */
 public function validate()
 {
     $this->oWidget !== null or burn('IllegalStateException', _WT('The validator is not attached to a form widget.'));
     return parent::validate();
 }