public function add($filename, FileInterface &$removed = null)
    {
        $this->initialize();

        $file = $this->matcher->getFile($filename);

        if (!$this->isStackable($file)) {
            throw new FileNotStackableException($file);
        }

        array_unshift($this->files, $file);

        if (count($this) > static::MAX_ITEMS) {
            $removed = array_pop($this->files);
        }

        $this->persist();

        return $file;
    }
public function add($filename, FileInterface &$removed = null)
    {
        $this->initialize();

        $file = $this->matcher->getFile($filename);

        if (!$this->isStackable($file)) {
            throw new FileNotStackableException($file);
        }

        array_unshift($this->files, $file);

        if (count($this) > static::MAX_ITEMS) {
            $removed = array_pop($this->files);
        }

        $this->persist();

        return $file;
    }
public function add ( $ filename , FileInterface & $ removed = null ) { $ this -> initialize ( ) ; $ file = $ this -> matcher -> getFile ( $ filename ) ; if ( ! $ this -> isStackable ( $ file ) ) { throw new FileNotStackableException ( $ file ) ; } array_unshift ( $ this -> files , $ file ) ; if ( count ( $ this ) > static :: MAX_ITEMS ) { $ removed = array_pop ( $ this -> files ) ; } $ this -> persist ( ) ; return $ file ; }
Add a file to the stack.

@param FileInterface|string $filename the file to add
@param FileInterface|null   $removed  returns the removed file, if one was removed

@throws FileNotStackableException if file is not stackable

@return FileInterface if filename cannot be matched to filesystem
Add a file to the stack .