Predis\Connection\StreamConnection::connect PHP Method

connect() public method

public connect ( )
    public function connect()
    {
        if (parent::connect() && $this->initCommands) {
            foreach ($this->initCommands as $command) {
                $response = $this->executeCommand($command);
                if ($response instanceof ErrorResponseInterface) {
                    $this->onConnectionError("`{$command->getId()}` failed: {$response}", 0);
                }
            }
        }
    }

Usage Example

Example #1
0
 /**
  * @group connected
  */
 public function testAcceptsTcpNodelayParameter()
 {
     if (!version_compare(PHP_VERSION, '5.4.0', '>=')) {
         $this->markTestSkipped('Setting TCP_NODELAY on PHP socket streams works on PHP >= 5.4.0');
     }
     $connection = new StreamConnection($this->getParameters(array('tcp_nodelay' => false)));
     $connection->connect();
     $this->assertTrue($connection->isConnected());
     $connection = new StreamConnection($this->getParameters(array('tcp_nodelay' => true)));
     $connection->connect();
     $this->assertTrue($connection->isConnected());
 }
All Usage Examples Of Predis\Connection\StreamConnection::connect