Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
parameter.php
1<?php
2
3
5
6
8{
9 private $name;
10 private $value;
11 private $disableEscaping;
12
13 public static function getInstance(string $name, string $value, $disableEscaping = false): Parameter
14 {
15 return new self($name, $value, $disableEscaping);
16 }
17
18 public function __construct(string $name, string $value, $disableEscaping = false)
19 {
20 $this->name = $name;
21
22 $this->value = $value;
23 $this->disableEscaping = $disableEscaping;
24 }
25
26 public function getName(): string
27 {
28 return $this->name;
29 }
30
31 public function getValue(): string
32 {
33 if ($this->disableEscaping) {
34 return $this->value;
35 }
36
37 $replacements = [
38 '\\' => '\\\\',
39 '"' => '\\"',
40 ',' => '\\,',
41 ';' => '\\;',
42 "\n" => '\\n',
43 ];
44
45 return str_replace(array_keys($replacements), $replacements, $this->value);
46 }
47}
static getInstance(string $name, string $value, $disableEscaping=false)
Definition parameter.php:13
__construct(string $name, string $value, $disableEscaping=false)
Definition parameter.php:18