From dec2c3fe81bf2c438f57a84d61b125211bdbd9e0 Mon Sep 17 00:00:00 2001 From: Awilum Date: Wed, 8 Jan 2020 19:57:34 +0300 Subject: [PATCH] feat(core): update CsrfTwigExtension for this issue - #351 --- flextype/twig/CsrfTwigExtension.php | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/flextype/twig/CsrfTwigExtension.php b/flextype/twig/CsrfTwigExtension.php index b588f69f..f6c655d9 100644 --- a/flextype/twig/CsrfTwigExtension.php +++ b/flextype/twig/CsrfTwigExtension.php @@ -16,15 +16,17 @@ use Twig_SimpleFunction; class CsrfTwigExtension extends Twig_Extension implements Twig_Extension_GlobalsInterface { - /** @var Guard */ - protected $csrf; + /** + * Flextype Dependency Container + */ + private $flextype; /** * Constructor */ - public function __construct(Guard $csrf) + public function __construct($flextype) { - $this->csrf = $csrf; + $this->flextype = $flextype; } /** @@ -33,10 +35,10 @@ class CsrfTwigExtension extends Twig_Extension implements Twig_Extension_Globals public function getGlobals() { // CSRF token name and value - $csrfNameKey = $this->csrf->getTokenNameKey(); - $csrfValueKey = $this->csrf->getTokenValueKey(); - $csrfName = $this->csrf->getTokenName(); - $csrfValue = $this->csrf->getTokenValue(); + $csrfNameKey = $this->flextype->csrf->getTokenNameKey(); + $csrfValueKey = $this->flextype->csrf->getTokenValueKey(); + $csrfName = $this->flextype->csrf->getTokenName(); + $csrfValue = $this->flextype->csrf->getTokenValue(); return [ 'csrf' => [ @@ -72,7 +74,7 @@ class CsrfTwigExtension extends Twig_Extension implements Twig_Extension_Globals */ public function csrf() : string { - return '' . - ''; + return '' . + ''; } }