Completed
Push — master ( f63c2e...3d45a5 )
by Sergey
11:19
created

InnerHits::getParentId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace Isswp101\Persimmon\Elasticsearch;
4
5
class InnerHits
6
{
7
    protected $hits = [];
8
9
    public function __construct(array $response)
10
    {
11
        $this->hits = array_get($response, 'inner_hits', []);
1 ignored issue
show
Documentation Bug introduced by
It seems like array_get($response, 'inner_hits', array()) of type * is incompatible with the declared type array of property $hits.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
12
    }
13
14
    public function getParentId($parentType)
15
    {
16
        return array_get($this->hits, 'inner_hits.' . $parentType . '.hits.hits.0._id');
17
    }
18
19
    public function get()
20
    {
21
        return $this->hits;
22
    }
23
}