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

InnerHits   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

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

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
    public function __construct(array $response)
12
    {
13
        $this->hits = Arr::get($response, 'inner_hits', []);
14
    }
15
16
    public function getParentId($parentType)
17
    {
18
        return Arr::get($this->hits, $parentType . '.hits.hits.0._id');
19
    }
20
21
    public function getParent($parentType)
22
    {
23
        return Arr::get($this->hits, $parentType . '.hits.hits.0._source');
24
    }
25
26
    public function get()
27
    {
28
        return $this->hits;
29
    }
30
}
31