Skip to content

Commit fbd7dc6

Browse files
author
Mathias Bauer
committed
more elegant notation for Domain->stripPort() - thx @lucasmichot
1 parent d55f08c commit fbd7dc6

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/Http/Validation/Domain.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
class Domain implements Validator
99
{
10+
1011
const PATTERN_STRIP_PROTOCOL = '/:\d*$/';
1112

1213
/**
@@ -65,13 +66,11 @@ protected function stripProtocol($domain)
6566
*/
6667
protected function stripPort($domain)
6768
{
68-
$domainStripped = preg_replace(self::PATTERN_STRIP_PROTOCOL, '', $domain);
69-
70-
if ($domainStripped === null) {
71-
return $domain;
69+
if ($domainStripped = preg_replace(self::PATTERN_STRIP_PROTOCOL, null, $domain)) {
70+
return $domainStripped;
7271
}
7372

74-
return $domainStripped;
73+
return $domain;
7574
}
7675

7776
/**

0 commit comments

Comments
 (0)