You are here

protected function ArgumentsResolver::handleUnresolvedArgument in Service Container 7

Same name and namespace in other branches
  1. 7.2 lib/Drupal/Component/Utility/ArgumentsResolver.php \Drupal\Component\Utility\ArgumentsResolver::handleUnresolvedArgument()

Handles unresolved arguments for getArgument().

Subclasses that override this method may return a default value instead of throwing an exception.

Throws

\RuntimeException Thrown when there is a missing parameter.

1 call to ArgumentsResolver::handleUnresolvedArgument()
ArgumentsResolver::getArgument in lib/Drupal/Component/Utility/ArgumentsResolver.php
Gets the argument value for a parameter.

File

lib/Drupal/Component/Utility/ArgumentsResolver.php, line 138
Contains \Drupal\Component\Utility\ArgumentsResolver.

Class

ArgumentsResolver
Resolves the arguments to pass to a callable.

Namespace

Drupal\Component\Utility

Code

protected function handleUnresolvedArgument(\ReflectionParameter $parameter) {
  $class = $parameter
    ->getDeclaringClass();
  $function = $parameter
    ->getDeclaringFunction();
  if ($class && !$function
    ->isClosure()) {
    $function_name = $class
      ->getName() . '::' . $function
      ->getName();
  }
  else {
    $function_name = $function
      ->getName();
  }
  throw new \RuntimeException(sprintf('Callable "%s" requires a value for the "$%s" argument.', $function_name, $parameter
    ->getName()));
}