File manager - Edit - /var/www/payraty/helpdesk/vendor/handcraftedinthealps/elasticsearch-dsl/src/Aggregation/Metric/PercentilesAggregation.php
Back
<?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\Aggregation\Metric; use ONGR\ElasticsearchDSL\Aggregation\AbstractAggregation; use ONGR\ElasticsearchDSL\Aggregation\Type\MetricTrait; use ONGR\ElasticsearchDSL\ScriptAwareTrait; /** * Class representing PercentilesAggregation. * * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-percentile-aggregation.html */ class PercentilesAggregation extends AbstractAggregation { use MetricTrait; use ScriptAwareTrait; /** * @var array */ private $percents; /** * @var int */ private $compression; /** * Inner aggregations container init. * * @param string $name * @param string|null $field * @param array|null $percents * @param string|null $script * @param int|null $compression */ public function __construct( string $name, string $field = null, array $percents = null, string $script = null, int $compression = null ) { parent::__construct($name); $this->setField($field); $this->setPercents($percents); $this->setScript($script); $this->setCompression($compression); } /** * @return array */ public function getPercents() { return $this->percents; } /** * @param array $percents * * @return $this */ public function setPercents($percents) { $this->percents = $percents; return $this; } /** * @return int */ public function getCompression() { return $this->compression; } /** * @param int $compression * * @return $this */ public function setCompression($compression) { $this->compression = $compression; return $this; } /** * {@inheritdoc} */ public function getType() { return 'percentiles'; } /** * {@inheritdoc} */ public function getArray() { $out = array_filter( [ 'compression' => $this->getCompression(), 'percents' => $this->getPercents(), 'field' => $this->getField(), 'script' => $this->getScript(), ], function ($val) { return ($val || is_numeric($val)); } ); $this->isRequiredParametersSet($out); return $out; } /** * @param array $a * * @throws \LogicException */ private function isRequiredParametersSet($a) { if (!array_key_exists('field', $a) && !array_key_exists('script', $a)) { throw new \LogicException('Percentiles aggregation must have field or script set.'); } } }
| ver. 1.4 |
Github
|
.
| PHP 8.3.30 | Generation time: 0 |
proxy
|
phpinfo
|
Settings