Update website
This commit is contained in:
parent
4413528994
commit
1d90fbf296
6865 changed files with 1091082 additions and 0 deletions
37
vendor/doctrine/rst-parser/lib/Templates/TwigAdapter.php
vendored
Normal file
37
vendor/doctrine/rst-parser/lib/Templates/TwigAdapter.php
vendored
Normal file
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\RST\Templates;
|
||||
|
||||
use Doctrine\RST\Configuration;
|
||||
use Twig\Environment as TwigEnvironment;
|
||||
|
||||
final class TwigAdapter implements TemplateEngineAdapter
|
||||
{
|
||||
/** @var Configuration */
|
||||
private $configuration;
|
||||
|
||||
/** @var TwigEnvironment */
|
||||
private $twigEnvironment;
|
||||
|
||||
public function __construct(Configuration $configuration)
|
||||
{
|
||||
$this->configuration = $configuration;
|
||||
}
|
||||
|
||||
public function getTemplateEngine(): TwigEnvironment
|
||||
{
|
||||
if ($this->twigEnvironment === null) {
|
||||
$this->twigEnvironment = TwigEnvironmentFactory::createTwigEnvironment($this->configuration);
|
||||
}
|
||||
|
||||
return $this->twigEnvironment;
|
||||
}
|
||||
|
||||
/** @param mixed[] $parameters */
|
||||
public function render(string $template, array $parameters = []): string
|
||||
{
|
||||
return $this->getTemplateEngine()->render($template, $parameters);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue