AbstractSurrogateFragmentRenderer.php
1 year ago
EsiFragmentRenderer.php
2 years ago
FragmentHandler.php
1 year ago
FragmentRendererInterface.php
2 years ago
FragmentUriGenerator.php
1 year ago
FragmentUriGeneratorInterface.php
1 year ago
HIncludeFragmentRenderer.php
1 year ago
InlineFragmentRenderer.php
1 year ago
RoutableFragmentRenderer.php
1 year ago
SsiFragmentRenderer.php
2 years ago
RoutableFragmentRenderer.php
49 lines
| 1 | <?php |
| 2 | |
| 3 | /* |
| 4 | * This file is part of the Symfony package. |
| 5 | * |
| 6 | * (c) Fabien Potencier <fabien@symfony.com> |
| 7 | * |
| 8 | * For the full copyright and license information, please view the LICENSE |
| 9 | * file that was distributed with this source code. |
| 10 | */ |
| 11 | namespace Matomo\Dependencies\Symfony\Component\HttpKernel\Fragment; |
| 12 | |
| 13 | use Matomo\Dependencies\Symfony\Component\HttpFoundation\Request; |
| 14 | use Matomo\Dependencies\Symfony\Component\HttpKernel\Controller\ControllerReference; |
| 15 | use Matomo\Dependencies\Symfony\Component\HttpKernel\EventListener\FragmentListener; |
| 16 | /** |
| 17 | * Adds the possibility to generate a fragment URI for a given Controller. |
| 18 | * |
| 19 | * @author Fabien Potencier <fabien@symfony.com> |
| 20 | */ |
| 21 | abstract class RoutableFragmentRenderer implements FragmentRendererInterface |
| 22 | { |
| 23 | /** |
| 24 | * @internal |
| 25 | */ |
| 26 | protected $fragmentPath = '/_fragment'; |
| 27 | /** |
| 28 | * Sets the fragment path that triggers the fragment listener. |
| 29 | * |
| 30 | * @see FragmentListener |
| 31 | */ |
| 32 | public function setFragmentPath(string $path) |
| 33 | { |
| 34 | $this->fragmentPath = $path; |
| 35 | } |
| 36 | /** |
| 37 | * Generates a fragment URI for a given controller. |
| 38 | * |
| 39 | * @param bool $absolute Whether to generate an absolute URL or not |
| 40 | * @param bool $strict Whether to allow non-scalar attributes or not |
| 41 | * |
| 42 | * @return string |
| 43 | */ |
| 44 | protected function generateFragmentUri(ControllerReference $reference, Request $request, bool $absolute = \false, bool $strict = \true) |
| 45 | { |
| 46 | return (new FragmentUriGenerator($this->fragmentPath))->generate($reference, $request, $absolute, $strict, \false); |
| 47 | } |
| 48 | } |
| 49 |