setEnabled() public method

Enables a connection.
public setEnabled ( boolean $enabled = true )
$enabled boolean OPTIONAL (default = true)
Example #1
0
 /**
  * @group unit
  */
 public function testEnabledDisable()
 {
     $connection = new Connection();
     $this->assertTrue($connection->isEnabled());
     $connection->setEnabled(false);
     $this->assertFalse($connection->isEnabled());
     $connection->setEnabled(true);
     $this->assertTrue($connection->isEnabled());
 }
Example #2
0
 /**
  * @param \Elastica\Connection $connection
  * @param \Exception $e
  * @param Client $client
  */
 public function onFail(Connection $connection, Exception $e, Client $client)
 {
     $connection->setEnabled(false);
     if ($this->_callback) {
         call_user_func($this->_callback, $connection, $e, $client);
     }
 }