You are here

public function ParameterBinding::getValue in Drupal 7 to 8/9 Module Upgrader 8

Returns the value of the binding. If the value is an instance of \Drupal\drupalmoduleupgrader\Utility\Path\PathComponentInterface, the binding expects to be physically represented in the path, although it may not yet be (this can be ascertained by the inPath() method). Any other value is used verbatim.

Return value

mixed

File

src/Routing/ParameterBinding.php, line 103

Class

ParameterBinding
Represents a binding between a single callback parameter and a single path component in a Drupal 8 route path, possibly affected by an argument.

Namespace

Drupal\drupalmoduleupgrader\Routing

Code

public function getValue() {
  if ($this
    ->hasArgument()) {
    if ($this
      ->isPathPosition()) {
      $position = $this
        ->getArgument();
      return $this->path
        ->containsKey($position) ? $this->path[$position] : new PathComponent('%');
    }
    else {
      return $this
        ->getArgument();
    }
  }
  else {
    $value = $this
      ->getParameter()
      ->getValue();
    if ($value instanceof ScalarNode) {
      return $value
        ->toValue();
    }
  }
}