@@ -10,14 +10,14 @@ abstract class IpAddressNormalizer
1010
1111 final public static function normalizeIpV6 (string $ address ): string
1212 {
13- if (\strpos ($ address , ':: ' ) !== false ) {
13+ if (\str_contains ($ address , ':: ' )) {
1414 $ part = \explode (':: ' , $ address );
1515 $ part [0 ] = \explode (': ' , $ part [0 ]);
1616 $ part [1 ] = \explode (': ' , $ part [1 ]);
1717 $ missing = [];
1818
1919 for ($ i = 0 ; $ i < 8 - (\count ($ part [0 ]) + \count ($ part [1 ])); $ i ++) {
20- \array_push ( $ missing, '0000 ' ) ;
20+ $ missing[] = '0000 ' ;
2121 }
2222
2323 $ missing = \array_merge ($ part [0 ], $ missing );
@@ -45,15 +45,15 @@ final public static function normalizeIpV6(string $address): string
4545
4646 final public static function compressIpV6 (string $ ip ): string
4747 {
48- if (\substr ($ ip , 0 , 4 ) === '0000 ' ) {
48+ if (\str_starts_with ($ ip , '0000 ' ) ) {
4949 $ ip = \substr_replace ($ ip , ':0 ' , 0 , 4 );
5050 }
5151
5252 $ ip = \str_replace (':0000 ' , ':0 ' , $ ip );
5353 $ ip = \preg_replace ('/:0{1,3}(?=\w)/ ' , ': ' , $ ip );
5454 $ z = ':0:0:0:0:0:0:0: ' ;
5555
56- while (\strpos ($ ip , ':: ' ) === false && \strlen ($ z ) >= 5 ) {
56+ while (! \str_contains ($ ip , ':: ' ) && \strlen ($ z ) >= 5 ) {
5757 $ pos = \strpos ($ ip , $ z );
5858
5959 if ($ pos !== false ) {
0 commit comments