1 | <?php |
||
8 | final class Pairs implements IteratorAggregate |
||
9 | { |
||
10 | /** |
||
11 | * @var string |
||
12 | */ |
||
13 | private $queryString; |
||
14 | |||
15 | /** |
||
16 | * @var bool |
||
17 | */ |
||
18 | private $decodeKeys; |
||
19 | |||
20 | /** |
||
21 | * @var bool |
||
22 | */ |
||
23 | private $decodeValues; |
||
24 | |||
25 | /** |
||
26 | * @var null|string |
||
27 | */ |
||
28 | private $separator; |
||
29 | |||
30 | /** |
||
31 | * Pairs constructor. |
||
32 | */ |
||
33 | public function __construct( |
||
45 | |||
46 | /** |
||
47 | * @param string $queryString |
||
48 | * @return Pairs |
||
49 | */ |
||
50 | public function withQueryString(string $queryString): self |
||
56 | |||
57 | /** |
||
58 | * @param bool $decodeKeys |
||
59 | * @return Pairs |
||
60 | */ |
||
61 | public function withDecodeKeys(bool $decodeKeys): self |
||
62 | { |
||
63 | $clone = clone $this; |
||
64 | $clone->decodeKeys = $decodeKeys; |
||
65 | return $clone; |
||
66 | } |
||
67 | |||
68 | /** |
||
69 | * @param bool $decodeValues |
||
70 | * @return Pairs |
||
71 | */ |
||
72 | public function withDecodeValues(bool $decodeValues): self |
||
73 | { |
||
74 | $clone = clone $this; |
||
75 | $clone->decodeValues = $decodeValues; |
||
76 | return $clone; |
||
77 | } |
||
78 | |||
79 | /** |
||
80 | * @param null|string $separator |
||
81 | * @return Pairs |
||
82 | */ |
||
83 | public function withSeparator(?string $separator): self |
||
84 | { |
||
85 | $clone = clone $this; |
||
86 | $clone->separator = $separator; |
||
87 | return $clone; |
||
88 | } |
||
89 | |||
90 | /** |
||
91 | * @return Traversable |
||
92 | */ |
||
93 | public function getIterator(): Traversable |
||
111 | |||
112 | /** |
||
113 | * @return string |
||
114 | */ |
||
115 | public function __toString(): string |
||
119 | } |
||
120 |