Return the directory option

@return string|null
540601
protected function getDirOption($return_array = false)
    {
        if($dir = $this->option('dir')) {
            $directories = explode('/', $dir);
            if(is_array($directories) && $directories) {
                $directories = array_map(function($directory) {
                    return ucfirst(str::plural(strtolower($directory)));
                }, $directories);

                return $return_array === true ? $directories : rtrim(implode('/', $directories), '/\\') . '/';
            }
        }
    }
1031630
public static function envsDir()
    {
        if (!self::$envsDir) {
            return null;
        }
        return self::$dir . DIRECTORY_SEPARATOR . self::$envsDir . DIRECTORY_SEPARATOR;
    }
637807
public function getFileMode()
    {
        if (isset($this->raw->chmod)) {
            return intval($this->raw->chmod, 8);
        }

        return null;
    }
468691
public function getOption($option)
    {
        return isset($this->getOptions()[$option]) ? $this->getOptions()[$option] : null;
    }
121685
public function getRootDir()
    {
        static $dir;
        if (empty($dir)) {
            $rc = new \ReflectionClass(get_class($this));
            $dir = dirname(dirname($rc->getFileName()));
        }
        return $dir;
    }
952646
public function getBinDir(): string
    {
        $binDir = $this->config->getBinDir();
        if (!$this->fileSystem->exists($binDir)) {
            throw new RuntimeException('The configured BIN directory could not be found.');
        }

        return $this->getRelativePath($binDir);
    }
67243
public function getConfigPath()
    {
        if (null == $this->configPath) {
            $this->configPath = getcwd().'/Configuration';
            Configuration::addPath($this->configPath);
        }
        return $this->configPath;
    }
233892
private function getFolder()
    {
        $pathStr = $this->config[ 'savePath' ];
        if (strrchr($pathStr, '/') != '/') {
            $pathStr .= '/';
        }
        $pathStr .= date('Ymd');
        if (!file_exists($pathStr)) {
            if (!mkdir($pathStr, 0777, true)) {
                return false;
            }
        }

        return $pathStr;
    }
414726
public function getDir()
    {
        if ($this->dir === null) {
            $rc = new \ReflectionClass($this);
            $this->dir = dirname($rc->getFileName());
        }
        return $this->dir;
    }
116611
protected function getBaseDirectory()
    {
        if (! $this->fileSystem) {
            $this->fileSystem = $this->getServiceLocator()
                ->get(FileSystemService::SERVICE_ID)
                ->getDirectory($this->getFileSystemId());
        }

        return $this->fileSystem;
    }
275848
protected function getGitDirectory()
    {
        if ($this->gitDirectory === null) {
            $this->gitDirectory = $this->getWorktreeDirectory() . '/.git';
        }

        return $this->gitDirectory;
    }
449808
public function getOptionDestination()
    {
        $destination = $this->options->getDestination();
        if (!empty($destination)) {
            $destination = rtrim($destination, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
        }
        return $destination;
    }
1251837
protected function _getSortDir()
    {
        $sDir = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('dir');
        if (!in_array($sDir, $this->_aPosDir)) {
            $sDir = $this->_aPosDir[0];
        }

        return $sDir;
    }
652787
public function getFolder()
    {
        if ($this->_folder === null) {
            $this->_folder = Yii::getAlias("@webroot/svg");
        }

        return rtrim($this->_folder, DIRECTORY_SEPARATOR);
    }
828461
protected function getFileSystem()
    {
        if (null === $this->filesystem) {
            /** @var FileSystemService $fileSystemService */
            $fileSystemService = $this->getServiceManager()->get(FileSystemService::SERVICE_ID);
            $this->filesystem = $fileSystemService->getFileSystem($this->getOption(self::OPTION_FILESYSTEM));
        }

        return $this->filesystem;
    }
295795
public function getDirectory()
    {
        $dir = clone $this;
        $dir->path = str_replace(DIRECTORY_SEPARATOR, '/', dirname($this->path));
        if (!$dir->path) $dir->path = '/';

        return $dir;
    }
857343
public function scanDir()
    {
        // only possible in directories
        if (!$this->isDir() || !$this->exists()) {
            return null;
        }

        $fileList = [];
        $fileNameList = scandir($this->absoluteFileName);
        foreach ($fileNameList as $fileName) {
            // do not add . and ..
            if ($fileName === "." or $fileName === "..") {
                continue;
            }
            $absoluteFileName = $this->absoluteFileName . "/" . $fileName;
            $fileList [] = new File ($absoluteFileName);
        }

        return $fileList;
    }