![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/cartforge.co/vendor/magento/framework/Filter/DirectiveProcessor/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ declare(strict_types=1); namespace Magento\Framework\Filter\DirectiveProcessor; use Magento\Framework\Filter\DirectiveProcessorInterface; use Magento\Framework\Filter\Template; /** * Backwards compatibility directive processor for old directives that still extend from Template */ class LegacyDirective implements DirectiveProcessorInterface { /** * @var SimpleDirective */ private $simpleDirective; /** * @param SimpleDirective $simpleDirective */ public function __construct(SimpleDirective $simpleDirective) { $this->simpleDirective = $simpleDirective; } /** * @inheritdoc */ public function process(array $construction, Template $filter, array $templateVariables): string { try { $reflectionClass = new \ReflectionClass($filter); $method = $reflectionClass->getMethod($construction[1] . 'Directive'); $method->setAccessible(true); return (string)$method->invokeArgs($filter, [$construction]); } catch (\ReflectionException $e) { // The legacy parser may be the only parser loaded so make sure the simple directives still process preg_match($this->simpleDirective->getRegularExpression(), $construction[0] ?? '', $simpleConstruction); return $this->simpleDirective->process($simpleConstruction, $filter, $templateVariables); } } /** * @inheritdoc */ public function getRegularExpression(): string { return Template::CONSTRUCTION_PATTERN; } }