for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the ONGR package.
*
* (c) NFQ Technologies UAB <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace ONGR\ElasticsearchDSL\Suggest;
use ONGR\ElasticsearchDSL\BuilderInterface;
use ONGR\ElasticsearchDSL\ParametersTrait;
use Symfony\Component\Serializer\Exception\InvalidArgumentException;
class Suggest implements BuilderInterface
{
use ParametersTrait;
/**
* @var string
private $name;
private $type;
private $text;
private $field;
* TermSuggest constructor.
* @param string $name
* @param string $type
* @param string $text
* @param string $field
* @param array $parameters
public function __construct($name, $type, $text, $field, $parameters = [])
$this->setName($name);
$this->setType($type);
$this->setText($text);
$this->setField($field);
$this->setParameters($parameters);
}
public function setName($name)
$this->name = $name;
* Returns suggest name
* @return string
public function getName()
return $this->name;
* Returns element type.
public function getType()
return $this->type;
public function setType($type)
$this->type = $type;
public function getText()
return $this->text;
public function setText($text)
$this->text = $text;
public function getField()
return $this->field;
public function setField($field)
$this->field = $field;
* {@inheritdoc}
public function toArray()
$output = [
$this->getName() => [
'text' => $this->getText(),
$this->getType() => $this->processArray(['field' => $this->getField()]),
]
];
return $output;