Airship\Hangar\Commands\Assemble::cleanupWorkspace PHP Method

cleanupWorkspace() protected method

Recursively delete an entire directory
protected cleanupWorkspace ( string $dir ) : boolean
$dir string
return boolean
    protected function cleanupWorkspace(string $dir) : bool
    {
        $files = \array_diff(\scandir($dir), ['.', '..']);
        foreach ($files as $file) {
            if (\is_dir($dir . DIRECTORY_SEPARATOR . $file)) {
                $this->cleanupWorkspace($dir . DIRECTORY_SEPARATOR . $file);
            } else {
                \unlink($dir . DIRECTORY_SEPARATOR . $file);
            }
        }
        return \rmdir($dir);
    }