Completed
Push — master ( ab4a72...99f0f9 )
by Sergey
05:20
created

Response::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 2
Bugs 1 Features 0
Metric Value
c 2
b 1
f 0
dl 0
loc 7
ccs 6
cts 6
cp 1
rs 9.4285
cc 1
eloc 5
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Isswp101\Persimmon\Elasticsearch;
4
5
use Illuminate\Support\Arr;
6
7
class Response
8
{
9
    public $index;
10
    public $type;
11
    public $id;
12
    public $source = [];
13
14 30
    public function __construct(array $res)
15
    {
16 30
        $this->index = Arr::get($res, '_index');
17 30
        $this->type = Arr::get($res, '_type');
18 30
        $this->id = Arr::get($res, '_id');
19 30
        $this->source = Arr::get($res, '_source', []);
20 30
    }
21
22
    /**
23
     * @return mixed
24
     */
25
    public function getIndex()
26
    {
27
        return $this->index;
28
    }
29
30
    /**
31
     * @return mixed
32
     */
33
    public function getType()
34
    {
35
        return $this->type;
36
    }
37
38
    /**
39
     * @return mixed
40
     */
41 30
    public function getId()
42
    {
43 30
        return $this->id;
44
    }
45
46
    /**
47
     * @return array
48
     */
49 30
    public function getSource()
50
    {
51 30
        return $this->source;
52
    }
53
}
54