src/Collection.php
public function add($item)
    {
        if (is_array($item)) {
            foreach ($item as $element) {
                $this->add($element);
            }
        } else if (! $this->contains($item->path())) {
            $this->items[$item->path()] = [
                'instance' => $item,
                'listener_index' => $item->addPathListener([$this, 'updatePath'])
            ];
        }
        return $this;
    }
public function add($item)
    {
        if (is_array($item)) {
            foreach ($item as $element) {
                $this->add($element);
            }
        } else if (! $this->contains($item->path())) {
            $this->items[$item->path()] = [
                'instance' => $item,
                'listener_index' => $item->addPathListener([$this, 'updatePath'])
            ];
        }
        return $this;
    }
public function add ( $ item ) { if ( is_array ( $ item ) ) { foreach ( $ item as $ element ) { $ this -> add ( $ element ) ; } } else if ( ! $ this -> contains ( $ item -> path ( ) ) ) { $ this -> items [ $ item -> path ( ) ] = [ 'instance' => $ item , 'listener_index' => $ item -> addPathListener ( [ $ this , 'updatePath' ] ) ] ; } return $ this ; }
Adds new items to the collection. If an
item already exists It will be ignored.

@param Tarsana\Filesystem\Interfaces\AbstractFile|array $item
@return self
Adds new items to the collection . If an item already exists It will be ignored .