Completed
Push — master ( ab4a72...99f0f9 )
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 77.78%

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