Skip to content

Commit a1134b1

Browse files
committed
Fix indentation
1 parent 67053b3 commit a1134b1

File tree

2 files changed

+30
-21
lines changed

2 files changed

+30
-21
lines changed

.editorconfig

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_size = 4
7+
indent_style = space
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true

src/functions.php

+21-21
Original file line numberDiff line numberDiff line change
@@ -759,33 +759,33 @@ function _parse_message($message)
759759
}
760760

761761
$headerDelimiterPosition = strpos($message, "\r\n\r\n");
762-
$rawHeaders = substr($message, 0, $headerDelimiterPosition + 2); // We preserve the last \r\n, hence +2
763-
$startLineEndPosition = strpos($rawHeaders, "\r\n");
762+
$rawHeaders = substr($message, 0, $headerDelimiterPosition + 2); // We preserve the last \r\n, hence +2
763+
$startLineEndPosition = strpos($rawHeaders, "\r\n");
764764

765-
$result = [
766-
'start-line' => substr($rawHeaders, 0, $startLineEndPosition),
767-
'headers' => [],
768-
'body' => (string) substr($message, $headerDelimiterPosition + 4),
769-
];
765+
$result = [
766+
'start-line' => substr($rawHeaders, 0, $startLineEndPosition),
767+
'headers' => [],
768+
'body' => (string)substr($message, $headerDelimiterPosition + 4),
769+
];
770770

771-
$rawHeaders = substr($rawHeaders, $startLineEndPosition + 2);
771+
$rawHeaders = substr($rawHeaders, $startLineEndPosition + 2);
772772

773-
/** @var array[] $headerLines */
774-
$count = preg_match_all(Rfc7230::HEADER_REGEX, $rawHeaders, $headerLines, PREG_SET_ORDER);
773+
/** @var array[] $headerLines */
774+
$count = preg_match_all(Rfc7230::HEADER_REGEX, $rawHeaders, $headerLines, PREG_SET_ORDER);
775775

776-
// If these aren't the same, then one line didn't match and there's an invalid header.
777-
if ($count !== substr_count($rawHeaders, "\n")) {
778-
// Folding is deprecated, see https://tools.ietf.org/html/rfc7230#section-3.2.4
779-
if (preg_match(Rfc7230::HEADER_FOLD_REGEX, $rawHeaders)) {
780-
throw new \InvalidArgumentException('Invalid header syntax: Obsolete line folding');
781-
}
776+
// If these aren't the same, then one line didn't match and there's an invalid header.
777+
if ($count !== substr_count($rawHeaders, "\n")) {
778+
// Folding is deprecated, see https://tools.ietf.org/html/rfc7230#section-3.2.4
779+
if (preg_match(Rfc7230::HEADER_FOLD_REGEX, $rawHeaders)) {
780+
throw new \InvalidArgumentException('Invalid header syntax: Obsolete line folding');
781+
}
782782

783-
throw new \InvalidArgumentException('Invalid header syntax');
784-
}
783+
throw new \InvalidArgumentException('Invalid header syntax');
784+
}
785785

786-
foreach ($headerLines as $headerLine) {
787-
$result['headers'][strtolower($headerLine[1])][] = $headerLine[2];
788-
}
786+
foreach ($headerLines as $headerLine) {
787+
$result['headers'][strtolower($headerLine[1])][] = $headerLine[2];
788+
}
789789

790790
return $result;
791791
}

0 commit comments

Comments
 (0)