Completed
Push — master ( be5d10...3892c2 )
by Sergey
07:31
created

InnerHits   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 43.75%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 24
ccs 7
cts 16
cp 0.4375
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getParentId() 0 4 1
A getParent() 0 4 1
A get() 0 4 1
1
<?php
2
3
namespace Isswp101\Persimmon\Elasticsearch;
4
5
use Illuminate\Support\Arr;
6
7
class InnerHits
8
{
9
    protected $hits = [];
10
11 10
    public function __construct(array $response)
12
    {
13 10
        $this->hits = Arr::get($response, 'inner_hits', []);
14 10
    }
15
16 10
    public function getParentId($parentType)
17
    {
18 10
        return Arr::get($this->hits, $parentType . '.hits.hits.0._id');
19
    }
20
21 1
    public function getParent($parentType)
22
    {
23 1
        return Arr::get($this->hits, $parentType . '.hits.hits.0._source');
24
    }
25
26
    public function get()
27
    {
28
        return $this->hits;
29
    }
30
}
31