Esempio n. 1
0
 /**
  * Check if the IP is contained in given block.
  *
  * @param $block mixed Anything that can be converted into an IPBlock
  * @return bool
  */
 public function isIn($block)
 {
     if (!$block instanceof IPBlock) {
         $block = IPBlock::create($block);
     }
     return $block->contains($this);
 }
Esempio n. 2
0
 public function testGetSuper()
 {
     $block = IPBlock::create('192.168.42.0/24');
     $this->assertEquals('192.168.0.0/16', (string) $block->getSuper('/16'));
     try {
         $block->getSuper('');
         $this->fail('Expected InvalidArgumentException has not be thrown');
     } catch (InvalidArgumentException $e) {
     }
     try {
         $block->getSuper('/32');
         $this->fail('Expected InvalidArgumentException has not be thrown');
     } catch (InvalidArgumentException $e) {
     }
 }