setSource() public méthode

Sets the source data used to lookup the addresses.
public setSource ( $source ) : Whip
$source The source array.
Résultat Whip Returns $this.
Exemple #1
0
 /**
  * Tests that if we specify the source array through Whip::setSource, the
  * class will override any values found in $_SERVER.
  */
 public function testSetSourceArrayOverridesServerSuperglobal()
 {
     $source = array('REMOTE_ADDR' => '24.24.24.24');
     $lookup = new Whip(Whip::REMOTE_ADDR, array(), array('REMOTE_ADDR' => '127.0.0.1'));
     $this->assertNotEquals($source['REMOTE_ADDR'], $lookup->getIpAddress());
     $lookup->setSource($source);
     $this->assertEquals($source['REMOTE_ADDR'], $lookup->getIpAddress());
 }