Skip to content
Snippets Groups Projects
Commit c0ec9f99 authored by Simonas Šerlinskas's avatar Simonas Šerlinskas
Browse files

all endpoints have its own class, no need to separate

parent b448600b
No related branches found
No related tags found
No related merge requests found
<?php
/*
* This file is part of the ONGR package.
*
* (c) NFQ Technologies UAB <info@nfq.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace ONGR\ElasticsearchDSL\Filter;
use ONGR\ElasticsearchDSL\BuilderInterface;
/**
* Represents Elasticsearch "post_filter" filter.
*
* @link http://www.elastic.co/guide/en/elasticsearch/guide/current/_post_filter.html
*/
class PostFilter implements BuilderInterface
{
/**
* @var BuilderInterface
*/
private $filter;
/**
* Sets a filter.
*
* @param BuilderInterface $filter
*/
public function __construct(BuilderInterface $filter = null)
{
if ($this->filter !== null) {
$this->setFilter($filter);
}
}
/**
* Checks if bool filter is relevant.
*
* @return bool
*
* @deprecated Will be removed in 1.0. Use getFilter() method.
*/
public function isRelevant()
{
return isset($this->filter);
}
/**
* Returns filter.
*
* @return BuilderInterface
*/
public function getFilter()
{
return $this->filter;
}
/**
* Sets filter.
*
* @param BuilderInterface $filter
*/
public function setFilter(BuilderInterface $filter)
{
$this->filter = $filter;
}
/**
* {@inheritdoc}
*/
public function toArray()
{
return [$this->getFilter()->getType() => $this->getFilter()->toArray()];
}
/**
* {@inheritdoc}
*/
public function getType()
{
return 'post_filter';
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment