Completed
Pull Request — master (#75)
by
unknown
02:42
created

RawAggregation::getArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
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\Type\BucketingTrait;
15
16
/**
17
 * Class representing a raw aggregation, that allows to set
18
 * a custom type and body
19
 */
20
class RawAggregation extends AbstractAggregation
21
{
22
    use BucketingTrait;
23
24
    /**
25
     * @var string
26
     */
27
    private $type;
28
    /**
29
     * @var array
30
     */
31
    private $body;
32
33
    /**
34
     * Inner aggregations container init.
35
     *
36
     * @param string $name
37
     * @param string $type
38
     * @param array $body
39
     */
40
    public function __construct($name, $type, $body)
41
    {
42
        parent::__construct($name);
43
44
        $this->setType($type);
45
        $this->setBody($body);
46
    }
47
48
    /**
49
     * {@inheritdoc}
50
     */
51
    public function getType()
52
    {
53
        return $this->type;
54
    }
55
56
    /**
57
     * @param string $type
58
     */
59
    public function setType($type)
60
    {
61
        $this->type = $type;
62
    }
63
64
    /**
65
     * @return array
66
     */
67
    public function getBody()
68
    {
69
        return $this->body;
70
    }
71
72
    /**
73
     * @param array $body
74
     */
75
    public function setBody($body)
76
    {
77
        $this->body = $body;
78
    }
79
80
    /**
81
     * {@inheritdoc}
82
     */
83
    protected function getArray()
84
    {
85
        return $this->getBody();
86
    }
87
}
88