コード例 #1
0
ファイル: Literal.php プロジェクト: skosm/LaraShop
 public function __construct($expression)
 {
     $expression = strtolower(trim($expression));
     if (IPv4::isValid($expression)) {
         $ip = new IPv4($expression);
     } elseif (IPv6::isValid($expression)) {
         $ip = new IPv6($expression);
     } else {
         throw new InvalidExpressionException('Expression must be either a valid IPv4 or IPv6 address.');
     }
     $this->expression = $ip->getCompact();
 }
コード例 #2
0
ファイル: IPv6Test.php プロジェクト: skosm/LaraShop
 public function testGetCompact()
 {
     $addr = new IPv6('0:0:0:0:0:0:0:1');
     $this->assertSame('::1', $addr->getCompact());
 }