public static function deleteDirectory($path)
    {
        if (!is_dir($path)) {
            return false;
        }

        $files = array_diff(scandir($path), ['.', '..']);
        foreach ($files as $file) {
            $inner_file = static::join($path, $file);
            if (is_dir($inner_file)) {
                // Delete inner directory recursive
                static::deleteDirectory($inner_file);
            } else {
                // Delete file
                unlink($inner_file);
            }
        }

        return rmdir($path);
    }