public function collection(string $identifier, ?Closure $callback = null) : Collection {
        if ( ! isset($this->collections[$identifier])) {
            $directory = $this->prepareDefaultDirectory();

            $this->collections[$identifier] = new Collection($directory, $identifier);
        }

        // If the collection has been given a callable closure then we'll execute the closure with
        // the collection instance being the only parameter given. This allows users to begin
        // using the collection instance to add assets.
        if (is_callable($callback)) {
            call_user_func($callback, $this->collections[$identifier]);
        }

        return $this->collections[$identifier];
    }
public function collection(string $identifier, ?Closure $callback = null) : Collection {
        if ( ! isset($this->collections[$identifier])) {
            $directory = $this->prepareDefaultDirectory();

            $this->collections[$identifier] = new Collection($directory, $identifier);
        }

        // If the collection has been given a callable closure then we'll execute the closure with
        // the collection instance being the only parameter given. This allows users to begin
        // using the collection instance to add assets.
        if (is_callable($callback)) {
            call_user_func($callback, $this->collections[$identifier]);
        }

        return $this->collections[$identifier];
    }
public function collection ( string $ identifier , ? Closure $ callback = null ) : Collection { if ( ! isset ( $ this -> collections [ $ identifier ] ) ) { $ directory = $ this -> prepareDefaultDirectory ( ) ; $ this -> collections [ $ identifier ] = new Collection ( $ directory , $ identifier ) ; } // If the collection has been given a callable closure then we'll execute the closure with // the collection instance being the only parameter given. This allows users to begin // using the collection instance to add assets. if ( is_callable ( $ callback ) ) { call_user_func ( $ callback , $ this -> collections [ $ identifier ] ) ; } return $ this -> collections [ $ identifier ] ; }
Create or return an existing collection.
Create or return an existing collection .