/** * {@inheritdoc} */ public function handle(Context $context) { $processed = []; $includeRequested = explode(self::DELIMITER, $context->getRequest()->headers->get(self::HEADER_INCLUDE)); $includeRequested = array_filter(array_map('trim', $includeRequested)); $known = array_intersect($includeRequested, array_keys($this->handlers)); foreach ($known as $name) { $serviceId = $this->handlers[$name]; $handler = $this->container->get($serviceId); if ($handler instanceof IncludeHandlerInterface && $handler->supports($context)) { $handler->handle($context); $processed[] = $name; } } $unknown = array_diff($includeRequested, $known); if (!empty($unknown)) { $context->getResponse()->headers->set(self::HEADER_UNKNOWN, implode(self::DELIMITER, $unknown)); } $unsupported = array_diff($known, $processed); if (!empty($unsupported)) { $context->getResponse()->headers->set(self::HEADER_UNSUPPORTED, implode(self::DELIMITER, $unsupported)); } }
public function testGetRequest() { $this->assertSame($this->request, $this->context->getRequest()); }