Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ReplaceDecorator.php « decorators « src - github.com/HuasoFoundries/phpPgAdmin6.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e487362c1c2d61c22f59ae8edffd89e6d0baf9cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php

/**
 * PHPPgAdmin6
 */

namespace PHPPgAdmin\Decorators;

class ReplaceDecorator extends Decorator
{
    /**
     * @var mixed
     */
    public $s;

    public $p;

    public function __construct($str, $params)
    {
        $this->s = $str;
        $this->p = $params;
    }

    public function value($fields)
    {
        $str = $this->s;

        foreach ($this->p as $k => $v) {
            $str = \str_replace($k, Decorator::get_sanitized_value($v, $fields), $str);
        }

        return $str;
    }
}