Completed
Pull Request — master (#148)
by Simonas
02:51
created

HistogramAggregation::__construct()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 30
Code Lines 24

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 30
rs 8.8571
cc 1
eloc 24
nc 1
nop 9

How to fix   Many Parameters   

Many Parameters

Methods with many parameters are not only hard to understand, but their parameters also often become inconsistent when you need more, or different data.

There are several approaches to avoid long parameter lists:

1
<?php
2
3
/*
4
 * This file is part of the ONGR package.
5
 *
6
 * (c) NFQ Technologies UAB <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace ONGR\ElasticsearchDSL\Aggregation;
13
14
use ONGR\ElasticsearchDSL\Aggregation\Bucketing\HistogramAggregation as Base;
15
16
/**
17
 * Class representing Histogram aggregation.
18
 *
19
 * @deprecated Aggregations was moved to it's type namespace. Add `Metric` or `Bucketing` after `Aggregation`.
20
 *     This class will be removed in 3.0.
21
 */
22
class HistogramAggregation extends Base
23
{
24
    public function __construct(
25
        $name,
26
        $field,
27
        $interval,
28
        $minDocCount,
29
        $orderMode,
30
        $orderDirection,
31
        $extendedBoundsMin,
32
        $extendedBoundsMax,
33
        $keyed
34
    ) {
35
    
36
        parent::__construct(
37
            $name,
38
            $field,
39
            $interval,
40
            $minDocCount,
41
            $orderMode,
42
            $orderDirection,
43
            $extendedBoundsMin,
44
            $extendedBoundsMax,
45
            $keyed
46
        );
47
48
        trigger_error(
49
            'This aggregation is moved to `Bucketing` namespace. Use the new namespace instead.' .
50
            ' It will be removed in 3.0',
51
            E_USER_DEPRECATED
52
        );
53
    }
54
}
55