1 | <?php |
||
7 | final class NativeRenderer implements QueryStringRendererInterface |
||
8 | { |
||
9 | /** |
||
10 | * @var int |
||
11 | */ |
||
12 | private $encoding; |
||
13 | |||
14 | /** |
||
15 | * @var string|null |
||
16 | */ |
||
17 | private $separator; |
||
18 | |||
19 | /** |
||
20 | * NativeRenderer constructor. |
||
21 | * @param int $encoding |
||
22 | */ |
||
23 | protected function __construct(int $encoding) |
||
27 | |||
28 | /** |
||
29 | * @param int $encoding |
||
30 | * @return NativeRenderer |
||
31 | * @throws \InvalidArgumentException |
||
32 | */ |
||
33 | public static function factory(int $encoding = self::DEFAULT_ENCODING): self |
||
39 | |||
40 | /** |
||
41 | * @return int |
||
42 | */ |
||
43 | public function getEncoding(): int |
||
47 | |||
48 | /** |
||
49 | * @param int $encoding |
||
50 | * @return NativeRenderer |
||
51 | */ |
||
52 | public function withEncoding(int $encoding): QueryStringRendererInterface |
||
58 | |||
59 | /** |
||
60 | * @return null|string |
||
61 | */ |
||
62 | public function getSeparator(): ?string |
||
66 | |||
67 | /** |
||
68 | * @param null|string $separator |
||
69 | * @return QueryString |
||
70 | */ |
||
71 | public function withSeparator(?string $separator): QueryStringRendererInterface |
||
78 | |||
79 | /** |
||
80 | * @inheritDoc |
||
81 | */ |
||
82 | public function render(QueryString $queryString): string |
||
91 | |||
92 | /** |
||
93 | * @param int $encoding |
||
94 | * @throws \InvalidArgumentException |
||
95 | */ |
||
96 | private static function validateEncoding(int $encoding): void |
||
102 | } |
||
103 |