Пример #1
0
 /**
  * @param array $rules
  */
 private function process(array $rules)
 {
     foreach ($rules as $key => $rule) {
         foreach (self::RULE_PATTERN as $class => $pattern) {
             if (preg_match($pattern, $rule, $matches)) {
                 $this->rules[$key] = RuleFactory::Make($class, $matches);
                 break;
             }
         }
     }
 }
Пример #2
0
 /**
  * Copied code from  KennedyTedesco/Validation.
  *
  * Validate if file exists.
  *
  * @param  string  $attribute
  * @param  mixed   $value
  * @param  array   $parameters
  *
  * @return bool
  */
 public function validateFileExists($attribute, $value, $parameters)
 {
     return RuleFactory::make('exists', [])->validate($value);
 }