Creates missing folders that are needed for the use of mask
@author Benjamin Butschell <bb@webprofil.at>
@return bool $success
767067
protected function createMissingFolders(): bool
    {
        $success = true;
        foreach (self::$folderPathKeys as $key) {
            $success = $success && $this->createFolder($this->extSettings[$key]);
        }
        $success = $success && $this->createFile($this->extSettings['json']);
        return $success;
    }
193036
public function create() {
        if ($this->exist()) {
            return true;
        }
        $args = explode('/', str_replace('\\', '/', $this->fullName));
        $directory = '';
        $result = true;
        foreach ($args as $item) {
            $directory .= $item . '/';
            if (!is_dir($directory) && !empty($directory)) {
                $result = mkdir($directory);
            }
        }
        return $result;
    }
1315175
public function createFolder($folder)
    {
        $folder = trim($folder, "/") . "/";

        if ($folder === "/") {
            return true;
        }

        // Fail if this pseudo directory key already exists
        if ($this->exists($folder)) {
            return true;
        }

        $response = $this->clientS3->putObject(array(
            'Bucket' => $this->bucket,
            'Key'    => $folder,
            'ACL'    => static::ACL_PUBLIC_READ,
            'Body'   => "",
        ));

        return (bool) $response;
    }
453159
protected function getMask()
    {

        $w = imagesx($this->driver->getResource());
        $h = imagesy($this->driver->getResource());
        $m = min($w, $h);

        $bg = imagecreatetruecolor($w, $h);

        $bg = $this->drawCirlce($bg, $w, $h, 255, 255, 255, 0);

        return $bg;
    }
784690
public function getDirectoryTreeList()
    {
        $finder = new Finder();
        $finder->in($this->rootPath)->directories();

        $directories = array();


        $rootFinder = new Finder();
        $rootFinder->in($this->rootPath)->depth(0);

        //Add root directory
        $directories[] = new Directory($this->virtualRootPath, $rootFinder->directories()->count(), $rootFinder->files()->count());

        foreach($finder as $dir){
            $dirFinder = new Finder();
            $dirFinder->in($dir->getPathname())->depth(0);

            $virtualAbsolutePath = substr($this->fs->makePathRelative($dir->getPathname(), $this->rootPath), 0, -1); //substring to remove last /

            $directories[] = new Directory($this->virtualRootPath .'/' . $virtualAbsolutePath, $dirFinder->files()->count(), $dirFinder->directories()->count());
        }

        return $directories;
    }
1219370
protected function createDirectories()
    {
        if (! is_dir($directory = resource_path('views/layouts'))) {
            mkdir($directory, 0755, true);
        }
        if (! is_dir($directory = resource_path('views/auth'))) {
            mkdir($directory, 0755, true);
        }
        if (! is_dir($directory = resource_path('views/partials'))) {
            mkdir($directory, 0755, true);
        }
    }
690222
private function getCacheFiles()
    {
        if (!($files = @scandir($this->directory, 1))) {
            return false;
        }

        $negExtLen = -1 * strlen($this->extension);
        $return = array();
        foreach ($files as $file) {
            if (substr($file, $negExtLen) === $this->extension) {
                $return[] = $this->directory . '/' . $file;
            }
        }
        return $return;
    }
936301
public function createDirs()
    {
        if (!is_dir($this->getMediaPath())) {
            mkdir($this->getMediaPath());
        }

        if (!is_dir($this->getThumbnailPath())) {
            mkdir($this->getThumbnailPath());
        }
    }
186906
public function createCache()
    {
        // Check if there are files in the cache.
        // If not we will fill the cache, if there are we will check if there have been any changes to the enforced dirs
        $fileIterator = new \FilesystemIterator($this->getConfig()->getValue('cache/dir'), \FilesystemIterator::SKIP_DOTS);
        if (iterator_count($fileIterator) <= 1 || $this->getConfig()->getValue('environment') === 'development') {
            // Fill the cache
            $this->fillCache();

        } else {
            if (!$this->structureMap->isRecent()) {
                $this->refillCache();
            }
        }
    }
1291667
protected function findFiles()
    {
        // Add php files.
        $finder = new Finder();
        $finder
            ->files()
            // Ignore version control system folder.
            ->ignoreVCS(true)
            // Do not add tests folders.
            ->exclude('Tests')
            ->exclude('tests')
            // Do not add composer backup folder.
            ->exclude('composer.bak');

        if (!empty($this->excludeFiles)) {
            foreach ($this->excludeFiles as $file) {
                $finder->notPath($file);
            }
        }

        return $finder;
    }
563285
protected function createDirectoryIfNotExists()
    {
        if (!is_dir($this->getPath())) {
            $this->files->makeDirectory($this->getPath(), 0755, true);
        }
    }
374855
public function createDirectory($folder)
    {
        $folder = $this->cleanFolder($folder);
        if ($this->disk->exists($folder)) {
            $this->errors[] = 'Folder "'.$folder.'" already exists.';

            return false;
        }

        return $this->disk->makeDirectory($folder);
    }
266063
public function dirs($paths = false, $createMissing = false)
    {
        if ($paths === false) {
            return $this->find('*')->dirs();
        }

        $list = new Collection;
        foreach ($paths as $path) {
            $list->add($this->dir($path, $createMissing));
        }
        return $list;
    }
1107150
private function makeViewDirectory()
    {


        if (file_exists(base_path($this->folderPath)))
        {

            $this->error($this->theModel. ' folder already exists!');

            die();

        }

        mkdir(base_path($this->folderPath));

        return $this;
    }
765998
protected function prepareFilesystemAccess()
    {
        $directory = $this->getDirectory();

        // Convert relative paths to absolute. Cause it looks like the __destruct has problems with relative paths
        if ($this->unix && DIRECTORY_SEPARATOR !== $directory{0}) {
            $directory = realpath(getcwd().DIRECTORY_SEPARATOR.$directory).DIRECTORY_SEPARATOR;
        }

        // Check if a trailing slash is in directory -> we require
        if ($directory{strlen($directory) - 1} != DIRECTORY_SEPARATOR) {
            $directory .= DIRECTORY_SEPARATOR;
        }

        if (!file_exists($directory) && !is_dir($directory)) {
            if (mkdir($directory, 0755)) {
                throw new Doozr_Cache_Service_Exception(
                    sprintf('Directory "%s" for caching could not be created!', $directory)
                );
            }
        }

        $this->setDirectory($directory);

        return $this;
    }
593133
public function getFiles()
    {
        $iterator = new RecursiveDirectoryIterator(
            $this->directory,
            FilesystemIterator::SKIP_DOTS
        );
        $iterator = new RecursiveIteratorIterator($iterator);
        $iterator->rewind();

        return $iterator;
    }
582045
protected function makeBackup()
    {
        $path_plain      = $this->getPlainPath();
        $path_obfuscated = $this->getObfuscatedPath();
        $path_backup     = $this->getBackupPath();

        // Renomeia o diretório com os arquivos originais
        // para um novo diretório de backup
        if (is_dir($path_backup) == true) {
            $this->getObfuscator()->addRuntimeMessage('A previous backup already exists!');
            return false;

        } elseif(rename($path_plain, $path_backup) === false) {
            $this->getObfuscator()->addErrorMessage('Could not back up. Operation canceled!');
            return false;
        }

        // Renomeia o diretório com os arquivos ofuscados
        // para ser o novo diretório em execução
        if(rename($path_obfuscated, $path_plain) === false) {
            $this->getObfuscator()->addErrorMessage('Obfuscated directory could not become the main directory!');
            return false;
        }

        // Renomeia os includes do autoloader
        if ($this->prepareAutoloaderFile() == false) {
            $this->getObfuscator()->addErrorMessage('Unable to prepare autoloader file!');
            return false;
        }

        return true;
    }