These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | namespace Doctrine\ODM\MongoDB\Aggregation\Stage\Bucket; |
||
6 | |||
7 | use Doctrine\ODM\MongoDB\Aggregation\Builder; |
||
8 | use Doctrine\ODM\MongoDB\Aggregation\Stage; |
||
9 | use function assert; |
||
10 | |||
11 | /** |
||
12 | * Fluent interface for adding an output specification to a bucket stage. |
||
13 | */ |
||
14 | View Code Duplication | class BucketAutoOutput extends AbstractOutput |
|
0 ignored issues
–
show
|
|||
15 | { |
||
16 | 3 | public function __construct(Builder $builder, Stage\BucketAuto $bucket) |
|
17 | { |
||
18 | 3 | parent::__construct($builder, $bucket); |
|
19 | 3 | } |
|
20 | |||
21 | /** |
||
22 | * An expression to group documents by. To specify a field path, prefix the |
||
23 | * field name with a dollar sign $ and enclose it in quotes. |
||
24 | */ |
||
25 | public function groupBy($expression) : Stage\BucketAuto |
||
26 | { |
||
27 | assert($this->bucket instanceof Stage\BucketAuto); |
||
28 | return $this->bucket->groupBy($expression); |
||
29 | } |
||
30 | |||
31 | /** |
||
32 | * A positive 32-bit integer that specifies the number of buckets into which input documents are grouped. |
||
33 | */ |
||
34 | public function buckets(int $buckets) : Stage\BucketAuto |
||
35 | { |
||
36 | assert($this->bucket instanceof Stage\BucketAuto); |
||
37 | return $this->bucket->buckets($buckets); |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * A string that specifies the preferred number series to use to ensure that |
||
42 | * the calculated boundary edges end on preferred round numbers or their |
||
43 | * powers of 10. |
||
44 | */ |
||
45 | public function granularity(string $granularity) : Stage\BucketAuto |
||
46 | { |
||
47 | assert($this->bucket instanceof Stage\BucketAuto); |
||
48 | return $this->bucket->granularity($granularity); |
||
49 | } |
||
50 | } |
||
51 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.