Page MenuHomeDevCentral

D1625.diff
No OneTemporary

D1625.diff

diff --git a/src/HTTP/Requests/RemoteAddress.php b/src/HTTP/Requests/RemoteAddress.php
--- a/src/HTTP/Requests/RemoteAddress.php
+++ b/src/HTTP/Requests/RemoteAddress.php
@@ -30,7 +30,7 @@
return $this->remoteAddress !== "";
}
- public function getOne () : string {
+ public function getClientAddress () : string {
if (strpos($this->remoteAddress, ',') === false) {
// We only have one value, it's the IP
return $this->remoteAddress;
diff --git a/src/HTTP/Requests/WithRemoteAddress.php b/src/HTTP/Requests/WithRemoteAddress.php
--- a/src/HTTP/Requests/WithRemoteAddress.php
+++ b/src/HTTP/Requests/WithRemoteAddress.php
@@ -19,7 +19,7 @@
* @return string the remote address
*/
public static function getRemoteAddress () : string {
- return RemoteAddress::fromServer()->getOne();
+ return RemoteAddress::fromServer()->getClientAddress();
}
}
diff --git a/tests/HTTP/Requests/RemoteAddressTest.php b/tests/HTTP/Requests/RemoteAddressTest.php
--- a/tests/HTTP/Requests/RemoteAddressTest.php
+++ b/tests/HTTP/Requests/RemoteAddressTest.php
@@ -13,30 +13,30 @@
///
/**
- * @covers \Keruald\OmniTools\HTTP\Requests\RemoteAddress::getOne
+ * @covers \Keruald\OmniTools\HTTP\Requests\RemoteAddress::getClientAddress
* @covers \Keruald\OmniTools\HTTP\Requests\RemoteAddress::getAll
* @covers \Keruald\OmniTools\HTTP\Requests\RemoteAddress::has
*/
public function testEmptyRequest () : void {
$address = new RemoteAddress;
- $this->assertEmpty($address->getOne());
+ $this->assertEmpty($address->getClientAddress());
$this->assertEmpty($address->getAll());
$this->assertFalse($address->has());
}
/**
- * @covers \Keruald\OmniTools\HTTP\Requests\RemoteAddress::getOne
+ * @covers \Keruald\OmniTools\HTTP\Requests\RemoteAddress::getClientAddress
* @dataProvider provideTenZeroZeroThreeHeaderValues
*/
public function testGetOne (string $value) : void {
$address = new RemoteAddress($value);
- $this->assertEquals('10.0.0.3', $address->getOne());
+ $this->assertEquals('10.0.0.3', $address->getClientAddress());
}
/**
- * @covers \Keruald\OmniTools\HTTP\Requests\RemoteAddress::getOne
+ * @covers \Keruald\OmniTools\HTTP\Requests\RemoteAddress::getClientAddress
* @dataProvider provideTenZeroZeroThreeHeaderValues
*/
public function testGetAll (string $value) : void {

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 24, 15:03 (4 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2260435
Default Alt Text
D1625.diff (2 KB)

Event Timeline