jadell/Neo4jPHP — Issue #14: Checking if server is online
Author: aliaskori
Created: 2011-10-09 16:36:07+00:00
State: open

I think it would be good if it is able to check if the server is up before creating the client.. I did some modifications on my own..

Placed in transport

/**
*Check if server is online
*/
public function isOnline()
{
$holder = $this->makeRequest(self::GET, $this->path);
return $holder['code'];
}

Placed in Client

public function __construct(Transport $transport)
{
if($transport->isOnline())
$this->setTransport($transport);
else
exit("Neo4j server is offline");
}

this would ensure that the server is online before allowing anything else to take place, unfortunately its now relying on the error code 0 or 404. i am not very sure of the rest interface to get a proper one. Perhaps u could tell me O o