Get a directory path through a command option, or from the configuration.

@param $option
@param $configName
@return string
18801
protected function getPathByOptionOrConfig($option, $configName)
    {
        if ($path = $this->option($option)) return $path;

        return Config::get("generators::config.{$configName}");
    }
50807
public function pathinfo($option = null)
    {
        if (null === $option) {
            return pathinfo($this->_filePath);
        }
        return pathinfo($this->_filePath, $option);
    }
1230646
protected function findConfigFile(OutputInterface $output): ?string
    {
        $directory = @getcwd();
        if ($directory === false) {
            throw new \RuntimeException('Can\'t get the working directory path. Make sure the working directory is readable.');
        }

        for ($i = 0; $i < 10000; ++$i) { // `for` protects from an infinite loop
            $file = $directory . DIRECTORY_SEPARATOR . $this->getCommandStaticConfigFilename();

            if (@is_file($file)) {
                return $file;
            }

            $parentDirectory = @realpath($directory.DIRECTORY_SEPARATOR.'..'); // Gets the parent directory path

            // Check whether the parent directory is restricted
            if ($parentDirectory === false) {
                if ($output->isVerbose()) {
                    $output->writeln('The parent directory of `'.$directory.'` is restricted (maybe by open_basedir)'
                        . ', so the search of a configuration file can\'t be proceeded');
                }
                break;
            }

            if ($parentDirectory === $directory) break; // Check whether the current directory is a root directory
            $directory = $parentDirectory;
        }

        return null;
    }
70450
public function hasDirectory($configName, $path)
    {
        if (!is_dir($path)) {
            $this->event->getIO()->write(sprintf('The %s (%s) specified in composer.json was not found in %s.', $configName, $path, getcwd()));

            return false;
        }

        return true;
    }
828202
public function getOption($optionName)
    {
        if (array_key_exists($optionName, $this->options)) {
            return $this->options[$optionName];
        } else {
            return null;
        }
    }
561302
public String getOptionValue(final String optionName) {
        if (optionName.length() == 1) {
            return getOptionValue(optionName.charAt(0));
        }
        return (String) commandLine.getValue("--" + optionName);
    }
95733
protected function getPathFromConfiguration($path, ConfigurationInterface $configuration)
    {
        if ($configuration->hasRelativePath()) {
            return $configuration->getRelativePathToFile($path);
        }

        if ($configuration->hasPublicURL()) {
            return $configuration->getPublicURLToFile($path);
        }

        throw new \InvalidArgumentException('Thumbnail configuration doesn\'t support Paths or URLs');
    }
1209800
public function get(string $option)
    {
        if (!isset($this->options[$option])) {
            throw new \InvalidArgumentException(sprintf('Option "%s" does not exists.', $option));
        }

        return $this->options[$option];
    }
420466
private function getPackageConfig($name, $option = '')
    {
        // specific location
        if ($option && ($config = $this->getPackageOptionFile($option))) {
            return $config;
        }

        $finder = Finder::create()
            ->files()
            ->in($this->getPackageDir())
            ->path('/\/Resources\/config\/([^\/]+\/)*'.$name.'.(yml|xml)$/')
            ->name('/^'.$name.'.(yml|xml)$/');

        // ignor configs in test
        if (stripos($this->getPackage()->getName(), 'test') === false) {
            $finder->notPath('/test/i');
        }

        /* @var $file \SplFileInfo */
        foreach ($finder as $file) {
            $path = str_replace(DIRECTORY_SEPARATOR, '/', $file->getPathname());

            return substr($path, strrpos($path, '/Resources/config/'));
        }

        return '';
    }
1192789
final protected function get($option)
    {
        if (array_key_exists($key = "$option", $this->options)) {
            return $this->options[$key];
        }

        if (array_key_exists($key, $this->defaults)) {
            return $this->defaults[$key];
        }
    }
1284123
public function get($option)
    {
        return (isset($this->options[$option]) ? $this->options[$option] : null);
    }
420862
public function configPath(?string $configPath = null) {
        if ($configPath != null) {
            $this->configPath = $configPath;
        }
        else {
            if (!isset($this->configPath)) {
                $this->configPath = $this->basePath() . DIRECTORY_SEPARATOR . "config";
            }
        }
        return $this->configPath;
    }
260052
public function get($configOption, $fallback = null)
    {
        if (isset($this->configuration[$configOption])) {
            $optionValue = $this->configuration[$configOption];
        } else {
            if (array_key_exists($configOption, $this->configuration)) {
                $optionValue = $fallback;
            }

            try {
                $optionValue = $this->repository->git(sprintf('config --get ' . $configOption));
                $this->configuration[$configOption] = $optionValue;
            } catch (GitRuntimeException $e) {
                $optionValue = $fallback;
                $this->configuration[$configOption] = null;
            }
        }

        return $optionValue;
    }
1324321
private function getOptionString(OptionDefinition $option)
    {
        $short = $option->getShort();
        $long = $option->getLong();
        $result = ' ';
        if ($short !== null && $long !== null) {
            $result .= '-' . $short . ', --' . $long;
        } else {
            $result .= $short !== null ? '-' . $short : '--' . $long;
        }
        return $result;
    }
1295193
public function Get($option)
    {
        if(isset($this->preferences[$option]))
        {
            return $this->preferences[$option];
        }

        return false;
    }
1111284
public function getOption($option) {
		if ($option instanceOf Argument) {
			$obj = $option;
			$option = $option->value;
		}

		if (isset($this->_options[$option])) {
			return $this->_options[$option];
		}

		foreach ($this->_options as $master => $settings) {
			if (in_array($option, (array)$settings['aliases'])) {
				if (isset($obj)) {
					$obj->key = $master;
				}

				return $settings;
			}
		}
	}
505421
protected function getRootOption(): string
    {
        $option = '';
        // if root is set
        if (!empty($this->repositoryRoot)) {
            // and it's not the current working directory
            if (getcwd() !== $this->repositoryRoot) {
                $option = ' -C ' . escapeshellarg($this->repositoryRoot);
            }
        }
        return $option;
    }