original_string: protected function mapInputToCommand($command, array $input)
      {
          $dependencies = [];
  
          $class = new ReflectionClass($command);
  
          foreach ($class->getConstructor()->getParameters() as $parameter)
          {
              $name = $parameter->getName();
  
              if (array_key_exists($name, $input))
              {
                  $dependencies[] = $input[$name];
              }
              elseif ($parameter->isDefaultValueAvailable())
              {
                  $dependencies[] = $parameter->getDefaultValue();
              }
              else
              {
                  throw new InvalidArgumentException("Unable to map input to command: {$name}");
              }
          }
  
          return $class->newInstanceArgs($dependencies);
      }
code: protected function mapInputToCommand($command, array $input)
      {
          $dependencies = [];
  
          $class = new ReflectionClass($command);
  
          foreach ($class->getConstructor()->getParameters() as $parameter)
          {
              $name = $parameter->getName();
  
              if (array_key_exists($name, $input))
              {
                  $dependencies[] = $input[$name];
              }
              elseif ($parameter->isDefaultValueAvailable())
              {
                  $dependencies[] = $parameter->getDefaultValue();
              }
              else
              {
                  throw new InvalidArgumentException("Unable to map input to command: {$name}");
              }
          }
  
          return $class->newInstanceArgs($dependencies);
      }
code_tokens: protected function mapInputToCommand ( $ command , array $ input ) { $ dependencies = [ ] ; $ class = new ReflectionClass ( $ command ) ; foreach ( $ class -> getConstructor ( ) -> getParameters ( ) as $ parameter ) { $ name = $ parameter -> getName ( ) ; if ( array_key_exists ( $ name , $ input ) ) { $ dependencies [ ] = $ input [ $ name ] ; } elseif ( $ parameter -> isDefaultValueAvailable ( ) ) { $ dependencies [ ] = $ parameter -> getDefaultValue ( ) ; } else { throw new InvalidArgumentException ( "Unable to map input to command: {$name}" ) ; } } return $ class -> newInstanceArgs ( $ dependencies ) ; }
docstring: Map an array of input to a command's properties.
  
  @param  string $command
  @param  array $input
  @throws InvalidArgumentException
  @author Taylor Otwell
  
  @return mixed
docstring_tokens: Map an array of input to a command s properties .