GraphAware\Reco4PHP\Result\Recommendations::getOrCreate PHP Method

getOrCreate() public method

public getOrCreate ( GraphAware\Common\Type\Node $item ) : Recommendation
$item GraphAware\Common\Type\Node
return Recommendation
    public function getOrCreate(Node $item)
    {
        if (array_key_exists($item->identity(), $this->recommendations)) {
            return $this->recommendations[$item->identity()];
        }
        $recommendation = new Recommendation($item);
        $this->recommendations[$item->identity()] = $recommendation;
        return $recommendation;
    }