You are here

protected function ArgumentsResolver::handleUnresolvedArgument in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/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 core/lib/Drupal/Component/Utility/ArgumentsResolver.php
Gets the argument value for a parameter.

File

core/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()));
}