# hyperpay-gateways/trunk/src/Helpers/View.php

HyperPay Payments, version trunk. 37 lines.

- Page: https://pluginprobe.com/plugins/hyperpay-gateways/trunk/code/src/Helpers/View.php
- Raw: https://pluginprobe.com/plugins/hyperpay-gateways/trunk/raw/src/Helpers/View.php
- Modified: 2025-12-16T07:47:04+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/hyperpay-gateways/trunk/code/src/Helpers/View.php#L10-L20`.

```php
<?php

namespace Hyperpay\Gateways\Helpers;

if (! defined('ABSPATH')) exit;

use Hyperpay\Gateways\Main;

final class View
{
    public static function render($name, $params = [])
    {
        $loader = new \Twig\Loader\FilesystemLoader(Main::ROOT_PATH . "/assets/templates");
        $twig = new \Twig\Environment($loader);

        $params = static::esc($params);

        // rendering the template HTML, JS and CSS
        // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
        echo ($twig->render($name, $params));
        return;
    }

    public static function esc($value)
    {
        if (is_array($value)) {
            $esc_values = [];
            foreach ($value as $key => $nested_value) {
                $esc_values[$key] =  static::esc($nested_value);
            }
            return $esc_values;
        }

        return esc_html($value);
    }
}

```
