Skip to content

Commit e3a8161

Browse files
committed
Adding registrableDomain alias to avoid BC Break
1 parent c575d0d commit e3a8161

File tree

4 files changed

+31
-2
lines changed

4 files changed

+31
-2
lines changed

src/Pdp/Parser.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,18 @@ public function getRegistrableDomain($host)
263263
return implode('.', array_reverse($registrableDomainParts));
264264
}
265265

266+
/**
267+
* @see Parser::getRegistrableDomain
268+
*
269+
* @param string $host host
270+
*
271+
* @return string|null registrable domain
272+
*/
273+
public function getRegisterableDomain($host)
274+
{
275+
return $this->getRegistrableDomain($host);
276+
}
277+
266278
/**
267279
* Returns the subdomain portion of provided host.
268280
*

src/Pdp/Uri/Url/Host.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,16 @@ public function getRegistrableDomain()
6969
return $this->registrableDomain;
7070
}
7171

72+
/**
73+
* @see Host::getRegistrableDomain
74+
*
75+
* @return string
76+
*/
77+
public function getRegisterableDomain()
78+
{
79+
return $this->getRegistrableDomain();
80+
}
81+
7282
/**
7383
* Get Public suffix.
7484
*
@@ -116,9 +126,12 @@ public function __toString()
116126
*/
117127
public function toArray()
118128
{
129+
$registrableDomain = $this->getRegistrableDomain();
130+
119131
return array(
120132
'subdomain' => $this->getSubdomain(),
121-
'registrableDomain' => $this->getRegistrableDomain(),
133+
'registrableDomain' => $registrableDomain,
134+
'registerableDomain' => $registrableDomain,
122135
'publicSuffix' => $this->getPublicSuffix(),
123136
'host' => $this->getHost(),
124137
);

tests/src/Pdp/ParserTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ public function testGetPublicSuffixHandlesWrongCaseProperly()
150150
/**
151151
* @covers Pdp\Parser::parseUrl()
152152
* @covers Pdp\Parser::getRegistrableDomain()
153+
* @covers Pdp\Parser::getRegisterableDomain()
153154
* @dataProvider parseDataProvider
154155
*
155156
* @param $url
@@ -162,7 +163,9 @@ public function testGetRegistrableDomain($url, $publicSuffix, $registrableDomain
162163
{
163164
$pdpUrl = $this->parser->parseUrl($url);
164165
$this->assertSame($registrableDomain, $pdpUrl->getHost()->getRegistrableDomain());
165-
$this->assertSame($registrableDomain, $this->parser->getRegistrableDomain($hostPart));
166+
$this->assertSame($registrableDomain, $this->parser->getRegisterableDomain($hostPart));
167+
$this->assertSame($registrableDomain, $pdpUrl->getHost()->getRegistrableDomain());
168+
$this->assertSame($registrableDomain, $this->parser->getRegisterableDomain($hostPart));
166169
}
167170

168171
/**

tests/src/Pdp/Uri/Url/HostTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public function testToArray($publicSuffix, $registrableDomain, $subdomain, $host
4848
$parts = array(
4949
'subdomain' => $subdomain,
5050
'registrableDomain' => $registrableDomain,
51+
'registerableDomain' => $registrableDomain,
5152
'publicSuffix' => $publicSuffix,
5253
'host' => $hostPart,
5354
);

0 commit comments

Comments
 (0)