public function getService($id) { if (!array_key_exists($id, $this->serviceDefinitions)) { throw new \RuntimeException("Service container does not have service with id \"key\""); } return $this->serviceDefinitions[$id]($this); }
/** * @param ServiceContainer $container */ public function load(ServiceContainer $container) { $fakerExtension = new FakerExtension($this->locale); $container->getService('twig')->addExtension($fakerExtension); }