Resolve names based on existing commands

@param array $input The results of a CommandScanner operation.
@return string[] A flat map of command names => class names.
324105
protected function resolveNames(array $input)
    {
        $out = [];
        foreach ($input as $info) {
            $name = $info['name'];
            $addLong = $name !== $info['fullName'];

            // If the short name has been used, use the full name.
            // This allows app shells to have name preference.
            // and app shells to overwrite core shells.
            if ($this->has($name) && $addLong) {
                $name = $info['fullName'];
            }

            $out[$name] = $info['class'];
            if ($addLong) {
                $out[$info['fullName']] = $info['class'];
            }
        }

        return $out;
    }
233266
public function resolveCommands($commands)
    {
        return parent::resolveCommands(array_filter($commands, function ($command) {
            return is_subclass_of($command, TerminalCommand::class);
        }));
    }
509437
protected function purifyInputs(array $inputs)
    {
        foreach ($inputs as $key => $input) {
            if ($key[0] === '_') {
                unset($inputs[$key]);
            }
        }

        return $inputs;
    }
313862
private function resolveOptions(InputInterface $input)
    {
        $options = [];
        if ($this->supportsCoverage() && $input->getOption('coverage-text')) {
            $options[] = '--coverage-text';
        }
        if ($this->supportsCoverage() && $input->getOption('coverage-clover')) {
            $options[] = sprintf('--coverage-clover %s/coverage.xml', getcwd());
        }
        if (is_file($this->plugin->directory.'/phpunit.xml')) {
            $options[] = sprintf('--configuration %s', $this->plugin->directory);
        } else {
            $options[] = sprintf('--testsuite %s_testsuite', $this->plugin->getComponent());
        }

        return implode(' ', $options);
    }
908002
public static function getParameters($input): array
    {
        try {
            $reflectionMethod = self::getCallableReflectionMethod($input);
        } catch (ReflectionException $e) {
            return [];
        }

        foreach ($reflectionMethod->getParameters() as $index => $param) {
            $reflectionParameters[$index]['name'] = $param->getName();
            if (null !== $param->getClass()) {
                $reflectionParameters[$index]['class'] = $param->getClass()->name;
            }
        }

        return $reflectionParameters ?? [];
    }
532582
public function resolveCommands($commands)
    {
        $commands = is_array($commands) ? $commands : func_get_args();

        foreach ($commands as $command)  {
            $this->resolve($command);
        }
    }
407979
protected function cleanupLigatures($input)
    {
        $mapping = [
            'ﬀ' => 'ff',
            'ﬁ' => 'fi',
            'ﬂ' => 'fl',
            'ﬃ' => 'ffi',
            'ﬄ' => 'ffl',
            'ﬅ' => 'ft',
            'ﬆ' => 'st'
        ];

        return str_replace(array_keys($mapping), array_values($mapping), $input);
    }
1285989
protected function getCommand($input)
    {
        $input = new StringInput($input);
        if ($name = $input->getFirstArgument()) {
            return $this->get($name);
        }
    }
651212
protected function cleanArray($input)
	{
		// add to the cleaned list when object
		if (is_object($input))
		{
			$this->parent->isClean($input);
		}

		foreach ($input as $k => $v)
		{
			$input[$k] = $this->clean($v);
		}

		return $input;
	}
131105
protected function convertArrayToSnakeCase(array $input):array
    {
        $converted = [];

        foreach ($input as $key => $value) {
            $converted[snake_case($key)] = $value;
        }

        return $converted;
    }
174815
protected function replaceSpecialChars($input)
	{
		if(is_array($input))
		{
			$result = [];
			
			foreach($input as $k => $v)
			{
				$result[$k] = $this->replaceSpecialChars($v);
			}
			
			return $result;
		}
		
		return strtr($input, [
			'\n' => "\n",
			'\t' => "\t"
		]);
	}
1009172
public function resolve($input)
    {
        if (!\is_array($input)) {
            $input = [$input];
        }

        if (!isset($input[0]) || !isset($input[1])) {
            $optionResolver = new OptionsResolver();
            $optionResolver->setDefaults([null, []]);
            $input = $optionResolver->resolve($input);
        }

        $alias = $input[0];
        $funcArgs = $input[1];

        $solution = $this->getSolution($alias);

        if (null === $solution) {
            throw new UnresolvableException($this->unresolvableMessage($alias));
        }

        $options = $this->getSolutionOptions($alias);
        $func = [$solution, $options['method']];

        return \call_user_func_array($func, $funcArgs);
    }
697735
public static function filterKeys(array $input, $included = [])
    {
        if (is_null($included) || count($included) == 0) {
            return $input;
        }

        return array_intersect_key($input, array_flip($included));
    }
71500
public function save(array $input) : array {
		$input[\Object\Form\Parent2::BUTTON_SUBMIT_SAVE] = true;
		// we must set entry method
		if (isset($this->form->form_object->collection_object->primary_model->column_prefix)) {
			$input[$this->form->form_object->collection_object->primary_model->column_prefix . 'entry_method'] = 'G';
		}
		$this->form->form_object->addInput($input);
		$this->form->form_object->process();
		return $this->form->form_object->apiResult();
	}
757313
public function parse($input)
    {
        if (is_null($input) || empty($input)) {
            return $input;
        }
        $character = $this->getOption('character');
        $regex = strtr($this->getOption('regex'), $this->getOption('regex_replacement'));

        preg_match_all($regex, $input, $matches);

        $matches = array_map([$this, 'mapper'], $matches[0]);

        $matches = $this->removeNullKeys($matches);
        $matches = $this->prepareArray($matches);

        $output = preg_replace_callback($matches, [$this, 'replace'], $input);

        return $output;
    }
1096960
public function removeEmptyInput($input)
    {
        $filterableInput = [];

        foreach ($input as $key => $val) {
            if ($val !== '' && $val !== null) {
                $filterableInput[$key] = $val;
            }
        }

        return $filterableInput;
    }
722259
public static function fromArray($input = [])
	{
		$fields = ScalarFields::getInstance();

		foreach ($input as $k => $v) {
			if (is_array($v)) {
				$fields = $fields->appendFields($k, self::fromArray($v));
			} elseif (!!$v) {
				$fields = $fields->appendField($k);
			}
		}

		return $fields;
	}