Example #1
0
 private function overwriteExceptionParams(RuleException $exception)
 {
     $params = [];
     foreach ($exception->getParams() as $key => $value) {
         if (in_array($key, ['template', 'translator'])) {
             continue;
         }
         $params[$key] = $this->baseKey;
     }
     $exception->configure($this->comparedKey, $params);
     return $exception;
 }
Example #2
0
 public function __construct($dividend)
 {
     if (!is_numeric($dividend) || (int) $dividend != $dividend) {
         $message = 'Dividend %s must be an integer';
         throw new ComponentException(sprintf($message, RuleException::stringify($dividend)));
     }
     $this->dividend = (int) $dividend;
 }
 /**
  * @return bool
  */
 private function isRelated($name, RuleException $exception)
 {
     return $exception->getId() === $name || $exception->getName() === $name;
 }