Skip to content

Commit 1202939

Browse files
committed
improve code
1 parent 014168b commit 1202939

File tree

4 files changed

+6
-22
lines changed

4 files changed

+6
-22
lines changed

src/Domain.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,6 @@ public function getDomain()
181181
*
182182
* This method should return null if the registrable domain is the same as the public suffix.
183183
*
184-
* @see https://publicsuffix.org/list/
185-
* @see https://raw.githubusercontent.com/publicsuffix/list/master/tests/test_psl.txt
186-
*
187184
* @return string|null registrable domain
188185
*/
189186
public function getRegistrableDomain()
@@ -219,8 +216,6 @@ public function getPublicSuffix()
219216
/**
220217
* Tells whether the public suffix has a matching rule in a Public Suffix List.
221218
*
222-
* @see https://publicsuffix.org/learn/
223-
*
224219
* @return bool
225220
*/
226221
public function isKnown(): bool
@@ -231,8 +226,6 @@ public function isKnown(): bool
231226
/**
232227
* Tells whether the public suffix has a matching rule in a Public Suffix List ICANN Section.
233228
*
234-
* @see https://publicsuffix.org/learn/
235-
*
236229
* @return bool
237230
*/
238231
public function isICANN(): bool
@@ -243,8 +236,6 @@ public function isICANN(): bool
243236
/**
244237
* Tells whether the public suffix has a matching rule in a Public Suffix List Private Section.
245238
*
246-
* @see https://publicsuffix.org/learn/
247-
*
248239
* @return bool
249240
*/
250241
public function isPrivate(): bool

src/Manager.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ public function refreshRules(string $source_url = self::PSL_URL): bool
104104
return false;
105105
}
106106

107-
return $this->cache->set($this->getCacheKey($source_url), json_encode($rules));
107+
$cacheKey = $this->getCacheKey($source_url);
108+
109+
return $this->cache->set($cacheKey, json_encode($rules));
108110
}
109111
}

src/PublicSuffix.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@
2424
* it for this purpose, please do not bake static copies of the PSL into your
2525
* software with no update mechanism."
2626
*
27-
* @author Ignace Nyamagana Butera <[email protected]>
28-
*
29-
* @internal
27+
* @author Ignace Nyamagana Butera <[email protected]>
28+
* @internal used internally to represent a public suffix
3029
*/
3130
final class PublicSuffix implements Countable
3231
{
@@ -77,8 +76,6 @@ public function count()
7776
/**
7877
* Tells whether the public suffix has a matching rule in a Public Suffix List.
7978
*
80-
* @see https://publicsuffix.org/learn/
81-
*
8279
* @return bool
8380
*/
8481
public function isKnown(): bool
@@ -89,8 +86,6 @@ public function isKnown(): bool
8986
/**
9087
* Tells whether the public suffix has a matching rule in a Public Suffix List ICANN Section.
9188
*
92-
* @see https://publicsuffix.org/learn/
93-
*
9489
* @return bool
9590
*/
9691
public function isICANN(): bool
@@ -101,8 +96,6 @@ public function isICANN(): bool
10196
/**
10297
* Tells whether the public suffix has a matching rule in a Public Suffix List Private Section.
10398
*
104-
* @see https://publicsuffix.org/learn/
105-
*
10699
* @return bool
107100
*/
108101
public function isPrivate(): bool

src/Rules.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ private function isMatchable($domain): bool
8686
*
8787
* "The domain must be canonicalized in the normal way for hostnames - lower-case, Punycode."
8888
*
89-
* @see http://www.ietf.org/rfc/rfc3492.txt
89+
* @see https://tools.ietf.org/html/rfc3492
9090
*
9191
* @param string $domain
9292
*
@@ -118,7 +118,6 @@ private function findPublicSuffix(string $type, string $domain): PublicSuffix
118118
{
119119
$normalizedDomain = $this->normalize($domain);
120120
$reverseLabels = array_reverse(explode('.', $normalizedDomain));
121-
122121
$resultIcann = $this->findPublicSuffixFromSection(self::ICANN_DOMAINS, $reverseLabels);
123122
if (self::ICANN_DOMAINS === $type) {
124123
return $resultIcann;
@@ -193,7 +192,6 @@ private function handleNoMatches(string $domain): PublicSuffix
193192
{
194193
$labels = explode('.', $domain);
195194
$publicSuffix = array_pop($labels);
196-
197195
if ($this->isPunycoded($domain)) {
198196
return new PublicSuffix($publicSuffix);
199197
}

0 commit comments

Comments
 (0)