GraphAware\Reco4PHP\Post\RecommendationSetPostProcessor::handleResultSet PHP Method

handleResultSet() final public method

final public handleResultSet ( GraphAware\Common\Type\Node $input, GraphAware\Common\Result\Result $result, Recommendations $recommendations )
$input GraphAware\Common\Type\Node
$result GraphAware\Common\Result\Result
$recommendations GraphAware\Reco4PHP\Result\Recommendations
    public final function handleResultSet(Node $input, Result $result, Recommendations $recommendations)
    {
        $recordsMap = [];
        foreach ($result->records() as $i => $record) {
            if (!$record->hasValue($this->idResultName())) {
                throw new \InvalidArgumentException(sprintf('The record does not contain a value with key "%s" in "%s"', $this->idResultName(), $this->name()));
            }
            $recordsMap[$record->get($this->idResultName())] = $record;
        }
        foreach ($recommendations->getItems() as $recommendation) {
            if (array_key_exists($recommendation->item()->identity(), $recordsMap)) {
                $this->postProcess($input, $recommendation, $recordsMap[$recommendation->item()->identity()]);
            }
        }
    }