File "AssetExtension.php"

Full Path: /home/vantageo/public_html/cache/cache/cache/.wp-cli/wp-content/plugins/wp-phpmyadmin-extension/lib/phpMyAdmin/libraries/classes/Twig/AssetExtension.php
File size: 649 bytes
MIME-type: text/x-php
Charset: utf-8

<?php

declare(strict_types=1);

namespace PhpMyAdmin\Twig;

use PhpMyAdmin\Theme;
use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;

final class AssetExtension extends AbstractExtension
{
    /**
     * @return TwigFunction[]
     */
    public function getFunctions()
    {
        return [
            new TwigFunction('image', [$this, 'getImagePath']),
        ];
    }

    public function getImagePath(?string $filename = null, ?string $fallback = null): string
    {
        global $theme;

        if (! $theme instanceof Theme) {
            return '';
        }

        return $theme->getImgPath($filename, $fallback);
    }
}