Example #1
0
 /**
  * @param mixed               $item
  * @param CollectionInterface $collection
  *
  * @return bool
  */
 public function __invoke($item, CollectionInterface $collection)
 {
     if (self::VALIDATE_KEY === $this->mode) {
         return !$collection->has($item);
     }
     return !$collection->contains($item, $this->strict);
 }
Example #2
0
 /**
  * @param CollectionInterface $from
  * @param CollectionInterface $to
  *
  * @return Collection
  */
 private function getNew(CollectionInterface $from, CollectionInterface $to)
 {
     $added = [];
     foreach ($to as $name => $element) {
         if (!$from->has($name)) {
             $added[$name] = $element;
         }
     }
     return new Collection($added);
 }