Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/http-kernel/Fragment/FragmentHandler.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | 1fec387a4317 |
children |
comparison
equal
deleted
inserted
replaced
16:c2387f117808 | 17:129ea1e6d783 |
---|---|
9 * file that was distributed with this source code. | 9 * file that was distributed with this source code. |
10 */ | 10 */ |
11 | 11 |
12 namespace Symfony\Component\HttpKernel\Fragment; | 12 namespace Symfony\Component\HttpKernel\Fragment; |
13 | 13 |
14 use Symfony\Component\HttpFoundation\RequestStack; | |
14 use Symfony\Component\HttpFoundation\Response; | 15 use Symfony\Component\HttpFoundation\Response; |
15 use Symfony\Component\HttpFoundation\StreamedResponse; | 16 use Symfony\Component\HttpFoundation\StreamedResponse; |
16 use Symfony\Component\HttpFoundation\RequestStack; | |
17 use Symfony\Component\HttpKernel\Controller\ControllerReference; | 17 use Symfony\Component\HttpKernel\Controller\ControllerReference; |
18 | 18 |
19 /** | 19 /** |
20 * Renders a URI that represents a resource fragment. | 20 * Renders a URI that represents a resource fragment. |
21 * | 21 * |
27 * @see FragmentRendererInterface | 27 * @see FragmentRendererInterface |
28 */ | 28 */ |
29 class FragmentHandler | 29 class FragmentHandler |
30 { | 30 { |
31 private $debug; | 31 private $debug; |
32 private $renderers = array(); | 32 private $renderers = []; |
33 private $requestStack; | 33 private $requestStack; |
34 | 34 |
35 /** | 35 /** |
36 * @param RequestStack $requestStack The Request stack that controls the lifecycle of requests | 36 * @param RequestStack $requestStack The Request stack that controls the lifecycle of requests |
37 * @param FragmentRendererInterface[] $renderers An array of FragmentRendererInterface instances | 37 * @param FragmentRendererInterface[] $renderers An array of FragmentRendererInterface instances |
38 * @param bool $debug Whether the debug mode is enabled or not | 38 * @param bool $debug Whether the debug mode is enabled or not |
39 */ | 39 */ |
40 public function __construct(RequestStack $requestStack, array $renderers = array(), $debug = false) | 40 public function __construct(RequestStack $requestStack, array $renderers = [], $debug = false) |
41 { | 41 { |
42 $this->requestStack = $requestStack; | 42 $this->requestStack = $requestStack; |
43 foreach ($renderers as $renderer) { | 43 foreach ($renderers as $renderer) { |
44 $this->addRenderer($renderer); | 44 $this->addRenderer($renderer); |
45 } | 45 } |
68 * @return string|null The Response content or null when the Response is streamed | 68 * @return string|null The Response content or null when the Response is streamed |
69 * | 69 * |
70 * @throws \InvalidArgumentException when the renderer does not exist | 70 * @throws \InvalidArgumentException when the renderer does not exist |
71 * @throws \LogicException when no master request is being handled | 71 * @throws \LogicException when no master request is being handled |
72 */ | 72 */ |
73 public function render($uri, $renderer = 'inline', array $options = array()) | 73 public function render($uri, $renderer = 'inline', array $options = []) |
74 { | 74 { |
75 if (!isset($options['ignore_errors'])) { | 75 if (!isset($options['ignore_errors'])) { |
76 $options['ignore_errors'] = !$this->debug; | 76 $options['ignore_errors'] = !$this->debug; |
77 } | 77 } |
78 | 78 |