Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

Commit c18aca6

Browse files
committed
Update two more headers to return string value: Accept-Range and Age
1 parent a72b62a commit c18aca6

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

src/Header/AcceptRanges.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,12 @@ public static function fromString($headerLine)
2727
);
2828
}
2929

30-
$header = new static($value);
31-
32-
return $header;
30+
return new static($value);
3331
}
3432

3533
public function __construct($rangeUnit = null)
3634
{
37-
if ($rangeUnit) {
35+
if ($rangeUnit !== null) {
3836
$this->setRangeUnit($rangeUnit);
3937
}
4038
}
@@ -58,7 +56,7 @@ public function setRangeUnit($rangeUnit)
5856

5957
public function getRangeUnit()
6058
{
61-
return $this->rangeUnit;
59+
return (string) $this->rangeUnit;
6260
}
6361

6462
public function toString()

src/Header/Age.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,12 @@ public static function fromString($headerLine)
3737
throw new Exception\InvalidArgumentException('Invalid header line for Age string: "' . $name . '"');
3838
}
3939

40-
$header = new static($value);
41-
42-
return $header;
40+
return new static($value);
4341
}
4442

4543
public function __construct($deltaSeconds = null)
4644
{
47-
if ($deltaSeconds) {
45+
if ($deltaSeconds !== null) {
4846
$this->setDeltaSeconds($deltaSeconds);
4947
}
5048
}
@@ -62,11 +60,11 @@ public function getFieldName()
6260
/**
6361
* Get header value (number of seconds)
6462
*
65-
* @return int
63+
* @return string
6664
*/
6765
public function getFieldValue()
6866
{
69-
return $this->getDeltaSeconds();
67+
return (string) $this->getDeltaSeconds();
7068
}
7169

7270
/**

test/HeaderTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class HeaderTest extends TestCase
1616
public function header()
1717
{
1818
// @codingStandardsIgnoreStart
19+
yield Header\AcceptRanges::class => [Header\AcceptRanges::class, 'Accept-Ranges'];
1920
yield Header\AuthenticationInfo::class => [Header\AuthenticationInfo::class, 'Authentication-Info'];
2021
yield Header\Authorization::class => [Header\Authorization::class, 'Authorization'];
2122
yield Header\ContentDisposition::class => [Header\ContentDisposition::class, 'Content-Disposition'];

0 commit comments

Comments
 (0)