Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php namespace Pagekit\Twig; use Pagekit\View\Loader\FilesystemLoader; use Symfony\Comp..

Decoded Output download

<?php

namespace Pagekit\Twig;

use Pagekit\View\Loader\FilesystemLoader;
use Symfony\Component\Templating\TemplateNameParser;
use Symfony\Component\Templating\TemplateNameParserInterface;

class TwigLoader extends \Twig_Loader_Filesystem
{
    protected $loader;
    protected $parser;

    /**
     * Constructor.
     *
     * @param FilesystemLoader            $loader
     * @param TemplateNameParserInterface $parser
     */
    public function __construct(FilesystemLoader $loader, TemplateNameParserInterface $parser = null)
    {
        parent::__construct([]);

        $this->loader = $loader;
        $this->parser = $parser ?: new TemplateNameParser();
    }

    /**
     * {@inheritdoc}
     */
    protected function findTemplate($template, $throw = true)
    {
        $key = (string) $template;

        if (isset($this->cache[$key])) {
            return $this->cache[$key];
        }

        $file = $this->loader->load($this->parser->parse($template));

        if (false === $file || null === $file) {
            throw new \Twig_Error_Loader(sprintf('Unable to find template "%s".', $key));
        }

        return $this->cache[$key] = $file;
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php

namespace Pagekit\Twig;

use Pagekit\View\Loader\FilesystemLoader;
use Symfony\Component\Templating\TemplateNameParser;
use Symfony\Component\Templating\TemplateNameParserInterface;

class TwigLoader extends \Twig_Loader_Filesystem
{
    protected $loader;
    protected $parser;

    /**
     * Constructor.
     *
     * @param FilesystemLoader            $loader
     * @param TemplateNameParserInterface $parser
     */
    public function __construct(FilesystemLoader $loader, TemplateNameParserInterface $parser = null)
    {
        parent::__construct([]);

        $this->loader = $loader;
        $this->parser = $parser ?: new TemplateNameParser();
    }

    /**
     * {@inheritdoc}
     */
    protected function findTemplate($template, $throw = true)
    {
        $key = (string) $template;

        if (isset($this->cache[$key])) {
            return $this->cache[$key];
        }

        $file = $this->loader->load($this->parser->parse($template));

        if (false === $file || null === $file) {
            throw new \Twig_Error_Loader(sprintf('Unable to find template "%s".', $key));
        }

        return $this->cache[$key] = $file;
    }
}

Function Calls

None

Variables

None

Stats

MD5 7970eac1f8bea26caf2d22840426d5ae
Eval Count 0
Decode Time 99 ms