예제 #1
0
 public static function fromString($string)
 {
     $string = trim($string);
     try {
         return IPv4\Range::fromString($string);
     } catch (InvalidFormatException $e) {
     }
     try {
         return IPv4\Subnet::fromString($string);
     } catch (InvalidFormatException $e) {
     }
     try {
         return new IPv4\Address($string);
     } catch (InvalidFormatException $e) {
     }
     throw new InvalidFormatException("Unknown address format");
 }
예제 #2
0
 /**
  * @expectedException IPAddress\Exceptions\InvalidFormatException
  */
 public function testInvalidString()
 {
     IPv4Range::fromString("foo");
 }