Map the input to the command

@param  $command
@param  $input
@return object
508665
protected function mapInputToCommand($command, $input)
    {
        if (is_object($command)) {
            return $command;
        }
        $dependencies = [];
        $class = new ReflectionClass($command);
        foreach ($class->getConstructor()->getParameters() as $parameter) {
            if ( $parameter->getPosition() == 0 && $parameter->isArray() ) {
                if ($input !== []) {
                    $dependencies[] = $input;
                } else {
                    $dependencies[] = $this->getDefaultValueOrFail($parameter);
                }
            } else {
                $name = $parameter->getName();
                if (array_key_exists($name, $input)) {
                    $dependencies[] = $input[$name];
                } else {
                    $dependencies[] = $this->getDefaultValueOrFail($parameter);
                }
            }
        }

        return $class->newInstanceArgs($dependencies);
    }
753022
public function execute(Input $input): void
    {
        $this->bus->handle(
            $this->messageCreator->create($this->command, $input)
        );
    }
741836
private function withParam( string$input )
	{
		return str_replace('$_FLAG_$',"__HTSL_CTRL_FLAG_{$this->id}__",preg_replace_callback('/(?<!%)%s((?:\\/.+?(?<!\\\\)\\/.+?(?<!\\\\)\\/)+)?/',function( array$matches ){
			$param= $this->param;

			if( isset($matches[1]) ){
				array_map(...[
					function($replacer)use(&$param){
						list($pattern,$replacement,)= preg_split('/(?<!\\\\)\\//',$replacer);
						$param= preg_replace(...[
							"/$pattern/",
							preg_replace('/^\\\\_$/','',$replacement),
							$param,
						]);
					},
					preg_split(
						'/(?<!\\\\)\\/\\//'
						,
						trim($matches[1],'/')
					),
				]);
			}
			return $param;
		},$input));
	}
493098
public function run($input = null)
    {
        $descriptorSpec = array(
            0 => array('pipe', 'r'),
            1 => array('pipe', 'w'),
            2 => array('pipe', 'w')
        );
        $process = proc_open(
            $this->_command,
            $descriptorSpec,
            $pipes,
            null,
            $this->_env
        );
        if (is_resource($process)) {
            fwrite($pipes[0], $input);
            fclose($pipes[0]);

            $this->_output = stream_get_contents($pipes[1]);
            fclose($pipes[1]);

            $this->_error = stream_get_contents($pipes[2]);
            fclose($pipes[2]);
            proc_close($process);
        }
        return $this->_output;
    }
696630
public function addCommand($command)
    {
        if (is_array($command)) {
            foreach ($command as $cmd) {
                $this->addCommand($cmd);
            }
        }

        if (is_string($command)) {
            $command = new Command($command);
            $this->commandsList[] = $command;
        }

        return $this;
    }
1306954
private function formDoctrineInput($command, $migrationPath, $dbFilePath)
    {
        $input = new ArrayInput([
            '--configuration' => $migrationPath,
            '--db-configuration' => $dbFilePath,
            '-n' => true,
            'command' => $command
        ]);
        return $input;
    }
1262293
public function execute($command)
    {
        $validator = $this->translator->toValidator($command);

        if (class_exists($validator)) {
            $this->app->make($validator)->validate($command);
        }

        return $this->bus->execute($command);
    }
339054
public function command($command, $method) {

        self::$commands[] = $command;
        self::$callbacks[$command] = $method;
    }
776095
public function runCommand(Command $command, InputInterface $input, OutputInterface $output) {
    return $this->doRunCommand($command, $input, $output);
  }
813513
protected function _exec($cmd, $input)
    {
        $result = ['stdout' => '', 'stderr' => '', 'return' => ''];

        $cwd = $this->getConfig('cwd');

        $proc = proc_open($cmd, [0 => ['pipe', 'r'], 1 => ['pipe', 'w'], 2 => ['pipe', 'w']], $pipes, $cwd);
        fwrite($pipes[0], $input);
        fclose($pipes[0]);

        $result['stdout'] = stream_get_contents($pipes[1]);
        fclose($pipes[1]);

        $result['stderr'] = stream_get_contents($pipes[2]);
        fclose($pipes[2]);

        $result['return'] = proc_close($proc);

        return $result;
    }
316016
public function drush($command) {
    // Clear out options associated with previous drush command.
    $this->setOptionsForLastCommand();

    if (!$this->defaultsInitialized) {
      $this->init();
    }

    if (is_array($command)) {
      $command = implode(' ', array_filter($command));
    }

    $this->commands[] = trim($command);
    return $this;
  }
123783
public function execute(Input $input): Input
    {

        if (!$input->isEvaluableForTypes(...$this->types)) {
            return $input;
        }

        return $this->resolve($input);
    }
945458
protected function initialize(Input $input, Output $output) {
        return $this->cmd->initialize($input,$output);
    }
1240909
public function bootstrap($input)
     {
        //Get Welcome Message
        $this->getMessage('welcome');
        //Check If shell input exists
        if($this->hasInput($input))
        {
            //If shell input exists $in receive
            $in = $input[1];
            //Show Tasks start
            $this->getMessage('starttask');
            //Browse all the options array.
            //If command exists in options list
            if(in_array($in, $this->getOptions()))
            {
                //Find Option key
                $key = $this->searchForName($in, $this->options);
                //Browse all the command array.
                foreach ($this->options[$key]['data'] as $value) {
                    //Run process with this command
                    $this->process($value['name'], $value['command']);
                }
                
            }
            else if($in == 'help' || $in == '')
            {
                //If shell input is help show list
                $this->showlist();
            }
            else
            {
                //If command not exists show error
               $this->log('Command '.$in.' Not Found!', 'danger');
                exit(); 
            }
            //Show Tasks end
            $this->getMessage('endtask');
        }
        else
        {
            //If shell input is blank show list
            $this->showlist();
            exit();
        }

        $this->getMessage('end');
     }
1208340
@Override
    public Object map(Object input) {
        String s = input.toString();
        if (s == null || s.isEmpty())
            return value;
        else if (s instanceof String)
            return s;
        else
            return s;
    }
128056
protected function registerMakeCommandCommand($command)
    {
        $this->app->singleton($command, function ($app) {
            return new Generators\Commands\CommandMakeCommand($app);
        });
    }
1366933
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $inputs = array_merge($input->getArguments(), $input->getOptions());

        $parameters = array();

        //
        $reflection = new ReflectionFunction($this->callback);

        foreach ($reflection->getParameters() as $parameter) {
            if (isset($inputs[$parameter->name])) {
                $parameters[$parameter->name] = $inputs[$parameter->name];
            }
        }

        return $this->container->call(
            $this->callback->bindTo($this, $this), $parameters
        );
    }