Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Definition.php

function Definition::setBindings

Sets bindings.

Bindings map $named or FQCN arguments to values that should be injected in the matching parameters (of the constructor, of methods called and of controller actions).

Return value

$this

File

vendor/symfony/dependency-injection/Definition.php, line 756

Class

Definition
Definition represents a service definition.

Namespace

Symfony\Component\DependencyInjection

Code

public function setBindings(array $bindings) : static {
    foreach ($bindings as $key => $binding) {
        if (0 < strpos($key, '$') && $key !== ($k = preg_replace('/[ \\t]*\\$/', ' $', $key))) {
            unset($bindings[$key]);
            $bindings[$key = $k] = $binding;
        }
        if (!$binding instanceof BoundArgument) {
            $bindings[$key] = new BoundArgument($binding);
        }
    }
    $this->bindings = $bindings;
    return $this;
}
RSS feed
Powered by Drupal