Completed
Push — master ( 4e3586...47872e )
by Sergey
05:37
created

InnerHits   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 77.78%

Importance

Changes 3
Bugs 1 Features 0
Metric Value
wmc 4
c 3
b 1
f 0
lcom 1
cbo 0
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 get() 0 4 1
A getParent() 0 4 1
1
<?php
2
3
namespace Isswp101\Persimmon\Elasticsearch;
4
5
class InnerHits
6
{
7
    protected $hits = [];
8
9 20
    public function __construct(array $response)
10
    {
11 20
        $this->hits = array_get($response, 'inner_hits', []);
12 20
    }
13
14 20
    public function getParentId($parentType)
15
    {
16 20
        return array_get($this->hits, $parentType . '.hits.hits.0._id');
17
    }
18
19 2
    public function getParent($parentType)
20
    {
21 2
        return array_get($this->hits, $parentType . '.hits.hits.0._source');
22
    }
23
24
    public function get()
25
    {
26
        return $this->hits;
27
    }
28
}
29