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

InnerHits   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 0
dl 0
loc 19
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getParentId() 0 4 1
A get() 0 4 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
}