GraphAware\Reco4PHP\Result\Recommendations::remove PHP Метод

remove() публичный Метод

public remove ( Recommendation $recommendation )
$recommendation Recommendation
    public function remove(Recommendation $recommendation)
    {
        if (!array_key_exists($recommendation->item()->identity(), $this->recommendations)) {
            return;
        }
        unset($this->recommendations[$recommendation->item()->identity()]);
    }

Usage Example

 private function removeIrrelevant(Node $input, RecommendationEngine $engine, Recommendations $recommendations, array $blacklist)
 {
     foreach ($recommendations->getItems() as $recommendation) {
         if (array_key_exists($recommendation->item()->identity(), $blacklist)) {
             $recommendations->remove($recommendation);
         } else {
             foreach ($engine->filters() as $filter) {
                 if (!$filter->doInclude($input, $recommendation->item())) {
                     $recommendations->remove($recommendation);
                     break;
                 }
             }
         }
     }
 }
All Usage Examples Of GraphAware\Reco4PHP\Result\Recommendations::remove