PluginProbe
MailPoet – Newsletters, Email Marketing, and Automation / 5.38.0
MailPoet – Newsletters, Email Marketing, and Automation v5.38.0
5.38.0 5.37.0 5.36.1 5.36.0 5.35.1 5.35.0 5.34.3 5.34.2 5.34.1 5.34.0 5.33.1 5.33.0 5.32.0 5.31.0 5.30.0 5.29.0 5.28.1 5.28.0 5.27.0 5.26.0 5.26.1 5.25.0 5.24.0 4.43.0 4.43.1 All 542 releases
mailpoet / lib / Config / TwigFileSystemCache.php
TwigFileSystemCache.php
30 lines 853 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
2
3 namespace MailPoet\Config;
4
5 if (!defined('ABSPATH')) exit;
6
7
8 class TwigFileSystemCache extends \MailPoetVendor\Twig\Cache\FilesystemCache {
9
10 private $directory;
11
12 public function __construct(
13 string $directory,
14 int $options = 0
15 ) {
16 $this->directory = \rtrim($directory, '\\/') . '/';
17 parent::__construct($directory, $options);
18 }
19
20 /**
21 * The original FileSystemCache of twig generates the key depending on PHP_VERSION.
22 * We need to produce the same key regardless of PHP_VERSION. Therefore, we
23 * overwrite this method.
24 **/
25 public function generateKey(string $name, string $className): string {
26 $hash = \hash('sha256', $className);
27 return $this->directory . $hash[0] . $hash[1] . '/' . $hash . '.php';
28 }
29 }
30