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

InnerHit   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 15
dl 0
loc 46
ccs 16
cts 16
cp 1
rs 10
c 0
b 0
f 0
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A parentInnerHit() 0 13 2
A nestedInnerHit() 0 13 2
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\Business\Dsl\Query;
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
4
use ONGR\ElasticsearchDSL\InnerHit\NestedInnerHit;
5
use ONGR\ElasticsearchDSL\InnerHit\ParentInnerHit;
6
use Triadev\Leopard\Business\Dsl\Search;
7
use Triadev\Leopard\Business\Dsl\AbstractQuery;
8
9
class InnerHit extends AbstractQuery
0 ignored issues
show
Coding Style Documentation introduced by
Missing class doc comment
Loading history...
10
{
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration for class InnerHit
Loading history...
11
    /**
12
     * Nested inner hit
13
     *
14
     * @param string $name
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 8 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
15
     * @param string $path
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 8 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
16
     * @param \Closure|null $search
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
17
     * @return InnerHit
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
18
     */
19 2
    public function nestedInnerHit(string $name, string $path, ?\Closure $search = null) : InnerHit
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines before function; 0 found
Loading history...
Coding Style introduced by
Incorrect spacing between argument "$search" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$search"; expected 0 but found 1
Loading history...
20
    {
21 2
        $searchForNested = null;
22
        
23 2
        if ($search) {
24 2
            $searchBuilder = app()->make(Search::class);
25 2
            $search($searchBuilder);
26
            
27 2
            $searchForNested = $searchBuilder->getSearch();
28
        }
29
        
30 2
        $this->search->addInnerHit(new NestedInnerHit($name, $path, $searchForNested));
31 2
        return $this;
32
    }
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 nestedInnerHit()
Loading history...
33
    
34
    /**
35
     * Parent inner hits
36
     *
37
     * @param string $name
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 8 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
38
     * @param string $path
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 8 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
39
     * @param \Closure|null $search
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
40
     * @return InnerHit
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
41
     */
42 1
    public function parentInnerHit(string $name, string $path, ?\Closure $search = null) : InnerHit
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$search" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$search"; expected 0 but found 1
Loading history...
43
    {
44 1
        $searchForNested = null;
45
        
46 1
        if ($search) {
47 1
            $searchBuilder = app()->make(Search::class);
48 1
            $search($searchBuilder);
49
            
50 1
            $searchForNested = $searchBuilder->getSearch();
51
        }
52
        
53 1
        $this->search->addInnerHit(new ParentInnerHit($name, $path, $searchForNested));
54 1
        return $this;
55
    }
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 parentInnerHit()
Loading history...
56
}
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...
57