CallTrait.php 925 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\DependencyInjection\Loader\Configurator\Traits;
  11. use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
  12. trait CallTrait
  13. {
  14. /**
  15. * Adds a method to call after service initialization.
  16. *
  17. * @param string $method The method name to call
  18. * @param array $arguments An array of arguments to pass to the method call
  19. *
  20. * @return $this
  21. *
  22. * @throws InvalidArgumentException on empty $method param
  23. */
  24. final public function call($method, array $arguments = array())
  25. {
  26. $this->definition->addMethodCall($method, static::processValue($arguments, true));
  27. return $this;
  28. }
  29. }