src/helpers/FileHelper.php
public static function cleanDirectory(string $directory): bool
    {
        self::removeDirectory($directory);
        return self::createDirectory($directory);
    }
public static function cleanDirectory(string $directory): bool
    {
        self::removeDirectory($directory);
        return self::createDirectory($directory);
    }
public static function cleanDirectory ( string $ directory ) : bool { self :: removeDirectory ( $ directory ) ; return self :: createDirectory ( $ directory ) ; }
Empty the specified directory of all files and folders.

@param  string $directory
@return bool
@throws \yii\base\ErrorException
@throws Exception
Empty the specified directory of all files and folders .