vendor/se7enxweb/admin-ui/src/lib/Component/TwigComponent.php line 51

Open in your IDE?
  1. <?php
  2. /**
  3. * @copyright Copyright (C) Ibexa AS. All rights reserved.
  4. * @license For full copyright and license information view LICENSE file distributed with this source code.
  5. */
  6. declare(strict_types=1);
  7. namespace Ibexa\AdminUi\Component;
  8. use Ibexa\Contracts\TwigComponents\ComponentInterface;
  9. use Twig\Environment;
  10. /**
  11. * @deprecated 4.6.19 The {@see \Ibexa\AdminUi\Component\TwigComponent} class is deprecated, will be removed in 6.0.
  12. * Use {@see \Ibexa\TwigComponents\Component\TemplateComponent} instead
  13. */
  14. class TwigComponent implements ComponentInterface
  15. {
  16. /** @var string */
  17. protected $template;
  18. /** @var \Twig\Environment */
  19. protected $twig;
  20. /** @var array */
  21. protected $parameters;
  22. /**
  23. * @param \Twig\Environment $twig
  24. * @param string $template
  25. * @param array $parameters
  26. */
  27. public function __construct(
  28. Environment $twig,
  29. string $template,
  30. array $parameters = []
  31. ) {
  32. $this->twig = $twig;
  33. $this->template = $template;
  34. $this->parameters = $parameters;
  35. }
  36. /**
  37. * @param array $parameters
  38. *
  39. * @return string
  40. */
  41. public function render(array $parameters = []): string
  42. {
  43. return $this->twig->render($this->template, $parameters + $this->parameters);
  44. }
  45. }
  46. class_alias(TwigComponent::class, 'EzSystems\EzPlatformAdminUi\Component\TwigComponent');