@inheritdoc

Attention, for performance reasons method would cache all defined rules.
542401
public function getRules($rules): \Generator
    {
        foreach ($this->parser->split($rules) as $id => $rule) {
            if (empty($id) || $rule instanceof \Closure) {
                yield new CallableRule($rule);
                continue;
            }

            // fetch from cache
            if (isset($this->rules[$id])) {
                yield $this->rules[$id];
                continue;
            }

            $function = $this->parser->parseCheck($rule);
            $conditions = $this->parser->parseConditions($rule);

            $check = $this->makeRule(
                $this->config->mapFunction($function),
                $rule
            );

            yield $this->rules[$id] = $check->withConditions($this->makeConditions($conditions));
        }
    }
1186354
protected function canBeCached()
    {
        if ($this->getSecurityToken()->isEnabled()) {
            return false;
        }
        if ($this->FormMethod() !== 'GET') {
            return false;
        }

        // Don't cache if there are required fields, or some other complex validator
        $validator = $this->getValidator();
        if ($validator instanceof RequiredFields) {
            if (count($this->validator->getRequired())) {
                return false;
            }
        } else {
            return false;
        }
        return true;
    }
1110214
@Override
	public void cacheResult(CPRule cpRule) {
		entityCache.putResult(CPRuleModelImpl.ENTITY_CACHE_ENABLED,
			CPRuleImpl.class, cpRule.getPrimaryKey(), cpRule);

		cpRule.resetOriginalValues();
	}
1173533
function load() {
		var newRules = Rules.rules;
		Object.keys(newRules).forEach(function(ruleId) {
			define(ruleId, newRules[ruleId]);
		});
	}
554576
public function ensureProductionSettings() : void
    {
        $queryCacheImpl = $this->getQueryCacheImpl();

        if (! $queryCacheImpl) {
            throw QueryCacheNotConfigured::create();
        }

        if ($queryCacheImpl instanceof ArrayCache) {
            throw QueryCacheUsesNonPersistentCache::fromDriver($queryCacheImpl);
        }

        $metadataCacheImpl = $this->getMetadataCacheImpl();

        if (! $metadataCacheImpl) {
            throw MetadataCacheNotConfigured::create();
        }

        if ($metadataCacheImpl instanceof ArrayCache) {
            throw MetadataCacheUsesNonPersistentCache::fromDriver($metadataCacheImpl);
        }

        if ($this->getProxyManagerConfiguration()->getGeneratorStrategy() instanceof EvaluatingGeneratorStrategy) {
            throw ProxyClassesAlwaysRegenerating::create();
        }
    }
143411
private function addRule(RuleInterface $rule, int $priority): void
    {
        $this->queueOfRules->push($rule, $priority);
    }
1175039
protected function getRules()
    {
        if ($this->compiledRules === null) {
            $rules = array();
            foreach ($this->ruleFiles as $file) {
                $rules = array_merge(
                    $rules,
                    $this->parser->parse($file)
                );
            }

            $this->compiledRules = $this->compiler->compile($rules);
        }

        return $this->compiledRules;
    }
1279565
private function parseRule($rule, &$fields)
    {
        if(!isset($this->rulesCache[$rule]))
        {
            $fields = [];
            $rule = str_replace(['/', '\{', '\}'], ['\/', '{', '}'], preg_quote($rule));
            $this->rulesCache[$rule] = '/^' . preg_replace_callback(
                '/{([^}]+)}/i',
                function($matches)use(&$fields){
                    $fields[] = $matches[1];
                    return '(.+)';
                },
                $rule
            ) . '\/?$/';
        }
        return $this->rulesCache[$rule];
    }
842297
function cache($key, $value): void {
    $viewRenderer = $this->viewRenderer;
    if (!$viewRenderer->enableCaching) eval("?>$value");
    else {
      /** @var \yii\caching\Cache $cache */
      $cache = $viewRenderer->cache;
      $cache->set([__CLASS__, $key], $value, $viewRenderer->cachingDuration);
      $this->load($key);
    }
  }
171435
private function excludeIrrelevantRules(&$rules)
    {
        if (!empty($rules->rules)) {
            foreach ($rules->rules as $key => $limit) {
                if (
                    isset($limit->scope)
                    && CacheRepository::SCOPE_UTM_SOURCE === intval($limit->scope)
                    && strlen(trim($limit->value))
                    && trim($limit->value) !== $this->utmSource
                ) {
                    // This is a UTM Source limit, and we do not match it, so it is currently irrelevant to us.
                    unset($rules->rules[$key]);
                    continue;
                }
                if (
                    isset($limit->scope)
                    && CacheRepository::SCOPE_CATEGORY === intval($limit->scope)
                    && $limit->value
                    && $limit->value != $this->contactSource->getCategory()
                ) {
                    // This is a Category limit, and we do not match it, so it is currently irrelevant to us.
                    unset($rules->rules[$key]);
                    continue;
                }
            }
        }
    }
1092960
public function addRule(RuleInterface $rule): array
    {
        $this->getSerializer()->clearBlocksWithStart()->clearBlocksWithEnd();

        $result = [
            static::RULES_SINGLE_INDEX         => $this->getSerializer()->addBlock($rule->toBlock()),
            static::RULES_SINGLE_START_INDEXES => $this->getSerializer()->getBlocksWithStart(),
            static::RULES_SINGLE_END_INDEXES   => $this->getSerializer()->getBlocksWithEnd(),
        ];

        return $result;
    }
1024039
public function initializeObject()
    {
        if ($this->cache->has('rulesets') && $this->cache->has('rulesetsIndices')) {
            $this->rulesets = $this->cache->get('rulesets');
            $this->rulesetsIndices = $this->cache->get('rulesetsIndices');
        } else {
            $this->generateRulesets();
            $this->cache->set('rulesets', $this->rulesets);
            $this->cache->set('rulesetsIndices', $this->rulesetsIndices);
        }
    }
14987
public function executeRules(Context $context)
    {
        foreach ($this->rules as $rule) {
            $rule->execute($context);
        }
    }
1113830
public function filterableValidationRules() : array
    {
        $key = md5(vsprintf('%s', ['features_validationRules']));

        return Cache::remember($key, $this->remembering, function () {
            return $this->next->filterableValidationRules();
        });
    }
995786
public function addRule($rule, $method = null, $params = [], $message = null)
    {

        // construction des paramètres
        array_unshift($params, $rule, $method);

        call_user_func_array([$this->getValidator(), 'addRule'], $params);

        if (!is_null($message)) {
            if(is_array($message)){
                foreach($message as $rule => $message){
                    $this->getValidator()->addMessage($rule, $message);
                }
            }else{
                $this->getValidator()->addMessage($rule, $message);
            }
        }

        return $this;
    }
263762
public function reflect(RuleInterface $rule = null)
    {
        $this->setParameterValue($rule->getData());

        return $this->doReflect($rule);
    }
915888
protected function getRules()
    {
        if ($this->compiledRules === null) {
            $rules = array();

            foreach ($this->ruleFiles as $file) {
                $rules += require $file;
            }

            $this->compiledRules = $this->compiler->compile($rules);
        }

        return $this->compiledRules;
    }