HEX
Server: Apache
System: Linux cpanelx.inxs.ro 4.18.0-477.27.2.lve.el8.x86_64 #1 SMP Wed Oct 11 12:32:56 UTC 2023 x86_64
User: crowdandsafety (1041)
PHP: 8.1.34
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //proc/self/cwd/wp-content/plugins/cornerstone/includes/integration/Twig/src/StringLoader.php
<?php

// https://github.com/shapecode/twig-string-loader/blob/master/src/Twig/Loader/StringLoader.php

namespace Cornerstone\TwigIntegration;

use Twig\Error\LoaderError;
use Twig\Loader\LoaderInterface;
use Twig\Source;

use function md5;
use function preg_match;
use function sprintf;

class StringLoader implements LoaderInterface
{
    public function getSourceContext(string $name): Source
    {
        if (! $this->exists($name)) {
            throw new LoaderError(sprintf('Template "%s" is not defined.', $name));
        }

        return new Source($name, $name);
    }

    public function getCacheKey(string $name): string
    {

        if (! $this->exists($name)) {
            throw new LoaderError(sprintf('Template "%s" is not defined.', $name));
        }

        return md5($name);
    }

    public function isFresh(string $name, int $time): bool
    {
        if (! $this->exists($name)) {
            throw new LoaderError(sprintf('Template "%s" is not defined.', $name));
        }

        return true;
    }

    /** @phpstan-param string $name */
    public function exists(string $name): bool
    {
        return true;
    }
}