mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-27 20:48:46 +02:00
migration symfony 5 4 (#300)
* symfony 5.4 (diff dev) * symfony 5.4 (working) * symfony 5.4 (update autoload) * symfony 5.4 (remove swiftmailer mailer implementation) * symfony 5.4 (php doc and split Global accessor class) ### Impacted packages: composer require php:">=7.2.5 <8.0.0" symfony/console:5.4.* symfony/dotenv:5.4.* symfony/framework-bundle:5.4.* symfony/twig-bundle:5.4.* symfony/yaml:5.4.* --update-with-dependencies composer require symfony/stopwatch:5.4.* symfony/web-profiler-bundle:5.4.* --dev --update-with-dependencies
This commit is contained in:
@@ -13,34 +13,34 @@ namespace Symfony\Bridge\Twig\Extension;
|
||||
|
||||
use Symfony\Component\HttpKernel\Controller\ControllerReference;
|
||||
use Symfony\Component\HttpKernel\Fragment\FragmentHandler;
|
||||
use Symfony\Component\HttpKernel\Fragment\FragmentUriGeneratorInterface;
|
||||
|
||||
/**
|
||||
* Provides integration with the HttpKernel component.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class HttpKernelRuntime
|
||||
final class HttpKernelRuntime
|
||||
{
|
||||
private $handler;
|
||||
private $fragmentUriGenerator;
|
||||
|
||||
public function __construct(FragmentHandler $handler)
|
||||
public function __construct(FragmentHandler $handler, FragmentUriGeneratorInterface $fragmentUriGenerator = null)
|
||||
{
|
||||
$this->handler = $handler;
|
||||
$this->fragmentUriGenerator = $fragmentUriGenerator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders a fragment.
|
||||
*
|
||||
* @param string|ControllerReference $uri A URI as a string or a ControllerReference instance
|
||||
* @param array $options An array of options
|
||||
*
|
||||
* @return string The fragment content
|
||||
* @param string|ControllerReference $uri A URI as a string or a ControllerReference instance
|
||||
*
|
||||
* @see FragmentHandler::render()
|
||||
*/
|
||||
public function renderFragment($uri, $options = [])
|
||||
public function renderFragment($uri, array $options = []): string
|
||||
{
|
||||
$strategy = isset($options['strategy']) ? $options['strategy'] : 'inline';
|
||||
$strategy = $options['strategy'] ?? 'inline';
|
||||
unset($options['strategy']);
|
||||
|
||||
return $this->handler->render($uri, $strategy, $options);
|
||||
@@ -49,16 +49,21 @@ class HttpKernelRuntime
|
||||
/**
|
||||
* Renders a fragment.
|
||||
*
|
||||
* @param string $strategy A strategy name
|
||||
* @param string|ControllerReference $uri A URI as a string or a ControllerReference instance
|
||||
* @param array $options An array of options
|
||||
*
|
||||
* @return string The fragment content
|
||||
* @param string|ControllerReference $uri A URI as a string or a ControllerReference instance
|
||||
*
|
||||
* @see FragmentHandler::render()
|
||||
*/
|
||||
public function renderFragmentStrategy($strategy, $uri, $options = [])
|
||||
public function renderFragmentStrategy(string $strategy, $uri, array $options = []): string
|
||||
{
|
||||
return $this->handler->render($uri, $strategy, $options);
|
||||
}
|
||||
|
||||
public function generateFragmentUri(ControllerReference $controller, bool $absolute = false, bool $strict = true, bool $sign = true): string
|
||||
{
|
||||
if (null === $this->fragmentUriGenerator) {
|
||||
throw new \LogicException(sprintf('An instance of "%s" must be provided to use "%s()".', FragmentUriGeneratorInterface::class, __METHOD__));
|
||||
}
|
||||
|
||||
return $this->fragmentUriGenerator->generate($controller, null, $absolute, $strict, $sign);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user