Author: Nicolas Ruflin (spam@ruflin.com)
Inheritance: extends Elastica\Param
Esempio n. 1
0
 /**
  * Construct transport
  *
  * @param \Elastica\Connection $connection Connection object
  * @throws \Elastica\Exception\RuntimeException
  */
 public function __construct(Connection $connection = null)
 {
     parent::__construct($connection);
     if (!class_exists('Elasticsearch\\RestClient')) {
         throw new RuntimeException('Elasticsearch\\RestClient class not found. Check that suggested package munkie/elasticsearch-thrift-php is required in composer.json');
     }
 }
 public function testCanInjectParamsWhenUsingArray()
 {
     $connection = new Connection();
     $params = array('param1' => 'some value', 'param3' => 'value3');
     $transport = AbstractTransport::create(array('type' => 'Http', 'param1' => 'value1', 'param2' => 'value2'), $connection, $params);
     $this->assertSame('value1', $transport->getParam('param1'));
     $this->assertSame('value2', $transport->getParam('param2'));
     $this->assertSame('value3', $transport->getParam('param3'));
 }
Esempio n. 3
0
 /**
  * Returns an instance of the transport type.
  *
  * @throws \Elastica\Exception\InvalidException If invalid transport type
  *
  * @return \Elastica\Transport\AbstractTransport Transport object
  */
 public function getTransportObject()
 {
     $transport = $this->getTransport();
     return AbstractTransport::create($transport, $this);
 }
Esempio n. 4
0
 /**
  * Construct transport.
  */
 public function __construct(Connection $connection = null, HttpAdapterInterface $httpAdapter)
 {
     parent::__construct($connection);
     $this->httpAdapter = $httpAdapter;
 }