Esempio n. 1
0
 /**
  * Creates a new Validation Combo. You can pass as many validators as you want.
  * 
  * @param array|Validator $... The validators to check (list as arguments or in an array).
  */
 public function __construct()
 {
     $validators = func_get_args();
     if (count($validators) == 1 and is_array($validators[0])) {
         $validators = $validators[0];
     }
     foreach ($validators as $arg) {
         if (!$arg instanceof Validator) {
             throw new \InvalidArgumentException(Intl\GetText::_d('Flikore.Validator', 'The arguments must be intances of validators'));
         }
         array_push($this->validators, $arg);
     }
 }
Esempio n. 2
0
 /**
  * Applies the template message to a formed one.
  * @return string The formed message.
  */
 protected function applyTemplate()
 {
     $message = Intl\GetText::_d('Flikore.Validator', $this->message);
     foreach ($this->values as $key => $value) {
         $message = str_replace("%{$key}%", Intl\GetText::_d('Flikore.Validator', $value), $message);
     }
     return $message;
 }