services_interfaces-1.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. use Symfony\Component\DependencyInjection\ContainerInterface;
  3. use Symfony\Component\DependencyInjection\Container;
  4. use Symfony\Component\DependencyInjection\Reference;
  5. use Symfony\Component\DependencyInjection\Parameter;
  6. use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
  7. /**
  8. * ProjectServiceContainer
  9. *
  10. * This class has been auto-generated
  11. * by the Symfony Dependency Injection Component.
  12. */
  13. class ProjectServiceContainer extends Container
  14. {
  15. /**
  16. * Constructor.
  17. */
  18. public function __construct()
  19. {
  20. parent::__construct(new ParameterBag($this->getDefaultParameters()));
  21. }
  22. /**
  23. * Gets the 'foo' service.
  24. *
  25. * This service is shared.
  26. * This method always returns the same instance of the service.
  27. *
  28. * @return Object A %cla%o%ss% instance.
  29. */
  30. protected function getFooService()
  31. {
  32. $class = $this->getParameter('cla').'o'.$this->getParameter('ss');
  33. return $this->services['foo'] = new $class();
  34. }
  35. /**
  36. * Gets the default parameters.
  37. *
  38. * @return array An array of the default parameters
  39. */
  40. protected function getDefaultParameters()
  41. {
  42. return array(
  43. 'cla' => 'Fo',
  44. 'ss' => 'Class',
  45. );
  46. }
  47. /**
  48. * Applies all known interface injection calls
  49. *
  50. * @param Object $instance
  51. */
  52. protected function applyInterfaceInjectors($instance)
  53. {
  54. if ($instance instanceof \FooClass) {
  55. $instance->setBar('someValue');
  56. }
  57. }
  58. }