Code Duplication    Length = 3-3 lines in 2 locations

src/MessageTrait.php 2 locations

@@ 186-188 (lines=3) @@
183
184
        if (!\is_array($values)) {
185
            // This is simple, just one value.
186
            if ((!\is_numeric($values) && !\is_string($values)) || 1 !== \preg_match("@^[ \t\x21-\x7E\x80-\xFF]*$@", (string) $values)) {
187
                throw new \InvalidArgumentException('Header values must be RFC 7230 compatible strings.');
188
            }
189
190
            return [\trim((string) $values, " \t")];
191
        }
@@ 200-202 (lines=3) @@
197
        // Assert Non empty array
198
        $returnValues = [];
199
        foreach ($values as $v) {
200
            if ((!\is_numeric($v) && !\is_string($v)) || 1 !== \preg_match("@^[ \t\x21-\x7E\x80-\xFF]*$@", (string) $v)) {
201
                throw new \InvalidArgumentException('Header values must be RFC 7230 compatible strings.');
202
            }
203
204
            $returnValues[] = \trim((string) $v, " \t");
205
        }