src/Data/DefaultCollection.php
public function intersect($collection)
    {
        $intersection = new DefaultCollection();
        /** @var ModelInterface $localModel */
        foreach ($this as $localModel) {
            /** @var ModelInterface $otherModel */
            foreach ($collection as $otherModel) {
                if (($localModel->getProviderName() === $otherModel->getProviderName())
                    && ($localModel->getId() === $otherModel->getId())
                ) {
                    $intersection->push($localModel);
                }
            }
        }

        return $intersection;
    }
public function intersect($collection)
    {
        $intersection = new DefaultCollection();
        /** @var ModelInterface $localModel */
        foreach ($this as $localModel) {
            /** @var ModelInterface $otherModel */
            foreach ($collection as $otherModel) {
                if (($localModel->getProviderName() === $otherModel->getProviderName())
                    && ($localModel->getId() === $otherModel->getId())
                ) {
                    $intersection->push($localModel);
                }
            }
        }

        return $intersection;
    }
public function intersect ( $ collection ) { $ intersection = new DefaultCollection ( ) ; /** @var ModelInterface $localModel */ foreach ( $ this as $ localModel ) { /** @var ModelInterface $otherModel */ foreach ( $ collection as $ otherModel ) { if ( ( $ localModel -> getProviderName ( ) === $ otherModel -> getProviderName ( ) ) && ( $ localModel -> getId ( ) === $ otherModel -> getId ( ) ) ) { $ intersection -> push ( $ localModel ) ; } } } return $ intersection ; }
Intersect the given collection with this collection and return the result.

@param CollectionInterface $collection The collection to intersect.

@return CollectionInterface
Intersect the given collection with this collection and return the result .