Skip to content

Commit bec93f3

Browse files
committed
CS
1 parent f016240 commit bec93f3

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/TagHeaderFormatter/MaxHeaderValueLengthFormatter.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* A header formatter that splits the value(s) from a given
1818
* other header formatter (e.g. the CommaSeparatedTagHeaderFormatter)
1919
* into multiple headers making sure none of the header values
20-
* exceeds the configured limit
20+
* exceeds the configured limit.
2121
*
2222
* @author Yanick Witschi <[email protected]>
2323
*/
@@ -40,7 +40,7 @@ class MaxHeaderValueLengthFormatter implements TagHeaderFormatter
4040
* use up just one byte.
4141
*
4242
* @param TagHeaderFormatter $inner
43-
* @param int $maxHeaderValueLength
43+
* @param int $maxHeaderValueLength
4444
*/
4545
public function __construct(TagHeaderFormatter $inner, $maxHeaderValueLength = 4096)
4646
{
@@ -56,7 +56,6 @@ public function getTagsHeaderName()
5656
$this->inner->getTagsHeaderName();
5757
}
5858

59-
6059
/**
6160
* {@inheritdoc}
6261
*/
@@ -67,7 +66,7 @@ public function getTagsHeaderValue(array $tags)
6766

6867
foreach ($values as $value) {
6968
if ($this->isHeaderTooLong($value)) {
70-
list ($firstTags, $secondTags) = $this->splitTagsInHalves($tags);
69+
list($firstTags, $secondTags) = $this->splitTagsInHalves($tags);
7170

7271
$newValues[] = (array) $this->getTagsHeaderValue($firstTags);
7372
$newValues[] = (array) $this->getTagsHeaderValue($secondTags);
@@ -101,10 +100,11 @@ private function isHeaderTooLong($value)
101100
* @param array $tags
102101
*
103102
* @return array
103+
*
104104
* @throws InvalidTagException
105105
*/
106-
private function splitTagsInHalves(array $tags) {
107-
106+
private function splitTagsInHalves(array $tags)
107+
{
108108
if (1 === count($tags)) {
109109
throw new InvalidTagException(sprintf(
110110
'You configured a maximum header length of %d but the tag "%s" is too long.',
@@ -114,6 +114,7 @@ private function splitTagsInHalves(array $tags) {
114114
}
115115

116116
$size = ceil(count($tags) / 2);
117+
117118
return array_chunk($tags, $size);
118119
}
119120
}

tests/Unit/TagHeaderFormatter/MaxHeaderValueLengthFormatterTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace FOS\HttpCache\Tests\Unit\TagHeaderFormatter;
1313

14-
1514
use FOS\HttpCache\Exception\InvalidTagException;
1615
use FOS\HttpCache\TagHeaderFormatter\CommaSeparatedTagHeaderFormatter;
1716
use FOS\HttpCache\TagHeaderFormatter\MaxHeaderValueLengthFormatter;
@@ -29,7 +28,8 @@ public function testNotTooLong()
2928

3029
/**
3130
* @dataProvider tooLongProvider
32-
* @param int $maxLength
31+
*
32+
* @param int $maxLength
3333
* @param array $tags
3434
* @param mixed $expectedHeaderValue
3535
*/

0 commit comments

Comments
 (0)