Determine if the given path is a directory.

@param   string  $directory
@return  bool
438907
public function isDirectory($directory)
	{
		$directory = Util::normalizePath($directory);

		return (bool) $this->adapter->isDirectory($directory);
	}
845958
public static function exists(string $dir = ''): bool
    {
        $dir = static::normalizePath($dir);
        return static::verifyPath($dir) && \file_exists($dir) && \is_dir($dir);
    }
644272
public function delDir($dir)
    {
        $dir = $this->checkpath($dir);
        if (@!ftp_rmdir($this->linkid, $dir)) {
            $this->close();
            return false;
        }
        $this->close();
        return true;
    }
1105682
public function toDirectory($directory)
    {
        $this->directory = trim($this->sanitizePath($directory), DIRECTORY_SEPARATOR);

        return $this;
    }
811822
public function setDirectory($directory)
    {
        $this->directory = $directory . DIRECTORY_SEPARATOR . $this->id;
        if (file_exists($this->directory) === false) {
            mkdir($this->directory, $this->fileMode, true);
        }
    }
319279
protected function isDirectory($path)
    {
        $location = $this->applyPathPrefix($path);

        if (empty($location)) {
            return true;
        }

        try {
            $file = $this->share->stat($location);
        } catch (NotFoundException $e) {
            return false;
        }

        return $file->isDirectory();
    }
128916
protected function assertDirectory($directory)
	{
		if ( !is_string($directory) || !is_dir($directory) || !file_exists($directory) ) {
			throw new \InvalidArgumentException('Directory "' . $directory . '" is invalid');
		}

		return $directory;
	}
854839
public static function delTree($directory)
    {

        $files = array_diff(scandir($directory), array('.','..'));
		foreach ($files as $file) {
			$abspath = $directory.DIRECTORY_SEPARATOR.$file;
			if (is_dir($abspath)) {
				self::delTree($abspath);
			} else {
				unlink($abspath);
			}
		}
		return rmdir($directory);

    }
1309147
private function createDirectory($directory)
    {
        if (is_dir($directory)) {
            return;
        }

        if (false === @mkdir($directory, 0777, true)) {
            throw new \RuntimeException(sprintf('Could not create directory "%s".', $dir));
        }
    }
1256191
public function hasDirectory(string $id): bool
    {
        if (isset($this->directories[$id])) {
            return true;
        }

        $path = $this->getDirectoryPath($id);

        if ($this->filesystem->has($path)) {
            $info = $this->filesystem->getMetadata($path);

            return $info['type'] === 'dir';
        }

        return false;
    }
717020
public function isIn($dir) {
		if(!$this->formatPath($dir))
			return false;
		return strpos($this->formatPath($this->src()), $this->formatPath($dir)) === 0;
	}
82817
public static function rmDir($dir)
    {
        if (!file_exists($dir)) {
            return true;
        }
        if (!is_dir($dir)) {
            return unlink($dir);
        }
        foreach (scandir($dir) as $item) {
            if ($item == '.' || $item == '..') {
                continue;
            }
            if (!Paths::rmDir($dir . DIRECTORY_SEPARATOR . $item)) {
                return false;
            }

        }
        return rmdir($dir);
    }
1240093
public static function mkdir($path): bool
    {
        if (is_dir($path)) {
            return true;
        }

        if (dirname($path) && !is_dir(dirname($path))) {
            self::mkdir(dirname($path));
        }

        try {
            mkdir($path);

            return true;
        } catch (Throwable $ex) {
            return false;
        }
    }
1244629
protected function watchAllDirectories($directory)
    {
        $directory = rtrim($directory, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;

        if (! $this->watchDirectory($directory)) {
            return false;
        }

        $names = scandir($directory);

        foreach ($names as $name) {
            if (in_array($name, ['.', '..'], true)) {
                continue;
            }

            $subdirectory = $directory . $name;

            if (is_dir($subdirectory)) {
                $this->watchAllDirectories($subdirectory);
            }
        }

        return true;
    }
123054
public function directoryLength($directory = '')
    {
        if ($items = glob($this->rootDir .'/'. trim($directory, '/') .'/*')) {
            return count($items);
        }

        return 0;
    }
590969
public function getDir($directory)
    {
        $directory = str_replace('/', DS, $directory);
        if (strpos($directory, $this->getBaseDir()) === false || !file_exists($directory)) {
            $directory = $this->getBaseDir() . DS . ltrim($directory, DS);
        }
        return $directory;
    }
898077
protected function find($directory)
    {
        if (!file_exists($directory) || !is_dir($directory) || !is_readable($directory)) {
            return false;
        }

        $iterator = new \RecursiveDirectoryIterator(realpath($directory));
        return new \RecursiveIteratorIterator($iterator);
    }