services_interfaces-1-1.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. /**
  7. * ProjectServiceContainer
  8. *
  9. * This class has been auto-generated
  10. * by the Symfony Dependency Injection Component.
  11. */
  12. class ProjectServiceContainer extends Container
  13. {
  14. /**
  15. * Constructor.
  16. */
  17. public function __construct()
  18. {
  19. $this->parameters = $this->getDefaultParameters();
  20. $this->services =
  21. $this->scopedServices =
  22. $this->scopeStacks = array();
  23. $this->set('service_container', $this);
  24. $this->scopes = array();
  25. $this->scopeChildren = array();
  26. }
  27. /**
  28. * Gets the 'foo' service.
  29. *
  30. * This service is shared.
  31. * This method always returns the same instance of the service.
  32. *
  33. * @return FooClass A FooClass instance.
  34. */
  35. protected function getFooService()
  36. {
  37. $this->services['foo'] = $instance = new \FooClass();
  38. $instance->setBar('someValue');
  39. return $instance;
  40. }
  41. /**
  42. * {@inheritdoc}
  43. */
  44. public function getParameter($name)
  45. {
  46. $name = strtolower($name);
  47. if (!array_key_exists($name, $this->parameters)) {
  48. throw new \InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name));
  49. }
  50. return $this->parameters[$name];
  51. }
  52. /**
  53. * {@inheritdoc}
  54. */
  55. public function hasParameter($name)
  56. {
  57. return array_key_exists(strtolower($name), $this->parameters);
  58. }
  59. /**
  60. * {@inheritdoc}
  61. */
  62. public function setParameter($name, $value)
  63. {
  64. throw new \LogicException('Impossible to call set() on a frozen ParameterBag.');
  65. }
  66. /**
  67. * Gets the default parameters.
  68. *
  69. * @return array An array of the default parameters
  70. */
  71. protected function getDefaultParameters()
  72. {
  73. return array(
  74. 'cla' => 'Fo',
  75. 'ss' => 'Class',
  76. );
  77. }
  78. }