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

TermLevel   A

Complexity

Total Complexity 11

Size/Duplication

Total Lines 133
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 133
ccs 22
cts 22
cp 1
rs 10
c 0
b 0
f 0
wmc 11

11 Methods

Rating   Name   Duplication   Size   Complexity  
A wildcard() 0 3 1
A regexp() 0 3 1
A fuzzy() 0 3 1
A type() 0 3 1
A prefix() 0 3 1
A terms() 0 3 1
A matchAll() 0 3 1
A range() 0 3 1
A term() 0 3 1
A exists() 0 3 1
A ids() 0 3 1
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\Query\MatchAllQuery;
5
use ONGR\ElasticsearchDSL\Query\TermLevel\ExistsQuery;
6
use ONGR\ElasticsearchDSL\Query\TermLevel\FuzzyQuery;
7
use ONGR\ElasticsearchDSL\Query\TermLevel\IdsQuery;
8
use ONGR\ElasticsearchDSL\Query\TermLevel\PrefixQuery;
9
use ONGR\ElasticsearchDSL\Query\TermLevel\RangeQuery;
10
use ONGR\ElasticsearchDSL\Query\TermLevel\RegexpQuery;
11
use ONGR\ElasticsearchDSL\Query\TermLevel\TermQuery;
12
use ONGR\ElasticsearchDSL\Query\TermLevel\TermsQuery;
13
use ONGR\ElasticsearchDSL\Query\TermLevel\TypeQuery;
14
use ONGR\ElasticsearchDSL\Query\TermLevel\WildcardQuery;
15
use Triadev\Leopard\Business\Dsl\AbstractQuery;
16
17
class TermLevel extends AbstractQuery
0 ignored issues
show
Coding Style Documentation introduced by
Missing class doc comment
Loading history...
18
{
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration for class TermLevel
Loading history...
19
    /**
20
     * Match all
21
     *
22
     * @return TermLevel
23
     */
24 1
    public function matchAll() : TermLevel
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines before function; 0 found
Loading history...
25
    {
26 1
        return $this->append(new MatchAllQuery());
27
    }
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 matchAll()
Loading history...
28
    
29
    /**
30
     * Exists
31
     *
32
     * @param string $field
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...
33
     * @return TermLevel
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
34
     */
35 1
    public function exists(string $field): TermLevel
36
    {
37 1
        return $this->append(new ExistsQuery($field));
38
    }
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 exists()
Loading history...
39
    
40
    /**
41
     * Fuzzy
42
     *
43
     * @param string $field
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...
44
     * @param string $value
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...
45
     * @param array $params
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 2 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
46
     * @return TermLevel
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
47
     */
48 1
    public function fuzzy(string $field, string $value, array $params = []): TermLevel
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$params" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$params"; expected 0 but found 1
Loading history...
49
    {
50 1
        return $this->append(new FuzzyQuery($field, $value, $params));
51
    }
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 fuzzy()
Loading history...
52
    
53
    /**
54
     * Ids
55
     *
56
     * @param array $values
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...
57
     * @param array $params
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...
58
     * @return TermLevel
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
59
     */
60 1
    public function ids(array $values, array $params = []): TermLevel
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$params" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$params"; expected 0 but found 1
Loading history...
61
    {
62 1
        return $this->append(new IdsQuery($values, $params));
63
    }
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 ids()
Loading history...
64
    
65
    /**
66
     * Prefix
67
     *
68
     * @param string $field
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...
69
     * @param string $value
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...
70
     * @param array $params
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 2 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
71
     * @return TermLevel
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
72
     */
73 1
    public function prefix(string $field, string $value, array $params = []): TermLevel
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$params" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$params"; expected 0 but found 1
Loading history...
74
    {
75 1
        return $this->append(new PrefixQuery($field, $value, $params));
76
    }
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 prefix()
Loading history...
77
    
78
    /**
79
     * Range
80
     *
81
     * @param string $field
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...
82
     * @param array $params
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 2 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
83
     * @return TermLevel
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
84
     */
85 1
    public function range(string $field, array $params = []): TermLevel
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$params" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$params"; expected 0 but found 1
Loading history...
86
    {
87 1
        return $this->append(new RangeQuery($field, $params));
88
    }
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 range()
Loading history...
89
    
90
    /**
91
     * Regexp
92
     *
93
     * @param string $field
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...
94
     * @param string $value
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...
95
     * @param array $params
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 2 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
96
     * @return TermLevel
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
97
     */
98 1
    public function regexp(string $field, string $value, array $params = []): TermLevel
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$params" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$params"; expected 0 but found 1
Loading history...
99
    {
100 1
        return $this->append(new RegexpQuery($field, $value, $params));
101
    }
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 regexp()
Loading history...
102
    
103
    /**
104
     * Term
105
     *
106
     * @param string $field
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...
107
     * @param string $value
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...
108
     * @return TermLevel
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
109
     */
110 21
    public function term(string $field, string $value): TermLevel
111
    {
112 21
        return $this->append(new TermQuery($field, $value));
113
    }
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 term()
Loading history...
114
    
115
    /**
116
     * Terms
117
     *
118
     * @param string $field
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...
119
     * @param array $values
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 2 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
120
     * @param array $params
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 2 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
121
     * @return TermLevel
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
122
     */
123 1
    public function terms(string $field, array $values, array $params = []): TermLevel
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$params" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$params"; expected 0 but found 1
Loading history...
124
    {
125 1
        return $this->append(new TermsQuery($field, $values, $params));
126
    }
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 terms()
Loading history...
127
    
128
    /**
129
     * Type
130
     *
131
     * @param string $type
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...
132
     * @return TermLevel
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
133
     */
134 1
    public function type(string $type) : TermLevel
135
    {
136 1
        return $this->append(new TypeQuery($type));
137
    }
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 type()
Loading history...
138
    
139
    /**
140
     * Wildcard
141
     *
142
     * @param string $field
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...
143
     * @param string $value
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...
144
     * @param array $params
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 2 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
145
     * @return TermLevel
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
146
     */
147 1
    public function wildcard(string $field, string $value, array $params = []): TermLevel
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$params" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$params"; expected 0 but found 1
Loading history...
148
    {
149 1
        return $this->append(new WildcardQuery($field, $value, $params));
150
    }
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 wildcard()
Loading history...
151
}
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...
152