You are here

public function Definition::setDecoratedService in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/dependency-injection/Definition.php \Symfony\Component\DependencyInjection\Definition::setDecoratedService()

Sets the service that this service is decorating.

Parameters

null|string $id The decorated service id, use null to remove decoration:

null|string $renamedId The new decorated service id:

Return value

Definition The current instance

Throws

InvalidArgumentException In case the decorated service id and the new decorated service id are equals.

1 call to Definition::setDecoratedService()
DefinitionDecorator::setDecoratedService in vendor/symfony/dependency-injection/DefinitionDecorator.php
Sets the service that this service is decorating.
1 method overrides Definition::setDecoratedService()
DefinitionDecorator::setDecoratedService in vendor/symfony/dependency-injection/DefinitionDecorator.php
Sets the service that this service is decorating.

File

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

Class

Definition
Definition represents a service definition.

Namespace

Symfony\Component\DependencyInjection

Code

public function setDecoratedService($id, $renamedId = null) {
  if ($renamedId && $id == $renamedId) {
    throw new \InvalidArgumentException(sprintf('The decorated service inner name for "%s" must be different than the service name itself.', $id));
  }
  if (null === $id) {
    $this->decoratedService = null;
  }
  else {
    $this->decoratedService = array(
      $id,
      $renamedId,
    );
  }
  return $this;
}