Passed
Branch master (8cb5b2)
by Christopher
04:33 queued 12s
created

SearchResult::getShards()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
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
The PHP open tag does not have a corresponding PHP close tag
Loading history...
2
namespace Triadev\Leopard\Model;
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
4
use Illuminate\Support\Collection;
5
6
class SearchResult
0 ignored issues
show
Coding Style Documentation introduced by
Missing class doc comment
Loading history...
7
{
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration for class SearchResult
Loading history...
8
    /** @var int */
0 ignored issues
show
Coding Style introduced by
The open comment tag must be the only content on the line
Loading history...
Coding Style introduced by
Missing short description in doc comment
Loading history...
Coding Style introduced by
The close comment tag must be the only content on the line
Loading history...
9
    private $took;
1 ignored issue
show
Coding Style introduced by
Private member variable "took" must contain a leading underscore
Loading history...
Coding Style introduced by
Expected 1 blank line before member var; 0 found
Loading history...
Coding Style introduced by
Private member variable "took" must be prefixed with an underscore
Loading history...
10
    
11
    /** @var bool */
0 ignored issues
show
Coding Style introduced by
The open comment tag must be the only content on the line
Loading history...
Coding Style introduced by
Missing short description in doc comment
Loading history...
Coding Style introduced by
The close comment tag must be the only content on the line
Loading history...
12
    private $timedOut;
0 ignored issues
show
Coding Style introduced by
Private member variable "timedOut" must contain a leading underscore
Loading history...
Coding Style introduced by
Private member variable "timedOut" must be prefixed with an underscore
Loading history...
13
    
14
    /** @var array */
0 ignored issues
show
Coding Style introduced by
The open comment tag must be the only content on the line
Loading history...
Coding Style introduced by
Missing short description in doc comment
Loading history...
Coding Style introduced by
The close comment tag must be the only content on the line
Loading history...
15
    private $shards;
0 ignored issues
show
Coding Style introduced by
Private member variable "shards" must contain a leading underscore
Loading history...
Coding Style introduced by
Private member variable "shards" must be prefixed with an underscore
Loading history...
16
    
17
    /** @var Collection */
0 ignored issues
show
Coding Style introduced by
The open comment tag must be the only content on the line
Loading history...
Coding Style introduced by
Missing short description in doc comment
Loading history...
Coding Style introduced by
The close comment tag must be the only content on the line
Loading history...
18
    private $hits;
0 ignored issues
show
Coding Style introduced by
Private member variable "hits" must contain a leading underscore
Loading history...
Coding Style introduced by
Private member variable "hits" must be prefixed with an underscore
Loading history...
19
    
20
    /** @var int */
0 ignored issues
show
Coding Style introduced by
The open comment tag must be the only content on the line
Loading history...
Coding Style introduced by
Missing short description in doc comment
Loading history...
Coding Style introduced by
The close comment tag must be the only content on the line
Loading history...
21
    private $totalHits;
0 ignored issues
show
Coding Style introduced by
Private member variable "totalHits" must contain a leading underscore
Loading history...
Coding Style introduced by
Private member variable "totalHits" must be prefixed with an underscore
Loading history...
22
    
23
    /** @var float */
0 ignored issues
show
Coding Style introduced by
The open comment tag must be the only content on the line
Loading history...
Coding Style introduced by
Missing short description in doc comment
Loading history...
Coding Style introduced by
The close comment tag must be the only content on the line
Loading history...
24
    private $maxScore;
0 ignored issues
show
Coding Style introduced by
Private member variable "maxScore" must contain a leading underscore
Loading history...
Coding Style introduced by
Private member variable "maxScore" must be prefixed with an underscore
Loading history...
25
    
26
    /** @var array|null */
0 ignored issues
show
Coding Style introduced by
The open comment tag must be the only content on the line
Loading history...
Coding Style introduced by
Missing short description in doc comment
Loading history...
Coding Style introduced by
The close comment tag must be the only content on the line
Loading history...
27
    private $aggregation;
0 ignored issues
show
Coding Style introduced by
Private member variable "aggregation" must contain a leading underscore
Loading history...
Coding Style introduced by
Private member variable "aggregation" must be prefixed with an underscore
Loading history...
28
    
29
    /**
30
     * SearchResult constructor.
31
     * @param array $result
0 ignored issues
show
Coding Style introduced by
There must be exactly one blank line before the tags in a doc comment
Loading history...
Coding Style introduced by
Missing parameter comment
Loading history...
32
     */
33 2
    public function __construct(array $result)
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines before function; 1 found
Loading history...
34
    {
35 2
        $this->took = (int)array_get($result, 'took');
0 ignored issues
show
Coding Style introduced by
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
Coding Style introduced by
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
Coding Style introduced by
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
Coding Style introduced by
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
Coding Style introduced by
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
Coding Style introduced by
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);
42 2
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end __construct()
Loading history...
43
    
44
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
45
     * @return int
0 ignored issues
show
Coding Style introduced by
Expected "integer" but found "int" for function return type
Loading history...
46
     */
47 2
    public function getTook(): int
48
    {
49 2
        return $this->took;
50
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end getTook()
Loading history...
51
    
52
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
53
     * @return bool
0 ignored issues
show
Coding Style introduced by
Expected "boolean" but found "bool" for function return type
Loading history...
54
     */
55 2
    public function isTimedOut(): bool
56
    {
57 2
        return $this->timedOut;
58
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end isTimedOut()
Loading history...
59
    
60
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
61
     * @return array
62
     */
63 2
    public function getShards(): array
64
    {
65 2
        return $this->shards;
66
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end getShards()
Loading history...
67
    
68
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
69
     * @return Collection
70
     */
71 2
    public function getHits(): Collection
72
    {
73 2
        return $this->hits;
74
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end getHits()
Loading history...
75
    
76
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
77
     * @param Collection $hits
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
78
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
79 1
    public function setHits(Collection $hits)
80
    {
81 1
        $this->hits = $hits;
82 1
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end setHits()
Loading history...
83
    
84
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
85
     * @return int
0 ignored issues
show
Coding Style introduced by
Expected "integer" but found "int" for function return type
Loading history...
86
     */
87 2
    public function getTotalHits(): int
88
    {
89 2
        return $this->totalHits;
90
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end getTotalHits()
Loading history...
91
    
92
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
93
     * @return float
94
     */
95 2
    public function getMaxScore(): float
96
    {
97 2
        return $this->maxScore;
98
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end getMaxScore()
Loading history...
99
    
100
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
101
     * @return array|null
102
     */
103
    public function getAggregation(): ?array
104
    {
105
        return $this->aggregation;
106
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 0 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end getAggregation()
Loading history...
107
}
0 ignored issues
show
Coding Style introduced by
Expected //end class
Loading history...
Coding Style introduced by
As per coding style, files should not end with a newline character.

This check marks files that end in a newline character, i.e. an empy line.

Loading history...
108