17
17
* A header formatter that splits the value(s) from a given
18
18
* other header formatter (e.g. the CommaSeparatedTagHeaderFormatter)
19
19
* into multiple headers making sure none of the header values
20
- * exceeds the configured limit
20
+ * exceeds the configured limit.
21
21
*
22
22
* @author Yanick Witschi <[email protected] >
23
23
*/
@@ -40,7 +40,7 @@ class MaxHeaderValueLengthFormatter implements TagHeaderFormatter
40
40
* use up just one byte.
41
41
*
42
42
* @param TagHeaderFormatter $inner
43
- * @param int $maxHeaderValueLength
43
+ * @param int $maxHeaderValueLength
44
44
*/
45
45
public function __construct (TagHeaderFormatter $ inner , $ maxHeaderValueLength = 4096 )
46
46
{
@@ -56,7 +56,6 @@ public function getTagsHeaderName()
56
56
$ this ->inner ->getTagsHeaderName ();
57
57
}
58
58
59
-
60
59
/**
61
60
* {@inheritdoc}
62
61
*/
@@ -67,7 +66,7 @@ public function getTagsHeaderValue(array $tags)
67
66
68
67
foreach ($ values as $ value ) {
69
68
if ($ this ->isHeaderTooLong ($ value )) {
70
- list ($ firstTags , $ secondTags ) = $ this ->splitTagsInHalves ($ tags );
69
+ list ($ firstTags , $ secondTags ) = $ this ->splitTagsInHalves ($ tags );
71
70
72
71
$ newValues [] = (array ) $ this ->getTagsHeaderValue ($ firstTags );
73
72
$ newValues [] = (array ) $ this ->getTagsHeaderValue ($ secondTags );
@@ -101,10 +100,11 @@ private function isHeaderTooLong($value)
101
100
* @param array $tags
102
101
*
103
102
* @return array
103
+ *
104
104
* @throws InvalidTagException
105
105
*/
106
- private function splitTagsInHalves (array $ tags ) {
107
-
106
+ private function splitTagsInHalves (array $ tags )
107
+ {
108
108
if (1 === count ($ tags )) {
109
109
throw new InvalidTagException (sprintf (
110
110
'You configured a maximum header length of %d but the tag "%s" is too long. ' ,
@@ -114,6 +114,7 @@ private function splitTagsInHalves(array $tags) {
114
114
}
115
115
116
116
$ size = ceil (count ($ tags ) / 2 );
117
+
117
118
return array_chunk ($ tags , $ size );
118
119
}
119
120
}
0 commit comments