ArrayLoader.php
1 month ago
CsvFileLoader.php
1 month ago
FileLoader.php
1 month ago
IcuDatFileLoader.php
1 month ago
IcuResFileLoader.php
1 month ago
IniFileLoader.php
1 month ago
JsonFileLoader.php
1 month ago
LoaderInterface.php
1 month ago
MoFileLoader.php
1 month ago
PhpFileLoader.php
1 month ago
PoFileLoader.php
1 month ago
QtFileLoader.php
1 month ago
XliffFileLoader.php
1 month ago
YamlFileLoader.php
1 month ago
PhpFileLoader.php
39 lines
| 1 | <?php |
| 2 | |
| 3 | /* |
| 4 | * This file is part of the Symfony package. |
| 5 | * |
| 6 | * (c) Fabien Potencier <fabien@symfony.com> |
| 7 | * |
| 8 | * For the full copyright and license information, please view the LICENSE |
| 9 | * file that was distributed with this source code. |
| 10 | */ |
| 11 | namespace IAWPSCOPED\Symfony\Component\Translation\Loader; |
| 12 | |
| 13 | /** |
| 14 | * PhpFileLoader loads translations from PHP files returning an array of translations. |
| 15 | * |
| 16 | * @author Fabien Potencier <fabien@symfony.com> |
| 17 | * @internal |
| 18 | */ |
| 19 | class PhpFileLoader extends FileLoader |
| 20 | { |
| 21 | private static ?array $cache = []; |
| 22 | /** |
| 23 | * {@inheritdoc} |
| 24 | */ |
| 25 | protected function loadResource(string $resource) : array |
| 26 | { |
| 27 | if ([] === self::$cache && \function_exists('opcache_invalidate') && \filter_var(\ini_get('opcache.enable'), \FILTER_VALIDATE_BOOLEAN) && (!\in_array(\PHP_SAPI, ['cli', 'phpdbg'], \true) || \filter_var(\ini_get('opcache.enable_cli'), \FILTER_VALIDATE_BOOLEAN))) { |
| 28 | self::$cache = null; |
| 29 | } |
| 30 | if (null === self::$cache) { |
| 31 | return require $resource; |
| 32 | } |
| 33 | if (isset(self::$cache[$resource])) { |
| 34 | return self::$cache[$resource]; |
| 35 | } |
| 36 | return self::$cache[$resource] = (require $resource); |
| 37 | } |
| 38 | } |
| 39 |