diff options
author | Faraz Samapoor <f.samapoor@gmail.com> | 2023-06-26 15:20:56 +0330 |
---|---|---|
committer | Faraz Samapoor <fsa@adlas.at> | 2023-09-21 11:20:12 +0330 |
commit | 4f46656d397858265609b68ab2b51c1a2a7e7772 (patch) | |
tree | 138815f2a9acbceca801296ddecea184f105c90d /lib/private/Security/Normalizer | |
parent | d6445254ac8d54b746a45905cfba7ceade858d86 (diff) | |
download | nextcloud-server-4f46656d397858265609b68ab2b51c1a2a7e7772.tar.gz nextcloud-server-4f46656d397858265609b68ab2b51c1a2a7e7772.zip |
Refactors lib/private/Security.
Mainly using PHP8's constructor property promotion.
Signed-off-by: Faraz Samapoor <fsa@adlas.at>
Diffstat (limited to 'lib/private/Security/Normalizer')
-rw-r--r-- | lib/private/Security/Normalizer/IpAddress.php | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/lib/private/Security/Normalizer/IpAddress.php b/lib/private/Security/Normalizer/IpAddress.php index 98d85ce07a1..9aade6c3591 100644 --- a/lib/private/Security/Normalizer/IpAddress.php +++ b/lib/private/Security/Normalizer/IpAddress.php @@ -37,22 +37,16 @@ namespace OC\Security\Normalizer; * @package OC\Security\Normalizer */ class IpAddress { - /** @var string */ - private $ip; - /** * @param string $ip IP to normalized */ - public function __construct(string $ip) { - $this->ip = $ip; + public function __construct( + private string $ip, + ) { } /** * Return the given subnet for an IPv4 address and mask bits - * - * @param string $ip - * @param int $maskBits - * @return string */ private function getIPv4Subnet(string $ip, int $maskBits = 32): string { $binary = \inet_pton($ip); @@ -68,10 +62,6 @@ class IpAddress { /** * Return the given subnet for an IPv6 address and mask bits - * - * @param string $ip - * @param int $maskBits - * @return string */ private function getIPv6Subnet(string $ip, int $maskBits = 48): string { if ($ip[0] === '[' && $ip[-1] === ']') { // If IP is with brackets, for example [::1] @@ -126,8 +116,6 @@ class IpAddress { /** * Gets either the /32 (IPv4) or the /64 (IPv6) subnet of an IP address - * - * @return string */ public function getSubnet(): string { if (\preg_match('/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/', $this->ip)) { @@ -153,8 +141,6 @@ class IpAddress { /** * Returns the specified IP address - * - * @return string */ public function __toString(): string { return $this->ip; |