ruleset->applyParameterDefaults($inputParameters); $nodes = $this->ruleset->getNodes(); $conditions = $this->ruleset->getConditions(); $library = $this->ruleset->standardLibrary; $ref = $this->ruleset->getRoot(); while (true) { if ($ref >= self::RESULT_OFFSET) { return $this->resultResolver->resolve( $ref - self::RESULT_OFFSET, $inputParameters ); } if ($ref === self::TERMINAL_TRUE || $ref === self::TERMINAL_FALSE) { // Throws exception $this->resultResolver->resolveNoMatch($inputParameters); } $isComplement = $ref < 0; $base = ($isComplement ? -$ref : $ref) * 3 - 3; $condIndex = $nodes[$base]; $value = $library->callFunction( $conditions[$condIndex], $inputParameters ); $condResult = ($value !== null && $value !== false); // Complement edges invert the high/low selection without // duplicating nodes in the BDD. $ref = ($condResult xor $isComplement) ? $nodes[$base + 1] : $nodes[$base + 2]; } } }