@@ 179-181 (lines=3) @@ | ||
176 | ||
177 | if (!\is_array($values)) { |
|
178 | // This is simple, just one value. |
|
179 | if ((!is_numeric($values) && !\is_string($values)) || 1 !== preg_match("@^[ \t\x21-\x7E\x80-\xFF]*$@", (string) $values)) { |
|
180 | throw new \InvalidArgumentException('Header values must be RFC 7230 compatible strings.'); |
|
181 | } |
|
182 | ||
183 | return [trim((string) $values, " \t")]; |
|
184 | } |
|
@@ 193-195 (lines=3) @@ | ||
190 | // Assert Non empty array |
|
191 | $returnValues = []; |
|
192 | foreach ($values as $v) { |
|
193 | if ((!is_numeric($v) && !\is_string($v)) || 1 !== preg_match("@^[ \t\x21-\x7E\x80-\xFF]*$@", (string) $v)) { |
|
194 | throw new \InvalidArgumentException('Header values must be RFC 7230 compatible strings.'); |
|
195 | } |
|
196 | ||
197 | $returnValues[] = trim((string) $v, " \t"); |
|
198 | } |