/** * @param Rule $rule * @param WorkingMemory $workingMemory * * @return bool|mixed */ public function checkCondition(Rule $rule, WorkingMemory $workingMemory) { if ($rule instanceof RuleRunDecorator && $rule->hasConditionWildcards()) { $this->inferenceProfiler && $this->inferenceProfiler->setMatchingRuleCheckConditionWildcard(); $combinations = $rule->getWildcardCombinationRules(); if (!$combinations) { return false; } foreach ($combinations as $combinationRule) { $this->inferenceProfiler && $this->inferenceProfiler->addMatchingRuleCheckConditionWildcardCombinationCheck($combinationRule); if ($this->execCondition($combinationRule, $workingMemory)) { $rule->addSuccessCombinationRule($combinationRule); $this->inferenceProfiler && $this->inferenceProfiler->setMatchingRuleCheckConditionWildcardCombinationCheckSuccess(); } } return $rule->hasSuccessCombinationRules(); } else { return $this->execCondition($rule, $workingMemory); } }