/** * Instantiates a new binding. * * @param BindingParameters $parameters * @param HttpClientAdapterInterface $adapter */ public function __construct(BindingParameters $parameters, HttpClientAdapterInterface $adapter = null) { $this->server = "{$parameters->getHost()}:{$parameters->getPort()}"; $this->database = $parameters->getDatabase(); $this->adapter = $adapter ?: new CurlClientAdapter(new CurlClient()); $this->setAuthentication($parameters->getUsername(), $parameters->getPassword()); }
public function testCustomParameters() { $parameters = new BindingParameters(TEST_ODB_HOST, TEST_ODB_HTTP_PORT, TEST_ODB_USER, TEST_ODB_PASSWORD, TEST_ODB_DATABASE); $this->assertSame(TEST_ODB_HOST, $parameters->getHost()); $this->assertSame(TEST_ODB_HTTP_PORT, $parameters->getPort()); $this->assertSame(TEST_ODB_USER, $parameters->getUsername()); $this->assertSame(TEST_ODB_PASSWORD, $parameters->getPassword()); $this->assertSame(TEST_ODB_DATABASE, $parameters->getDatabase()); }
public function __construct(BindingParameters $parameters) { $this->client = $client = new PhpOrient($parameters->getHost(), $parameters->getPort()); $this->clusterMap = $client->dbOpen($parameters->getDatabase(), $parameters->getUsername(), $parameters->getPassword()); }