/** * {@inheritDoc} */ public function getStrategy($contextName, $object) { // prefix.context_name $contextServiceId = $this->converter->getServiceNamespace($this->servicePrefix, $contextName); // get the correct strategy service by the object $strategy = $this->container->get($contextServiceId); $strategy = $strategy->getStrategyName($object); // get service namespace $strategyAlias = $this->converter->getServiceNamespace($this->servicePrefix, array($contextName, $strategy)); if (!$this->container->has($strategyAlias)) { $strategyAlias = $this->container->get($contextServiceId)->getFallbackStrategy(); } return $this->container->get($strategyAlias); }
protected function assertHasService($id, $instanceOf) { $this->assertTrue($this->container->has($id)); $this->assertInstanceOf($instanceOf, $this->container->get($id)); }