src/Data/DefaultCollection.php
public function diff($collection)
    {
        $diff = 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())
                ) {
                    continue;
                }
                $diff->push($localModel);
            }
        }

        return $diff;
    }
public function diff($collection)
    {
        $diff = 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())
                ) {
                    continue;
                }
                $diff->push($localModel);
            }
        }

        return $diff;
    }
public function diff ( $ collection ) { $ diff = 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 ( ) ) ) { continue ; } $ diff -> push ( $ localModel ) ; } } return $ diff ; }
Computes the difference of the collection.

@param CollectionInterface $collection The collection to compute the difference for.

@return CollectionInterface The collection containing all the entries from this collection that are not present
in the given collection.
Computes the difference of the collection .