services_interfaces-1-1.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <?php
  2. use Symfony\Component\DependencyInjection\ContainerInterface;
  3. use Symfony\Component\DependencyInjection\Container;
  4. use Symfony\Component\DependencyInjection\Exception\InactiveScopeException;
  5. use Symfony\Component\DependencyInjection\Reference;
  6. use Symfony\Component\DependencyInjection\Parameter;
  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. $this->parameters = $this->getDefaultParameters();
  21. $this->services =
  22. $this->scopedServices =
  23. $this->scopeStacks = array();
  24. $this->set('service_container', $this);
  25. $this->scopes = array();
  26. $this->scopeChildren = array();
  27. }
  28. /**
  29. * Gets the 'foo' service.
  30. *
  31. * This service is shared.
  32. * This method always returns the same instance of the service.
  33. *
  34. * @return FooClass A FooClass instance.
  35. */
  36. protected function getFooService()
  37. {
  38. $this->services['foo'] = $instance = new \FooClass();
  39. $instance->setBar('someValue');
  40. return $instance;
  41. }
  42. /**
  43. * {@inheritdoc}
  44. */
  45. public function getParameter($name)
  46. {
  47. $name = strtolower($name);
  48. if (!array_key_exists($name, $this->parameters)) {
  49. throw new \InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name));
  50. }
  51. return $this->parameters[$name];
  52. }
  53. /**
  54. * {@inheritdoc}
  55. */
  56. public function hasParameter($name)
  57. {
  58. return array_key_exists(strtolower($name), $this->parameters);
  59. }
  60. /**
  61. * {@inheritdoc}
  62. */
  63. public function setParameter($name, $value)
  64. {
  65. throw new \LogicException('Impossible to call set() on a frozen ParameterBag.');
  66. }
  67. /**
  68. * Gets the default parameters.
  69. *
  70. * @return array An array of the default parameters
  71. */
  72. protected function getDefaultParameters()
  73. {
  74. return array(
  75. 'cla' => 'Fo',
  76. 'ss' => 'Class',
  77. );
  78. }
  79. }