triadev /
Leopard
| Conditions | 1 |
| Paths | 1 |
| Total Lines | 3 |
| Code Lines | 1 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 2 |
| CRAP Score | 1 |
| Changes | 0 | ||
| Metric | Value |
|---|---|
| cc | 1 |
| eloc | 1 |
| nc | 1 |
| nop | 1 |
| dl | 0 |
| loc | 3 |
| ccs | 2 |
| cts | 2 |
| cp | 1 |
| crap | 1 |
| rs | 10 |
| c | 0 |
| b | 0 |
| f | 0 |
| 1 | <?php |
||
|
0 ignored issues
–
show
Coding Style
introduced
by
Loading history...
|
|||
| 2 | namespace Triadev\Leopard\Model; |
||
|
0 ignored issues
–
show
|
|||
| 3 | |||
| 4 | use Illuminate\Support\Collection; |
||
| 5 | |||
| 6 | class SearchResult |
||
|
0 ignored issues
–
show
|
|||
| 7 | { |
||
|
0 ignored issues
–
show
|
|||
| 8 | /** @var int */ |
||
|
0 ignored issues
–
show
|
|||
| 9 | private $took; |
||
|
1 ignored issue
–
show
|
|||
| 10 | |||
| 11 | /** @var bool */ |
||
|
0 ignored issues
–
show
|
|||
| 12 | private $timedOut; |
||
|
0 ignored issues
–
show
|
|||
| 13 | |||
| 14 | /** @var array */ |
||
|
0 ignored issues
–
show
|
|||
| 15 | private $shards; |
||
|
0 ignored issues
–
show
|
|||
| 16 | |||
| 17 | /** @var Collection */ |
||
|
0 ignored issues
–
show
|
|||
| 18 | private $hits; |
||
|
0 ignored issues
–
show
|
|||
| 19 | |||
| 20 | /** @var int */ |
||
|
0 ignored issues
–
show
|
|||
| 21 | private $totalHits; |
||
|
0 ignored issues
–
show
|
|||
| 22 | |||
| 23 | /** @var float */ |
||
|
0 ignored issues
–
show
|
|||
| 24 | private $maxScore; |
||
|
0 ignored issues
–
show
|
|||
| 25 | |||
| 26 | /** @var array|null */ |
||
|
0 ignored issues
–
show
|
|||
| 27 | private $aggregation; |
||
|
0 ignored issues
–
show
|
|||
| 28 | |||
| 29 | /** |
||
| 30 | * SearchResult constructor. |
||
| 31 | * @param array $result |
||
|
0 ignored issues
–
show
|
|||
| 32 | */ |
||
| 33 | 2 | public function __construct(array $result) |
|
|
0 ignored issues
–
show
|
|||
| 34 | { |
||
|
0 ignored issues
–
show
|
|||
| 35 | 2 | $this->took = (int)array_get($result, 'took'); |
|
|
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 8 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. Loading history...
|
|||
| 36 | 2 | $this->timedOut = (bool)array_get($result, 'timed_out'); |
|
|
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 4 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. Loading history...
|
|||
| 37 | 2 | $this->shards = (array)array_get($result, '_shards'); |
|
|
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 6 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. Loading history...
|
|||
| 38 | 2 | $this->hits = new Collection(array_get($result, 'hits.hits')); |
|
|
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 8 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. Loading history...
|
|||
| 39 | 2 | $this->totalHits = (int)array_get($result, 'hits.total'); |
|
|
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. Loading history...
|
|||
| 40 | 2 | $this->maxScore = (float)array_get($result, 'hits.max_score'); |
|
|
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 4 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. Loading history...
|
|||
| 41 | 2 | $this->aggregation = array_get($result, 'aggregations', null); |
|
|
0 ignored issues
–
show
|
|||
| 42 | 2 | } |
|
|
0 ignored issues
–
show
|
|||
| 43 | |||
| 44 | /** |
||
|
0 ignored issues
–
show
|
|||
| 45 | * @return int |
||
|
0 ignored issues
–
show
|
|||
| 46 | */ |
||
| 47 | 2 | public function getTook(): int |
|
| 48 | { |
||
|
0 ignored issues
–
show
|
|||
| 49 | 2 | return $this->took; |
|
| 50 | } |
||
|
0 ignored issues
–
show
|
|||
| 51 | |||
| 52 | /** |
||
|
0 ignored issues
–
show
|
|||
| 53 | * @return bool |
||
|
0 ignored issues
–
show
|
|||
| 54 | */ |
||
| 55 | 2 | public function isTimedOut(): bool |
|
| 56 | { |
||
|
0 ignored issues
–
show
|
|||
| 57 | 2 | return $this->timedOut; |
|
| 58 | } |
||
|
0 ignored issues
–
show
|
|||
| 59 | |||
| 60 | /** |
||
|
0 ignored issues
–
show
|
|||
| 61 | * @return array |
||
| 62 | */ |
||
| 63 | 2 | public function getShards(): array |
|
| 64 | { |
||
|
0 ignored issues
–
show
|
|||
| 65 | 2 | return $this->shards; |
|
| 66 | } |
||
|
0 ignored issues
–
show
|
|||
| 67 | |||
| 68 | /** |
||
|
0 ignored issues
–
show
|
|||
| 69 | * @return Collection |
||
| 70 | */ |
||
| 71 | 2 | public function getHits(): Collection |
|
| 72 | { |
||
|
0 ignored issues
–
show
|
|||
| 73 | 2 | return $this->hits; |
|
| 74 | } |
||
|
0 ignored issues
–
show
|
|||
| 75 | |||
| 76 | /** |
||
|
0 ignored issues
–
show
|
|||
| 77 | * @param Collection $hits |
||
|
0 ignored issues
–
show
|
|||
| 78 | */ |
||
|
0 ignored issues
–
show
|
|||
| 79 | 1 | public function setHits(Collection $hits) |
|
| 80 | { |
||
|
0 ignored issues
–
show
|
|||
| 81 | 1 | $this->hits = $hits; |
|
| 82 | 1 | } |
|
|
0 ignored issues
–
show
|
|||
| 83 | |||
| 84 | /** |
||
|
0 ignored issues
–
show
|
|||
| 85 | * @return int |
||
|
0 ignored issues
–
show
|
|||
| 86 | */ |
||
| 87 | 2 | public function getTotalHits(): int |
|
| 88 | { |
||
|
0 ignored issues
–
show
|
|||
| 89 | 2 | return $this->totalHits; |
|
| 90 | } |
||
|
0 ignored issues
–
show
|
|||
| 91 | |||
| 92 | /** |
||
|
0 ignored issues
–
show
|
|||
| 93 | * @return float |
||
| 94 | */ |
||
| 95 | 2 | public function getMaxScore(): float |
|
| 96 | { |
||
|
0 ignored issues
–
show
|
|||
| 97 | 2 | return $this->maxScore; |
|
| 98 | } |
||
|
0 ignored issues
–
show
|
|||
| 99 | |||
| 100 | /** |
||
|
0 ignored issues
–
show
|
|||
| 101 | * @return array|null |
||
| 102 | */ |
||
| 103 | public function getAggregation(): ?array |
||
| 104 | { |
||
|
0 ignored issues
–
show
|
|||
| 105 | return $this->aggregation; |
||
| 106 | } |
||
|
0 ignored issues
–
show
|
|||
| 107 | } |
||
|
0 ignored issues
–
show
|
|||
| 108 |