original_string: public function call(MethodArgumentDocument $methodArgument)
      {
          $serviceName = $methodArgument->getMethod()->getService()->getServiceName();
          $service = $this->container->get($serviceName);
          if (null === $service) {
              throw new UndefinedServiceException(sprintf('"%s" is not a service', $serviceName));
          }
  
          $methodName = $methodArgument->getMethod()->getName();
          try {
              $r = new \ReflectionMethod($service, $methodName);
          } catch (\ReflectionException $e) {
              throw new BadMethodCallException(sprintf('"%s" is not a method in %s', $methodName, $serviceName));
          }
  
          $methodArguments = $methodArgument->getArguments();
          $numberOfArgs = $methodArguments->count();
  
          $minArgs = $r->getNumberOfRequiredParameters();
          $maxArgs = $r->getNumberOfParameters();
          if ($numberOfArgs < $minArgs || $numberOfArgs > $maxArgs) {
              $range = $minArgs === $maxArgs ? $minArgs : "$minArgs-$maxArgs";
              throw new WrongNumberOfArgumentsException(
                  sprintf('Method "%s" in %s expects %s arguments, got %d', $methodName, $serviceName, $range, $numberOfArgs)
              );
          }
  
          return $service->$methodName(...$this->buildArgumentArray($r->getParameters(), $methodArguments));
      }
code: public function call(MethodArgumentDocument $methodArgument)
      {
          $serviceName = $methodArgument->getMethod()->getService()->getServiceName();
          $service = $this->container->get($serviceName);
          if (null === $service) {
              throw new UndefinedServiceException(sprintf('"%s" is not a service', $serviceName));
          }
  
          $methodName = $methodArgument->getMethod()->getName();
          try {
              $r = new \ReflectionMethod($service, $methodName);
          } catch (\ReflectionException $e) {
              throw new BadMethodCallException(sprintf('"%s" is not a method in %s', $methodName, $serviceName));
          }
  
          $methodArguments = $methodArgument->getArguments();
          $numberOfArgs = $methodArguments->count();
  
          $minArgs = $r->getNumberOfRequiredParameters();
          $maxArgs = $r->getNumberOfParameters();
          if ($numberOfArgs < $minArgs || $numberOfArgs > $maxArgs) {
              $range = $minArgs === $maxArgs ? $minArgs : "$minArgs-$maxArgs";
              throw new WrongNumberOfArgumentsException(
                  sprintf('Method "%s" in %s expects %s arguments, got %d', $methodName, $serviceName, $range, $numberOfArgs)
              );
          }
  
          return $service->$methodName(...$this->buildArgumentArray($r->getParameters(), $methodArguments));
      }
code_tokens: public function call ( MethodArgumentDocument $ methodArgument ) { $ serviceName = $ methodArgument -> getMethod ( ) -> getService ( ) -> getServiceName ( ) ; $ service = $ this -> container -> get ( $ serviceName ) ; if ( null === $ service ) { throw new UndefinedServiceException ( sprintf ( '"%s" is not a service' , $ serviceName ) ) ; } $ methodName = $ methodArgument -> getMethod ( ) -> getName ( ) ; try { $ r = new \ ReflectionMethod ( $ service , $ methodName ) ; } catch ( \ ReflectionException $ e ) { throw new BadMethodCallException ( sprintf ( '"%s" is not a method in %s' , $ methodName , $ serviceName ) ) ; } $ methodArguments = $ methodArgument -> getArguments ( ) ; $ numberOfArgs = $ methodArguments -> count ( ) ; $ minArgs = $ r -> getNumberOfRequiredParameters ( ) ; $ maxArgs = $ r -> getNumberOfParameters ( ) ; if ( $ numberOfArgs < $ minArgs || $ numberOfArgs > $ maxArgs ) { $ range = $ minArgs === $ maxArgs ? $ minArgs : "$minArgs-$maxArgs" ; throw new WrongNumberOfArgumentsException ( sprintf ( 'Method "%s" in %s expects %s arguments, got %d' , $ methodName , $ serviceName , $ range , $ numberOfArgs ) ) ; } return $ service -> $ methodName ( ... $ this -> buildArgumentArray ( $ r -> getParameters ( ) , $ methodArguments ) ) ; }
docstring: Executes the passed in method via the associated service that's retrieved from the container.
  This gets called recursively to supply all the arguments for each given method.
  
  @param MethodArgumentDocument $methodArgument
  
  @throws WrongNumberOfArgumentsException if we have more or less arguments than the method requires
  @throws BadArgumentTypeException if the type of a given argument does not match the method arguments expected type
  @throws MissingMethodArgumentException if argument has neither callback nor value
  @throws UndefinedServiceException if service doesn't exist
  @throws BadMethodCallException if the service doesn't have the given method
  
  @return mixed
docstring_tokens: Executes the passed in method via the associated service that s retrieved from the container . This gets called recursively to supply all the arguments for each given method .