Elastica\Type\AbstractType::__construct PHP Метод

__construct() публичный Метод

Reads index and type name from protected vars _indexName and _typeName. Has to be set in child class
public __construct ( Client $client = null )
$client Elastica\Client OPTIONAL Client object
    public function __construct(Client $client = null)
    {
        if (!$client) {
            $client = new Client();
        }
        if (empty($this->_indexName)) {
            throw new InvalidException('Index name has to be set');
        }
        if (empty($this->_typeName)) {
            throw new InvalidException('Type name has to be set');
        }
        $this->_client = $client;
        $this->_index = new Index($this->_client, $this->_indexName);
        $this->_type = new BaseType($this->_index, $this->_typeName);
    }