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

Blueprint::geoShape()   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 2
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\Business\Mapping;
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
4
use Illuminate\Support\Fluent;
5
use Triadev\Leopard\Facade\Leopard;
6
7
class Blueprint
0 ignored issues
show
Coding Style Documentation introduced by
Missing class doc comment
Loading history...
8
{
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration for class Blueprint
Loading history...
9
    /** @var Fluent[] */
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...
10
    private $fields = [];
1 ignored issue
show
Coding Style introduced by
Private member variable "fields" 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 "fields" must be prefixed with an underscore
Loading history...
11
    
12
    /**
13
     * Blueprint constructor.
14
     * @param \Closure|null $callback
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...
15
     */
16 13
    public function __construct(\Closure $callback = null)
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines before function; 1 found
Loading history...
Coding Style introduced by
Incorrect spacing between argument "$callback" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$callback"; expected 0 but found 1
Loading history...
17
    {
18 13
        if (!is_null($callback)) {
0 ignored issues
show
Coding Style introduced by
There must be a single space after a NOT operator; 0 found
Loading history...
19
            $callback($this);
20
        }
21 13
    }
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...
22
    
23
    /**
24
     * Build mapping
25
     *
26
     * @param string $index
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...
27
     * @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...
28
     * @return array
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
29
     */
30 8
    public function build(string $index, string $type) : array
31
    {
32 8
        return Leopard::putMappingStatement([
1 ignored issue
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
33 8
            'index' => $index,
0 ignored issues
show
Coding Style introduced by
This array key does not seem to be aligned correctly; expected 45 spaces, but found 12.
Loading history...
34 8
            'type' => $type,
0 ignored issues
show
Coding Style introduced by
This array key does not seem to be aligned correctly; expected 45 spaces, but found 12.
Loading history...
35
            'body' => [
0 ignored issues
show
Coding Style introduced by
This array key does not seem to be aligned correctly; expected 45 spaces, but found 12.
Loading history...
36
                $type => [
0 ignored issues
show
Coding Style introduced by
This array key does not seem to be aligned correctly; expected 23 spaces, but found 16.
Loading history...
37
                    '_source' => [
0 ignored issues
show
Coding Style introduced by
This array key does not seem to be aligned correctly; expected 26 spaces, but found 20.
Loading history...
38
                        'enabled' => true
0 ignored issues
show
Coding Style introduced by
This array key does not seem to be aligned correctly; expected 34 spaces, but found 24.
Loading history...
39
                    ],
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 33 space(s), but found 20.
Loading history...
40 8
                    'properties' => $this->toDsl()
0 ignored issues
show
Coding Style introduced by
This array key does not seem to be aligned correctly; expected 26 spaces, but found 20.
Loading history...
41
                ]
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 25 space(s), but found 16.
Loading history...
42
            ]
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 22 space(s), but found 12.
Loading history...
43
        ]);
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 44 space(s), but found 8.
Loading history...
44
    }
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 build()
Loading history...
45
    
46
    /**
47
     * To dsl
48
     *
49
     * @return array
50
     */
51 10
    public function toDsl() : array
52
    {
53 10
        return (new Compiler())->compileFields($this->fields);
54
    }
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 toDsl()
Loading history...
55
    
56
    /**
57
     * Get fields
58
     *
59
     * @return array
60
     */
61 3
    public function getFields() : array
62
    {
63 3
        return $this->fields;
64
    }
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 getFields()
Loading history...
65
    
66
    /**
67
     * Text
68
     *
69
     * @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...
70
     * @param array $attributes
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 Fluent
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
72
     */
73 10
    public function text(string $field, array $attributes = []) : Fluent
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$attributes" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$attributes"; expected 0 but found 1
Loading history...
74
    {
75 10
        return $this->addField('text', $field, $attributes);
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 text()
Loading history...
77
    
78
    /**
79
     * Keyword
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 $attributes
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 Fluent
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
84
     */
85 11
    public function keyword(string $field, array $attributes = []) : Fluent
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$attributes" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$attributes"; expected 0 but found 1
Loading history...
86
    {
87 11
        return $this->addField('keyword', $field, $attributes);
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 keyword()
Loading history...
89
    
90
    /**
91
     * Long
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 array $attributes
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...
95
     * @return Fluent
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
96
     */
97 1
    public function long(string $field, array $attributes = []) : Fluent
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$attributes" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$attributes"; expected 0 but found 1
Loading history...
98
    {
99 1
        return $this->addField('long', $field, $attributes);
100
    }
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 long()
Loading history...
101
    
102
    /**
103
     * Integer
104
     *
105
     * @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...
106
     * @param array $attributes
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...
107
     * @return Fluent
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
108
     */
109 9
    public function integer(string $field, array $attributes = []) : Fluent
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$attributes" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$attributes"; expected 0 but found 1
Loading history...
110
    {
111 9
        return $this->addField('integer', $field, $attributes);
112
    }
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 integer()
Loading history...
113
    
114
    /**
115
     * Short
116
     *
117
     * @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...
118
     * @param array $attributes
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...
119
     * @return Fluent
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
120
     */
121 1
    public function short(string $field, array $attributes = []) : Fluent
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$attributes" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$attributes"; expected 0 but found 1
Loading history...
122
    {
123 1
        return $this->addField('short', $field, $attributes);
124
    }
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 short()
Loading history...
125
    
126
    /**
127
     * Byte
128
     *
129
     * @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...
130
     * @param array $attributes
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...
131
     * @return Fluent
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
132
     */
133 1
    public function byte(string $field, array $attributes = []) : Fluent
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$attributes" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$attributes"; expected 0 but found 1
Loading history...
134
    {
135 1
        return $this->addField('byte', $field, $attributes);
136
    }
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 byte()
Loading history...
137
    
138
    /**
139
     * Double
140
     *
141
     * @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...
142
     * @param array $attributes
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...
143
     * @return Fluent
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
144
     */
145 1
    public function double(string $field, array $attributes = []) : Fluent
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$attributes" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$attributes"; expected 0 but found 1
Loading history...
146
    {
147 1
        return $this->addField('double', $field, $attributes);
148
    }
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 double()
Loading history...
149
    
150
    /**
151
     * Float
152
     *
153
     * @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...
154
     * @param array $attributes
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...
155
     * @return Fluent
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
156
     */
157 1
    public function float(string $field, array $attributes = []) : Fluent
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$attributes" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$attributes"; expected 0 but found 1
Loading history...
158
    {
159 1
        return $this->addField('float', $field, $attributes);
160
    }
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 float()
Loading history...
161
    
162
    /**
163
     * Half float
164
     *
165
     * @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...
166
     * @param array $attributes
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...
167
     * @return Fluent
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
168
     */
169 1
    public function halfFloat(string $field, array $attributes = []) : Fluent
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$attributes" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$attributes"; expected 0 but found 1
Loading history...
170
    {
171 1
        return $this->addField('half_float', $field, $attributes);
172
    }
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 halfFloat()
Loading history...
173
    
174
    /**
175
     * Scaled float
176
     *
177
     * @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...
178
     * @param array $attributes
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...
179
     * @return Fluent
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
180
     */
181 1
    public function scaledFloat(string $field, array $attributes = []) : Fluent
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$attributes" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$attributes"; expected 0 but found 1
Loading history...
182
    {
183 1
        return $this->addField('scaled_float', $field, $attributes);
184
    }
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 scaledFloat()
Loading history...
185
    
186
    /**
187
     * Date
188
     *
189
     * @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...
190
     * @param array $attributes
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...
191
     * @return Fluent
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
192
     */
193 1
    public function date(string $field, array $attributes = []) : Fluent
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$attributes" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$attributes"; expected 0 but found 1
Loading history...
194
    {
195 1
        return $this->addField('date', $field, $attributes);
196
    }
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 date()
Loading history...
197
    
198
    /**
199
     * Boolean
200
     *
201
     * @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...
202
     * @param array $attributes
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...
203
     * @return Fluent
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
204
     */
205 1
    public function boolean(string $field, array $attributes = []) : Fluent
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$attributes" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$attributes"; expected 0 but found 1
Loading history...
206
    {
207 1
        return $this->addField('boolean', $field, $attributes);
208
    }
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 boolean()
Loading history...
209
    
210
    /**
211
     * Binary
212
     *
213
     * @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...
214
     * @param array $attributes
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...
215
     * @return Fluent
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
216
     */
217 1
    public function binary(string $field, array $attributes = []) : Fluent
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$attributes" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$attributes"; expected 0 but found 1
Loading history...
218
    {
219 1
        return $this->addField('binary', $field, $attributes);
220
    }
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 binary()
Loading history...
221
    
222
    /**
223
     * Range
224
     *
225
     * @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...
226
     * @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...
227
     * @param array $attributes
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...
228
     * @return Fluent
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
229
     *
230
     * @throws \InvalidArgumentException
0 ignored issues
show
introduced by
Comment missing for @throws tag in function comment
Loading history...
231
     */
232 2
    public function range(string $field, string $type, array $attributes = []) : Fluent
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$attributes" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$attributes"; expected 0 but found 1
Loading history...
233
    {
234
        $validTypes = [
235 2
            'integer',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 23 spaces, but found 12.
Loading history...
236
            'float',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 23 spaces, but found 12.
Loading history...
237
            'long',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 23 spaces, but found 12.
Loading history...
238
            'double',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 23 spaces, but found 12.
Loading history...
239
            'date',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 23 spaces, but found 12.
Loading history...
240
            'ip'
0 ignored issues
show
Coding Style introduced by
There should be a trailing comma after the last value of an array declaration.
Loading history...
241
        ];
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 22 space(s), but found 8.
Loading history...
242
        
243 2
        if (!in_array($type, $validTypes)) {
0 ignored issues
show
Coding Style introduced by
There must be a single space after a NOT operator; 0 found
Loading history...
244 1
            throw new \InvalidArgumentException();
245
        }
246
        
247 1
        return $this->addField(strtolower($type) . '_range', $field, $attributes);
0 ignored issues
show
Coding Style introduced by
Concat operator must not be surrounded by spaces
Loading history...
248
    }
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...
249
    
250
    /**
251
     * Nested
252
     *
253
     * @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...
254
     * @param array $attributes
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...
255
     * @return Fluent
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
256
     */
257 1
    public function nested(string $field, array $attributes = []) : Fluent
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$attributes" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$attributes"; expected 0 but found 1
Loading history...
258
    {
259 1
        return $this->addField('nested', $field, $attributes);
260
    }
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 nested()
Loading history...
261
    
262
    /**
263
     * Object
264
     *
265
     * @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...
266
     * @param array $attributes
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...
267
     * @return Fluent
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
268
     */
269 1
    public function object(string $field, array $attributes = []) : Fluent
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$attributes" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$attributes"; expected 0 but found 1
Loading history...
270
    {
271 1
        return $this->addField('object', $field, $attributes);
272
    }
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 object()
Loading history...
273
    
274
    /**
275
     * Geo point
276
     *
277
     * @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...
278
     * @param array $attributes
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...
279
     * @return Fluent
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
280
     */
281 1
    public function geoPoint(string $field, array $attributes = []) : Fluent
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$attributes" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$attributes"; expected 0 but found 1
Loading history...
282
    {
283 1
        return $this->addField('geo_point', $field, $attributes);
284
    }
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 geoPoint()
Loading history...
285
    
286
    /**
287
     * Geo shape
288
     *
289
     * @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...
290
     * @param array $attributes
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...
291
     * @return Fluent
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
292
     */
293 1
    public function geoShape(string $field, array $attributes = []) : Fluent
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$attributes" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$attributes"; expected 0 but found 1
Loading history...
294
    {
295 1
        return $this->addField('geo_shape', $field, $attributes);
296
    }
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 geoShape()
Loading history...
297
    
298
    /**
299
     * Ip
300
     *
301
     * @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...
302
     * @param array $attributes
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...
303
     * @return Fluent
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
304
     */
305 1
    public function ip(string $field, array $attributes = []) : Fluent
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$attributes" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$attributes"; expected 0 but found 1
Loading history...
306
    {
307 1
        return $this->addField('ip', $field, $attributes);
308
    }
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 ip()
Loading history...
309
    
310
    /**
311
     * Completion
312
     *
313
     * @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...
314
     * @param array $attributes
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...
315
     * @return Fluent
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
316
     */
317 1
    public function completion(string $field, array $attributes = []) : Fluent
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$attributes" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$attributes"; expected 0 but found 1
Loading history...
318
    {
319 1
        return $this->addField('completion', $field, $attributes);
320
    }
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 completion()
Loading history...
321
    
322
    /**
323
     * Token count
324
     *
325
     * @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...
326
     * @param array $attributes
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...
327
     * @return Fluent
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
328
     */
329 1
    public function tokenCount(string $field, array $attributes = []) : Fluent
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$attributes" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$attributes"; expected 0 but found 1
Loading history...
330
    {
331 1
        return $this->addField('token_count', $field, $attributes);
332
    }
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 tokenCount()
Loading history...
333
    
334
    /**
335
     * Add field
336
     *
337
     * @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...
338
     * @param string $name
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...
339
     * @param array $attributes
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...
340
     * @return Fluent
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
341
     */
342 12
    public function addField(string $type, string $name, array $attributes = []) : Fluent
2 ignored issues
show
Unused Code introduced by
The method parameter $type is never used
Loading history...
Unused Code introduced by
The method parameter $name is never used
Loading history...
Coding Style introduced by
Incorrect spacing between argument "$attributes" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$attributes"; expected 0 but found 1
Loading history...
343
    {
344 12
        $this->fields[] = $field = new Fluent(
0 ignored issues
show
Coding Style introduced by
Assignments must be the first block of code on a line
Loading history...
345 12
            array_merge(
346 12
                compact(
347 12
                    'type',
348 12
                    'name'
349
                ),
350 12
                $attributes
351
            )
352
        );
353
        
354 12
        return $field;
355
    }
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 addField()
Loading history...
356
}
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...
357