• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

bonu-dev / php-elasticsearch-builder / 19804946792

30 Nov 2025 09:13PM UTC coverage: 98.649%. First build
19804946792

Pull #1

github

web-flow
Merge 103404a58 into cff11ae97
Pull Request #1: TBA

219 of 222 new or added lines in 12 files covered. (98.65%)

219 of 222 relevant lines covered (98.65%)

4.06 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

85.71
/src/Aggregation/GlobalizableAggregation.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Bonu\ElasticsearchBuilder\Aggregation;
6

7
/**
8
 * @see https://www.elastic.co/docs/reference/aggregations/search-aggregations-bucket-global-aggregation
9
 */
10
trait GlobalizableAggregation
11
{
12
    /**
13
     * @var bool
14
     */
15
    protected bool $global = false;
16

17
    /**
18
     * @return $this
19
     */
20
    public function asGlobal(): static
4✔
21
    {
22
        $this->global = true;
4✔
23
        return $this;
4✔
24
    }
25

26
    /**
27
     * @return bool
28
     */
NEW
29
    public function isGlobal(): bool
×
30
    {
NEW
31
        return $this->global;
×
32
    }
33

34
    /**
35
     * @param array<string, mixed> $aggregation
36
     * @param string|\Stringable $name
37
     *
38
     * @return array<string, mixed>
39
     */
40
    protected function addGlobalToAggregation(array $aggregation, string | \Stringable $name): array
8✔
41
    {
42
        if ($this->global === false) {
8✔
43
            return $aggregation;
4✔
44
        }
45

46
        return [
4✔
47
            'global' => (object) [],
4✔
48
            'aggs' => [
4✔
49
                (string) $name => $aggregation,
4✔
50
            ],
4✔
51
        ];
4✔
52
    }
53
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc