getValidIpAddress() public method

Returns the valid IP address or false if no valid IP address was found.
public getValidIpAddress ( mixed $source = null ) : string | false
$source mixed (optional) The source data. If omitted, the class will use the value passed to Whip::setSource or fallback to $_SERVER.
return string | false Returns the IP address (as a string) of the client or false if no valid IP address was found.
Esempio n. 1
0
 /**
  * Tests a valid IPv6 address.
  */
 public function testValidIPv6Address()
 {
     $_SERVER = array('REMOTE_ADDR' => '::1');
     $lookup = new Whip(Whip::REMOTE_ADDR);
     $this->assertEquals('::1', $lookup->getValidIpAddress());
 }
Esempio n. 2
0
 protected function isGranted(MvcEvent $event)
 {
     return false !== $this->whip->getValidIpAddress();
 }