The $transport parameter can be one of the following values:
* string: The short name of a transport. For instance "Http"
* object: An already instantiated instance of a transport
* array: An array with a "type" key which must be set to one of the two options. All other
keys in the array will be set as parameters in the transport instance
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')); }
/** * 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); }