services_interfaces-1.php 2.0 KB

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