88
99namespace PHPViet \Validation \Rules ;
1010
11- use IPLib \Address \AddressInterface as IpInterface ;
12- use IPLib \Address \Type as IpType ;
1311use IPLib \Factory as IpFactory ;
14- use Respect \ Validation \ Exceptions \ ComponentException ;
12+ use IPLib \ Address \ Type as IpType ;
1513use Respect \Validation \Rules \AbstractRule ;
14+ use IPLib \Address \AddressInterface as IpInterface ;
15+ use Respect \Validation \Exceptions \ComponentException ;
1616
1717/**
1818 * @author Vuong Minh <vuongxuongminh@gmail.com>
@@ -28,7 +28,7 @@ class IpVN extends AbstractRule
2828
2929 public function __construct (?int $ version = null )
3030 {
31- if (null !== $ version && !$ this ->isSupportedVersion ($ version )) {
31+ if (null !== $ version && ! $ this ->isSupportedVersion ($ version )) {
3232 throw new ComponentException (sprintf ('Only versions %d, %d are supported: %d given ' , self ::IPV4 , self ::IPV6 , $ version ));
3333 }
3434
@@ -37,15 +37,15 @@ public function __construct(?int $version = null)
3737
3838 public function validate ($ input ): bool
3939 {
40- if (!$ ip = IpFactory::addressFromString ($ input )) {
40+ if (! $ ip = IpFactory::addressFromString ($ input )) {
4141 return false ;
4242 }
4343
4444 if (($ version = $ ip ->getAddressType ()) !== $ this ->version && null !== $ this ->version ) {
4545 return false ;
4646 }
4747
48- if (!$ ranges = $ this ->getIpRanges ($ input , $ version )) {
48+ if (! $ ranges = $ this ->getIpRanges ($ input , $ version )) {
4949 return false ;
5050 }
5151
@@ -62,7 +62,7 @@ protected function getIpRanges(string $ip, int $version): ?array
6262 $ map = static ::getIpV6Range ();
6363 }
6464
65- while (!is_null ($ key = array_shift ($ keys ))) {
65+ while (! is_null ($ key = array_shift ($ keys ))) {
6666 if (isset ($ map [$ key ])) {
6767 $ map = $ map [$ key ];
6868
@@ -93,7 +93,7 @@ protected static function getIpV4Range(): array
9393 static $ range = null ;
9494
9595 if (null === $ range ) {
96- $ range = require __DIR__ . '/../../resources/ip-v4-range.php ' ;
96+ $ range = require __DIR__ . '/../../resources/ip-v4-range.php ' ;
9797 }
9898
9999 return $ range ;
@@ -104,7 +104,7 @@ protected static function getIpV6Range(): array
104104 static $ range = null ;
105105
106106 if (null === $ range ) {
107- $ range = require __DIR__ . '/../../resources/ip-v6-range.php ' ;
107+ $ range = require __DIR__ . '/../../resources/ip-v6-range.php ' ;
108108 }
109109
110110 return $ range ;
0 commit comments