phprs\util\IoCFactory::replaceByDict PHP Méthode

replaceByDict() private méthode

替换字典
See also: setDict
private replaceByDict ( string | array $value, $dict ) : void
$value string | array
Résultat void
    private function replaceByDict($value, $dict)
    {
        if (is_string($value)) {
            $keys = $this->getDictKeys($value);
            foreach ($keys as $key) {
                Verify::isTrue(isset($dict[$key]), "{$key} not specified");
            }
            foreach ($dict as $key => $replace) {
                $value = str_replace('{' . $key . '}', $replace, $value);
            }
            return $value;
        } else {
            if (is_array($value)) {
                foreach ($value as $k => $v) {
                    $value[$k] = $this->replaceByDict($v, $dict);
                }
                return $value;
            } else {
                return $value;
            }
        }
    }