Phulp\Phulp::clean PHP Method

clean() public method

public clean ( ) : phulp\PipeInterface
return phulp\PipeInterface
    public function clean()
    {
        return $this->iterate(function ($distFile) {
            /** @var DistFile $distFile */
            $file = rtrim($distFile->getFullpath(), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $distFile->getName();
            if (file_exists($file)) {
                @unlink($file);
                $currentDir = substr($file, 0, strrpos($file, DIRECTORY_SEPARATOR));
                while ($distFile->getBasepath() !== $currentDir) {
                    @rmdir($currentDir);
                    $currentDir = substr($currentDir, 0, strrpos($currentDir, DIRECTORY_SEPARATOR));
                }
            }
        });
    }