vendor/kriswallsmith/assetic/src/Assetic/Util/FilesystemUtils.php

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php

/*
 * This file is part of the Assetic package, an OpenSky project.
 *
 * (c) 2010-2014 OpenSky Project Inc
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Assetic\Util;

/**
 * Filesystem utilities.
 *
 * @author Kris Wallsmith <kris.wallsmith@gmail.com>
 */
class FilesystemUtils
{
    /**
     * Recursively removes a directory from the filesystem.
     */
    public static function removeDirectory($directory)
    {
        $inner = new \RecursiveDirectoryIterator($directory, \FilesystemIterator::SKIP_DOTS);
        $outer = new \RecursiveIteratorIterator($inner, \RecursiveIteratorIterator::SELF_FIRST);

        // remove the files first
        foreach ($outer as $file) {
            if ($file->isFile()) {
                unlink($file);
            }
        }

        // remove the sub-directories next
        $files = iterator_to_array($outer);
        foreach (array_reverse($files) as $file) {
            /** @var \SplFileInfo $file */
            if ($file->isDir()) {
                rmdir($file);
            }
        }

        // finally the directory itself
        rmdir($directory);
    }

    /**
     * Creates a throw-away directory.
     *
     * This is not considered a "temporary" directory because it will not be
     * automatically deleted at the end of the request or process. It must be
     * deleted manually.
     *
     * @param string $prefix A prefix for the directory name
     *
     * @return string The directory path
     */
    public static function createThrowAwayDirectory($prefix)

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。