You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.3 KiB

3 years ago
  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\Controller;
  11. use Symfony\Component\HttpKernel\Fragment\FragmentRendererInterface;
  12. /**
  13. * Acts as a marker and a data holder for a Controller.
  14. *
  15. * Some methods in Symfony accept both a URI (as a string) or a controller as
  16. * an argument. In the latter case, instead of passing an array representing
  17. * the controller, you can use an instance of this class.
  18. *
  19. * @author Fabien Potencier <fabien@symfony.com>
  20. *
  21. * @see FragmentRendererInterface
  22. */
  23. class ControllerReference
  24. {
  25. public $controller;
  26. public $attributes = [];
  27. public $query = [];
  28. /**
  29. * @param string $controller The controller name
  30. * @param array $attributes An array of parameters to add to the Request attributes
  31. * @param array $query An array of parameters to add to the Request query string
  32. */
  33. public function __construct(string $controller, array $attributes = [], array $query = [])
  34. {
  35. $this->controller = $controller;
  36. $this->attributes = $attributes;
  37. $this->query = $query;
  38. }
  39. }