vendor/sylius/resource-bundle/src/Bundle/Controller/ViewHandler.php line 33

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the Sylius package.
  4.  *
  5.  * (c) Paweł Jędrzejewski
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. declare(strict_types=1);
  11. namespace Sylius\Bundle\ResourceBundle\Controller;
  12. use FOS\RestBundle\View\View;
  13. use FOS\RestBundle\View\ViewHandler as RestViewHandler;
  14. use Symfony\Component\HttpFoundation\Response;
  15. final class ViewHandler implements ViewHandlerInterface
  16. {
  17.     /** @var RestViewHandler */
  18.     private $restViewHandler;
  19.     public function __construct(RestViewHandler $restViewHandler)
  20.     {
  21.         $this->restViewHandler $restViewHandler;
  22.     }
  23.     /**
  24.      * {@inheritdoc}
  25.      */
  26.     public function handle(RequestConfiguration $requestConfigurationView $view): Response
  27.     {
  28.         if (!$requestConfiguration->isHtmlRequest()) {
  29.             $this->restViewHandler->setExclusionStrategyGroups($requestConfiguration->getSerializationGroups() ?? []);
  30.             if ($version $requestConfiguration->getSerializationVersion()) {
  31.                 $this->restViewHandler->setExclusionStrategyVersion($version);
  32.             }
  33.             $view->getContext()->enableMaxDepth();
  34.         }
  35.         return $this->restViewHandler->handle($view);
  36.     }
  37. }