Passed
Pull Request — master (#46)
by Teye
16:01
created
examples/TimeBoundary.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
     // Enable this to see some more data
19 19
     $client->setLogger(new ConsoleLogger());
20 20
 
21
-    $response = $client->metadata()->timeBoundary('wikipedia', TimeBound::MAX_TIME, function(FilterBuilder $builder) {
21
+    $response = $client->metadata()->timeBoundary('wikipedia', TimeBound::MAX_TIME, function (FilterBuilder $builder) {
22 22
         $builder->where('channel', '!=', '#vi.wikipedia');
23 23
     });
24 24
 
Please login to merge, or discard this patch.
src/Queries/QueryBuilder.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      * @param string                     $dataSource
102 102
      * @param string|Granularity                     $granularity
103 103
      */
104
-    public function __construct(DruidClient $client, string $dataSource = '', string|Granularity $granularity = Granularity::ALL)
104
+    public function __construct(DruidClient $client, string $dataSource = '', string | Granularity $granularity = Granularity::ALL)
105 105
     {
106 106
         $this->client      = $client;
107 107
         $this->query       = $this;
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
      * @return $this
125 125
      * @see https://druid.apache.org/docs/latest/misc/math-expr.html
126 126
      */
127
-    public function selectVirtual(string $expression, string $as, string|DataType $outputType = DataType::STRING): self
127
+    public function selectVirtual(string $expression, string $as, string | DataType $outputType = DataType::STRING): self
128 128
     {
129 129
         $this->virtualColumn($expression, $as, $outputType);
130 130
         $this->select($as, $as, null, $outputType);
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
      * @throws \Level23\Druid\Exceptions\QueryResponseException
142 142
      * @throws \GuzzleHttp\Exception\GuzzleException
143 143
      */
144
-    public function execute(array|QueryContext $context = []): QueryResponse
144
+    public function execute(array | QueryContext $context = []): QueryResponse
145 145
     {
146 146
         $query = $this->getQuery($context);
147 147
 
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
      *
158 158
      * @return $this
159 159
      */
160
-    public function granularity(string|Granularity $granularity): QueryBuilder
160
+    public function granularity(string | Granularity $granularity): QueryBuilder
161 161
     {
162 162
         $this->granularity = is_string($granularity) ? Granularity::from(strtolower($granularity)) : $granularity;
163 163
 
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
      * @return string
249 249
      * @throws \InvalidArgumentException if the JSON cannot be encoded.
250 250
      */
251
-    public function toJson(array|QueryContext $context = []): string
251
+    public function toJson(array | QueryContext $context = []): string
252 252
     {
253 253
         $query = $this->getQuery($context);
254 254
 
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
      *
270 270
      * @return array<string,array<mixed>|string|int>
271 271
      */
272
-    public function toArray(array|QueryContext $context = []): array
272
+    public function toArray(array | QueryContext $context = []): array
273 273
     {
274 274
         return $this->getQuery($context)->toArray();
275 275
     }
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
      * @throws \Level23\Druid\Exceptions\QueryResponseException
284 284
      * @throws \GuzzleHttp\Exception\GuzzleException
285 285
      */
286
-    public function timeseries(array|TimeSeriesQueryContext $context = []): TimeSeriesQueryResponse
286
+    public function timeseries(array | TimeSeriesQueryContext $context = []): TimeSeriesQueryResponse
287 287
     {
288 288
         $query = $this->buildTimeSeriesQuery($context);
289 289
 
@@ -312,10 +312,10 @@  discard block
 block discarded – undo
312 312
      * @throws \GuzzleHttp\Exception\GuzzleException
313 313
      */
314 314
     public function scan(
315
-        array|ScanQueryContext $context = [],
315
+        array | ScanQueryContext $context = [],
316 316
         ?int $rowBatchSize = null,
317 317
         bool $legacy = false,
318
-        string|ScanQueryResultFormat $resultFormat = ScanQueryResultFormat::NORMAL_LIST
318
+        string | ScanQueryResultFormat $resultFormat = ScanQueryResultFormat::NORMAL_LIST
319 319
     ): ScanQueryResponse {
320 320
         $query = $this->buildScanQuery($context, $rowBatchSize, $legacy, $resultFormat);
321 321
 
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
      * @throws \Level23\Druid\Exceptions\QueryResponseException
334 334
      * @throws \GuzzleHttp\Exception\GuzzleException
335 335
      */
336
-    public function selectQuery(array|QueryContext $context = []): SelectQueryResponse
336
+    public function selectQuery(array | QueryContext $context = []): SelectQueryResponse
337 337
     {
338 338
         $query = $this->buildSelectQuery($context);
339 339
 
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
      * @throws \Level23\Druid\Exceptions\QueryResponseException
352 352
      * @throws \GuzzleHttp\Exception\GuzzleException
353 353
      */
354
-    public function topN(array|TopNQueryContext $context = []): TopNQueryResponse
354
+    public function topN(array | TopNQueryContext $context = []): TopNQueryResponse
355 355
     {
356 356
         $query = $this->buildTopNQuery($context);
357 357
 
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
      * @throws \Level23\Druid\Exceptions\QueryResponseException
370 370
      * @throws \GuzzleHttp\Exception\GuzzleException
371 371
      */
372
-    public function groupBy(array|GroupByV1QueryContext|GroupByV2QueryContext $context = []): GroupByQueryResponse
372
+    public function groupBy(array | GroupByV1QueryContext | GroupByV2QueryContext $context = []): GroupByQueryResponse
373 373
     {
374 374
         $query = $this->buildGroupByQuery($context);
375 375
 
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
      * @throws \Level23\Druid\Exceptions\QueryResponseException
388 388
      * @throws \GuzzleHttp\Exception\GuzzleException
389 389
      */
390
-    public function groupByV1(array|GroupByV1QueryContext|GroupByV2QueryContext $context = []): GroupByQueryResponse
390
+    public function groupByV1(array | GroupByV1QueryContext | GroupByV2QueryContext $context = []): GroupByQueryResponse
391 391
     {
392 392
         $query = $this->buildGroupByQuery($context, 'v1');
393 393
 
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
      * @throws \GuzzleHttp\Exception\GuzzleException
407 407
      * @throws \Level23\Druid\Exceptions\QueryResponseException
408 408
      */
409
-    public function search(array|QueryContext $context = [], string|SortingOrder $sortingOrder = SortingOrder::LEXICOGRAPHIC): SearchQueryResponse
409
+    public function search(array | QueryContext $context = [], string | SortingOrder $sortingOrder = SortingOrder::LEXICOGRAPHIC): SearchQueryResponse
410 410
     {
411 411
         $query = $this->buildSearchQuery($context, $sortingOrder);
412 412
 
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
      *
453 453
      * @return \Level23\Druid\Queries\SearchQuery
454 454
      */
455
-    protected function buildSearchQuery(array|QueryContext $context = [], string|SortingOrder $sortingOrder = SortingOrder::LEXICOGRAPHIC): SearchQuery
455
+    protected function buildSearchQuery(array | QueryContext $context = [], string | SortingOrder $sortingOrder = SortingOrder::LEXICOGRAPHIC): SearchQuery
456 456
     {
457 457
         if (count($this->intervals) == 0) {
458 458
             throw new InvalidArgumentException('You have to specify at least one interval');
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
      *
502 502
      * @return \Level23\Druid\Queries\SelectQuery
503 503
      */
504
-    protected function buildSelectQuery(array|QueryContext $context = []): SelectQuery
504
+    protected function buildSelectQuery(array | QueryContext $context = []): SelectQuery
505 505
     {
506 506
         if (count($this->intervals) == 0) {
507 507
             throw new InvalidArgumentException('You have to specify at least one interval');
@@ -553,10 +553,10 @@  discard block
 block discarded – undo
553 553
      * @return \Level23\Druid\Queries\ScanQuery
554 554
      */
555 555
     protected function buildScanQuery(
556
-        array|QueryContext $context = [],
556
+        array | QueryContext $context = [],
557 557
         ?int $rowBatchSize = null,
558 558
         bool $legacy = false,
559
-        string|ScanQueryResultFormat $resultFormat = ScanQueryResultFormat::NORMAL_LIST
559
+        string | ScanQueryResultFormat $resultFormat = ScanQueryResultFormat::NORMAL_LIST
560 560
     ): ScanQuery {
561 561
         if (count($this->intervals) == 0) {
562 562
             throw new InvalidArgumentException('You have to specify at least one interval');
@@ -634,7 +634,7 @@  discard block
 block discarded – undo
634 634
      *
635 635
      * @return TimeSeriesQuery
636 636
      */
637
-    protected function buildTimeSeriesQuery(array|QueryContext $context = []): TimeSeriesQuery
637
+    protected function buildTimeSeriesQuery(array | QueryContext $context = []): TimeSeriesQuery
638 638
     {
639 639
         if (count($this->intervals) == 0) {
640 640
             throw new InvalidArgumentException('You have to specify at least one interval');
@@ -702,7 +702,7 @@  discard block
 block discarded – undo
702 702
      *
703 703
      * @return TopNQuery
704 704
      */
705
-    protected function buildTopNQuery(array|QueryContext $context = []): TopNQuery
705
+    protected function buildTopNQuery(array | QueryContext $context = []): TopNQuery
706 706
     {
707 707
         if (count($this->intervals) == 0) {
708 708
             throw new InvalidArgumentException('You have to specify at least one interval');
@@ -775,7 +775,7 @@  discard block
 block discarded – undo
775 775
      *
776 776
      * @return GroupByQuery
777 777
      */
778
-    protected function buildGroupByQuery(array|QueryContext $context = [], string $type = 'v2'): GroupByQuery
778
+    protected function buildGroupByQuery(array | QueryContext $context = [], string $type = 'v2'): GroupByQuery
779 779
     {
780 780
         if (count($this->intervals) == 0) {
781 781
             throw new InvalidArgumentException('You have to specify at least one interval');
@@ -838,7 +838,7 @@  discard block
 block discarded – undo
838 838
      *
839 839
      * @return \Level23\Druid\Queries\QueryInterface
840 840
      */
841
-    public function getQuery(array|QueryContext $context = []): QueryInterface
841
+    public function getQuery(array | QueryContext $context = []): QueryInterface
842 842
     {
843 843
         // Check if this is a scan query. This is the preferred way to query when there are
844 844
         // no aggregations done.
Please login to merge, or discard this patch.
src/Queries/SelectQuery.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -142,7 +142,7 @@
 block discarded – undo
142 142
      *
143 143
      * @throws InvalidArgumentException
144 144
      */
145
-    public function setGranularity(string|Granularity $granularity): void
145
+    public function setGranularity(string | Granularity $granularity): void
146 146
     {
147 147
         $this->granularity = is_string($granularity) ? Granularity::from(strtolower($granularity)) : $granularity;
148 148
     }
Please login to merge, or discard this patch.
src/Queries/TopNQuery.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@
 block discarded – undo
56 56
         DimensionInterface $dimension,
57 57
         int $threshold,
58 58
         string $metric,
59
-        string|Granularity $granularity = Granularity::ALL
59
+        string | Granularity $granularity = Granularity::ALL
60 60
     ) {
61 61
         $this->dataSource  = $dataSource;
62 62
         $this->intervals   = $intervals;
Please login to merge, or discard this patch.
src/Queries/TimeSeriesQuery.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
     public function __construct(
56 56
         DataSourceInterface $dataSource,
57 57
         IntervalCollection $intervals,
58
-        string|Granularity $granularity = Granularity::ALL
58
+        string | Granularity $granularity = Granularity::ALL
59 59
     ) {
60 60
         $this->dataSource  = $dataSource;
61 61
         $this->intervals   = $intervals;
Please login to merge, or discard this patch.
src/Queries/ScanQuery.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
      *
151 151
      * @param string|ScanQueryResultFormat $resultFormat
152 152
      */
153
-    public function setResultFormat(string|ScanQueryResultFormat $resultFormat): void
153
+    public function setResultFormat(string | ScanQueryResultFormat $resultFormat): void
154 154
     {
155 155
         $this->resultFormat = is_string($resultFormat) ? ScanQueryResultFormat::from(strtolower($resultFormat)) : $resultFormat;
156 156
     }
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
      *
230 230
      * @param string|OrderByDirection $order
231 231
      */
232
-    public function setOrder(string|OrderByDirection $order): void
232
+    public function setOrder(string | OrderByDirection $order): void
233 233
     {
234 234
         $this->order = is_string($order) ? OrderByDirection::make($order) : $order;
235 235
     }
Please login to merge, or discard this patch.
src/Queries/GroupByQuery.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
         DataSourceInterface $dataSource,
62 62
         DimensionCollection $dimensions,
63 63
         IntervalCollection $intervals,
64
-        array|AggregationCollection $aggregations = null,
65
-        string|Granularity $granularity = 'all'
64
+        array | AggregationCollection $aggregations = null,
65
+        string | Granularity $granularity = 'all'
66 66
     ) {
67 67
         $this->dataSource  = $dataSource;
68 68
         $this->dimensions  = $dimensions;
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
     /**
136 136
      * @param \Level23\Druid\Collections\AggregationCollection|array<AggregatorInterface> $aggregations
137 137
      */
138
-    public function setAggregations(array|AggregationCollection $aggregations): void
138
+    public function setAggregations(array | AggregationCollection $aggregations): void
139 139
     {
140 140
         if (is_array($aggregations)) {
141 141
             $aggregations = new AggregationCollection(...$aggregations);
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
     /**
148 148
      * @param \Level23\Druid\Collections\PostAggregationCollection|array<PostAggregatorInterface> $postAggregations
149 149
      */
150
-    public function setPostAggregations(PostAggregationCollection|array $postAggregations): void
150
+    public function setPostAggregations(PostAggregationCollection | array $postAggregations): void
151 151
     {
152 152
         if (is_array($postAggregations)) {
153 153
             $postAggregations = new PostAggregationCollection(...$postAggregations);
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
     /**
176 176
      * @param \Level23\Druid\Limits\Limit|int $limit
177 177
      */
178
-    public function setLimit(Limit|int $limit): void
178
+    public function setLimit(Limit | int $limit): void
179 179
     {
180 180
         if ($limit instanceof LimitInterface) {
181 181
             $this->limit = $limit;
Please login to merge, or discard this patch.
src/Queries/SearchQuery.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 
40 40
     public function __construct(
41 41
         DataSourceInterface $dataSource,
42
-        string|Granularity $granularity,
42
+        string | Granularity $granularity,
43 43
         IntervalCollection $intervals,
44 44
         SearchFilterInterface $searchFilter
45 45
     ) {
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
     /**
124 124
      * @param string|SortingOrder $sort
125 125
      */
126
-    public function setSort(string|SortingOrder $sort): void
126
+    public function setSort(string | SortingOrder $sort): void
127 127
     {
128 128
         $this->sort = is_string($sort) ? SortingOrder::from(strtolower($sort)) : $sort;
129 129
     }
Please login to merge, or discard this patch.
src/OrderBy/OrderBy.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,8 +23,8 @@
 block discarded – undo
23 23
      */
24 24
     public function __construct(
25 25
         string $dimension,
26
-        string|OrderByDirection $direction = OrderByDirection::ASC,
27
-        string|SortingOrder $dimensionOrder = SortingOrder::LEXICOGRAPHIC
26
+        string | OrderByDirection $direction = OrderByDirection::ASC,
27
+        string | SortingOrder $dimensionOrder = SortingOrder::LEXICOGRAPHIC
28 28
     ) {
29 29
         $this->dimension      = $dimension;
30 30
         $this->direction      = is_string($direction) ? OrderByDirection::make($direction) : $direction;
Please login to merge, or discard this patch.