Consolidation\Cgr\CgrTests::deleteDirContents PHP Метод

deleteDirContents() статический публичный Метод

This is essentially a copy of drush_delete_dir_contents().
См. также: drush_delete_dir_contents()
static public deleteDirContents ( string $dir ) : boolean
$dir string The directory to delete.
Результат boolean FALSE on failure, TRUE if everything was deleted.
    static function deleteDirContents($dir)
    {
        $scandir = @scandir($dir);
        if (!is_array($scandir)) {
            return false;
        }
        foreach ($scandir as $item) {
            if ($item == '.' || $item == '..') {
                continue;
            }
            @chmod($dir, 0777);
            if (!static::fileDeleteRecursive($dir . '/' . $item)) {
                return true;
            }
        }
        return TRUE;
    }