Deprecated: Sensio\Bundle\FrameworkExtraBundle\Request\ParamConverter\DoctrineParamConverter::__construct(): Implicitly marking parameter $registry as nullable is deprecated, the explicit nullable type must be used instead in /home/sites/5a/e/edf719076c/public_html/support/vendor/sensio/framework-extra-bundle/src/Request/ParamConverter/DoctrineParamConverter.php on line 46

Deprecated: Sensio\Bundle\FrameworkExtraBundle\Request\ParamConverter\DoctrineParamConverter::__construct(): Implicitly marking parameter $expressionLanguage as nullable is deprecated, the explicit nullable type must be used instead in /home/sites/5a/e/edf719076c/public_html/support/vendor/sensio/framework-extra-bundle/src/Request/ParamConverter/DoctrineParamConverter.php on line 46

Deprecated: Sensio\Bundle\FrameworkExtraBundle\EventListener\TemplateListener::__construct(): Implicitly marking parameter $twig as nullable is deprecated, the explicit nullable type must be used instead in /home/sites/5a/e/edf719076c/public_html/support/vendor/sensio/framework-extra-bundle/src/EventListener/TemplateListener.php on line 39

Deprecated: Sensio\Bundle\FrameworkExtraBundle\EventListener\SecurityListener::__construct(): Implicitly marking parameter $language as nullable is deprecated, the explicit nullable type must be used instead in /home/sites/5a/e/edf719076c/public_html/support/vendor/sensio/framework-extra-bundle/src/EventListener/SecurityListener.php on line 43

Deprecated: Sensio\Bundle\FrameworkExtraBundle\EventListener\SecurityListener::__construct(): Implicitly marking parameter $trustResolver as nullable is deprecated, the explicit nullable type must be used instead in /home/sites/5a/e/edf719076c/public_html/support/vendor/sensio/framework-extra-bundle/src/EventListener/SecurityListener.php on line 43

Deprecated: Sensio\Bundle\FrameworkExtraBundle\EventListener\SecurityListener::__construct(): Implicitly marking parameter $roleHierarchy as nullable is deprecated, the explicit nullable type must be used instead in /home/sites/5a/e/edf719076c/public_html/support/vendor/sensio/framework-extra-bundle/src/EventListener/SecurityListener.php on line 43

Deprecated: Sensio\Bundle\FrameworkExtraBundle\EventListener\SecurityListener::__construct(): Implicitly marking parameter $tokenStorage as nullable is deprecated, the explicit nullable type must be used instead in /home/sites/5a/e/edf719076c/public_html/support/vendor/sensio/framework-extra-bundle/src/EventListener/SecurityListener.php on line 43

Deprecated: Sensio\Bundle\FrameworkExtraBundle\EventListener\SecurityListener::__construct(): Implicitly marking parameter $authChecker as nullable is deprecated, the explicit nullable type must be used instead in /home/sites/5a/e/edf719076c/public_html/support/vendor/sensio/framework-extra-bundle/src/EventListener/SecurityListener.php on line 43

Deprecated: Sensio\Bundle\FrameworkExtraBundle\EventListener\SecurityListener::__construct(): Implicitly marking parameter $logger as nullable is deprecated, the explicit nullable type must be used instead in /home/sites/5a/e/edf719076c/public_html/support/vendor/sensio/framework-extra-bundle/src/EventListener/SecurityListener.php on line 43

Deprecated: Sensio\Bundle\FrameworkExtraBundle\EventListener\IsGrantedListener::__construct(): Implicitly marking parameter $authChecker as nullable is deprecated, the explicit nullable type must be used instead in /home/sites/5a/e/edf719076c/public_html/support/vendor/sensio/framework-extra-bundle/src/EventListener/IsGrantedListener.php on line 33

Deprecated: Webkul\UVDesk\CoreFrameworkBundle\Services\UserService::isAccessAuthorized(): Implicitly marking parameter $user as nullable is deprecated, the explicit nullable type must be used instead in /home/sites/5a/e/edf719076c/public_html/support/vendor/uvdesk/core-framework/Services/UserService.php on line 101

Deprecated: Webkul\UVDesk\CoreFrameworkBundle\Services\UserService::getSupportGroups(): Implicitly marking parameter $request as nullable is deprecated, the explicit nullable type must be used instead in /home/sites/5a/e/edf719076c/public_html/support/vendor/uvdesk/core-framework/Services/UserService.php on line 162

Deprecated: Webkul\UVDesk\CoreFrameworkBundle\Services\UserService::getSupportTeams(): Implicitly marking parameter $request as nullable is deprecated, the explicit nullable type must be used instead in /home/sites/5a/e/edf719076c/public_html/support/vendor/uvdesk/core-framework/Services/UserService.php on line 180

Deprecated: Webkul\UVDesk\CoreFrameworkBundle\Services\UserService::getAgentPartialDataCollection(): Implicitly marking parameter $request as nullable is deprecated, the explicit nullable type must be used instead in /home/sites/5a/e/edf719076c/public_html/support/vendor/uvdesk/core-framework/Services/UserService.php on line 280

Deprecated: Webkul\UVDesk\CoreFrameworkBundle\Services\UserService::getAgentsPartialDetails(): Implicitly marking parameter $request as nullable is deprecated, the explicit nullable type must be used instead in /home/sites/5a/e/edf719076c/public_html/support/vendor/uvdesk/core-framework/Services/UserService.php on line 309

Deprecated: Webkul\UVDesk\CoreFrameworkBundle\Services\UserService::getCustomersPartial(): Implicitly marking parameter $request as nullable is deprecated, the explicit nullable type must be used instead in /home/sites/5a/e/edf719076c/public_html/support/vendor/uvdesk/core-framework/Services/UserService.php on line 428

Deprecated: Webkul\UVDesk\CoreFrameworkBundle\Services\TicketService::isTicketAccessGranted(): Implicitly marking parameter $user as nullable is deprecated, the explicit nullable type must be used instead in /home/sites/5a/e/edf719076c/public_html/support/vendor/uvdesk/core-framework/Services/TicketService.php on line 1913

Deprecated: Webkul\UVDesk\CoreFrameworkBundle\FileSystem\FileSystem::getAssetIconURL(): Implicitly marking parameter $attachment as nullable is deprecated, the explicit nullable type must be used instead in /home/sites/5a/e/edf719076c/public_html/support/vendor/uvdesk/core-framework/FileSystem/FileSystem.php on line 34

Deprecated: Symfony\Bundle\SwiftmailerBundle\DataCollector\MessageDataCollector::collect(): Implicitly marking parameter $exception as nullable is deprecated, the explicit nullable type must be used instead in /home/sites/5a/e/edf719076c/public_html/support/vendor/symfony/swiftmailer-bundle/DataCollector/MessageDataCollector.php on line 42
Symfony Profiler

vendor/symfony/http-kernel/Fragment/FragmentHandler.php line 85

Open in your IDE?
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\HttpKernel\Fragment;
  11. use Symfony\Component\HttpFoundation\RequestStack;
  12. use Symfony\Component\HttpFoundation\Response;
  13. use Symfony\Component\HttpFoundation\StreamedResponse;
  14. use Symfony\Component\HttpKernel\Controller\ControllerReference;
  15. use Symfony\Component\HttpKernel\Exception\HttpException;
  16. /**
  17. * Renders a URI that represents a resource fragment.
  18. *
  19. * This class handles the rendering of resource fragments that are included into
  20. * a main resource. The handling of the rendering is managed by specialized renderers.
  21. *
  22. * @author Fabien Potencier <fabien@symfony.com>
  23. *
  24. * @see FragmentRendererInterface
  25. */
  26. class FragmentHandler
  27. {
  28. private $debug;
  29. private $renderers = [];
  30. private $requestStack;
  31. /**
  32. * @param FragmentRendererInterface[] $renderers An array of FragmentRendererInterface instances
  33. * @param bool $debug Whether the debug mode is enabled or not
  34. */
  35. public function __construct(RequestStack $requestStack, array $renderers = [], bool $debug = false)
  36. {
  37. $this->requestStack = $requestStack;
  38. foreach ($renderers as $renderer) {
  39. $this->addRenderer($renderer);
  40. }
  41. $this->debug = $debug;
  42. }
  43. /**
  44. * Adds a renderer.
  45. */
  46. public function addRenderer(FragmentRendererInterface $renderer)
  47. {
  48. $this->renderers[$renderer->getName()] = $renderer;
  49. }
  50. /**
  51. * Renders a URI and returns the Response content.
  52. *
  53. * Available options:
  54. *
  55. * * ignore_errors: true to return an empty string in case of an error
  56. *
  57. * @param string|ControllerReference $uri A URI as a string or a ControllerReference instance
  58. *
  59. * @return string|null
  60. *
  61. * @throws \InvalidArgumentException when the renderer does not exist
  62. * @throws \LogicException when no main request is being handled
  63. */
  64. public function render($uri, string $renderer = 'inline', array $options = [])
  65. {
  66. if (!isset($options['ignore_errors'])) {
  67. $options['ignore_errors'] = !$this->debug;
  68. }
  69. if (!isset($this->renderers[$renderer])) {
  70. throw new \InvalidArgumentException(sprintf('The "%s" renderer does not exist.', $renderer));
  71. }
  72. if (!$request = $this->requestStack->getCurrentRequest()) {
  73. throw new \LogicException('Rendering a fragment can only be done when handling a Request.');
  74. }
  75. return $this->deliver($this->renderers[$renderer]->render($uri, $request, $options));
  76. }
  77. /**
  78. * Delivers the Response as a string.
  79. *
  80. * When the Response is a StreamedResponse, the content is streamed immediately
  81. * instead of being returned.
  82. *
  83. * @return string|null The Response content or null when the Response is streamed
  84. *
  85. * @throws \RuntimeException when the Response is not successful
  86. */
  87. protected function deliver(Response $response)
  88. {
  89. if (!$response->isSuccessful()) {
  90. $responseStatusCode = $response->getStatusCode();
  91. throw new \RuntimeException(sprintf('Error when rendering "%s" (Status code is %d).', $this->requestStack->getCurrentRequest()->getUri(), $responseStatusCode), 0, new HttpException($responseStatusCode));
  92. }
  93. if (!$response instanceof StreamedResponse) {
  94. return $response->getContent();
  95. }
  96. $response->sendContent();
  97. return null;
  98. }
  99. }