diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2015-10-18 09:31:31 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2015-10-18 09:31:31 +0200 |
commit | 80f7dc77d430774192b929d780f96260066df2ee (patch) | |
tree | 102eaae7fc9ec567f2af76e96da3de2d1e83afcf /vendor/ruflin/elastica/lib/Elastica/Aggregation/AbstractAggregation.php | |
parent | cccd7bb4d819334c07e0dadaf16cbfdef31880e1 (diff) |
Update to MediaWiki 1.25.3
Diffstat (limited to 'vendor/ruflin/elastica/lib/Elastica/Aggregation/AbstractAggregation.php')
-rw-r--r-- | vendor/ruflin/elastica/lib/Elastica/Aggregation/AbstractAggregation.php | 88 |
1 files changed, 0 insertions, 88 deletions
diff --git a/vendor/ruflin/elastica/lib/Elastica/Aggregation/AbstractAggregation.php b/vendor/ruflin/elastica/lib/Elastica/Aggregation/AbstractAggregation.php deleted file mode 100644 index 5ad5b17e..00000000 --- a/vendor/ruflin/elastica/lib/Elastica/Aggregation/AbstractAggregation.php +++ /dev/null @@ -1,88 +0,0 @@ -<?php - -namespace Elastica\Aggregation; - -use Elastica\Param; -use Elastica\Exception\InvalidException; - -abstract class AbstractAggregation extends Param -{ - /** - * The name of this aggregation - * @var string - */ - protected $_name; - - /** - * Subaggregations belonging to this aggregation - * @var array - */ - protected $_aggs = array(); - - /** - * @param string $name the name of this aggregation - */ - public function __construct($name) - { - $this->setName($name); - } - - /** - * Set the name of this aggregation - * @param string $name - */ - public function setName($name) - { - $this->_name = $name; - } - - /** - * Retrieve the name of this aggregation - * @return string - */ - public function getName() - { - return $this->_name; - } - - /** - * Retrieve all subaggregations belonging to this aggregation - * @return array - */ - public function getAggs() - { - return $this->_aggs; - } - - /** - * Add a sub-aggregation - * @param AbstractAggregation $aggregation - * @throws \Elastica\Exception\InvalidException - * @return AbstractAggregation - */ - public function addAggregation(AbstractAggregation $aggregation) - { - if(is_a($aggregation, 'Elastica\Aggregation\GlobalAggregation')) { - throw new InvalidException('Global aggregators can only be placed as top level aggregators'); - } - - $this->_aggs[$aggregation->getName()] = $aggregation->toArray(); - return $this; - } - - /** - * @return array - */ - public function toArray() - { - $array = parent::toArray(); - if (array_key_exists('global_aggregation', $array)) { - // compensate for class name GlobalAggregation - $array = array('global' => new \stdClass); - } - if (sizeof($this->_aggs)) { - $array['aggs'] = $this->_aggs; - } - return $array; - } -}
\ No newline at end of file |