 triadev    /
                    Leopard
                      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\Business\Mapping; | ||
| 0 ignored issues–
                            show | |||
| 3 | |||
| 4 | use Illuminate\Support\Fluent; | ||
| 5 | |||
| 6 | class Compiler | ||
| 0 ignored issues–
                            show | |||
| 7 | { | ||
| 0 ignored issues–
                            show | |||
| 8 | /** | ||
| 9 | * Compile: text | ||
| 10 | * | ||
| 11 | * @param Fluent $fluent | ||
| 0 ignored issues–
                            show | |||
| 12 | * @return array | ||
| 0 ignored issues–
                            show | |||
| 13 | */ | ||
| 14 | 11 | public function compileText(Fluent $fluent) : array | |
| 0 ignored issues–
                            show | |||
| 15 |     { | ||
| 16 | 11 | return $this->formatAttributes([ | |
| 1 ignored issue–
                            show | |||
| 17 | 11 | 'type' => 'text', | |
| 1 ignored issue–
                            show | |||
| 18 | 11 | 'analyzer' => $fluent->analyzer, | |
| 1 ignored issue–
                            show | |||
| 19 | 11 | 'boost' => $fluent->boost, | |
| 1 ignored issue–
                            show | |||
| 20 | 11 | 'eager_global_ordinals' => $fluent->eager_global_ordinals, | |
| 1 ignored issue–
                            show | |||
| 21 | 11 | 'fielddata' => $fluent->fielddata, | |
| 1 ignored issue–
                            show | |||
| 22 | 11 | 'fielddata_frequency_filter' => $fluent->fielddata_frequency_filter, | |
| 1 ignored issue–
                            show | |||
| 23 | 11 | 'fields' => $fluent->fields, | |
| 1 ignored issue–
                            show | |||
| 24 | 11 | 'index' => $fluent->index, | |
| 1 ignored issue–
                            show | |||
| 25 | 11 | 'index_options' => $fluent->index_options, | |
| 1 ignored issue–
                            show | |||
| 26 | 11 | 'index_prefixes' => $fluent->index_prefixes, | |
| 1 ignored issue–
                            show | |||
| 27 | 11 | 'index_phrases' => $fluent->index_phrases, | |
| 1 ignored issue–
                            show | |||
| 28 | 11 | 'norms' => $fluent->norms, | |
| 1 ignored issue–
                            show | |||
| 29 | 11 | 'position_increment_gap' => $fluent->position_increment_gap, | |
| 1 ignored issue–
                            show | |||
| 30 | 11 | 'store' => $fluent->store, | |
| 1 ignored issue–
                            show | |||
| 31 | 11 | 'search_analyzer' => $fluent->search_analyzer, | |
| 1 ignored issue–
                            show | |||
| 32 | 11 | 'search_quote_analyzer' => $fluent->search_quote_analyzer, | |
| 1 ignored issue–
                            show | |||
| 33 | 11 | 'similarity' => $fluent->similarity, | |
| 1 ignored issue–
                            show | |||
| 34 | 11 | 'term_vector' => $fluent->term_vector | |
| 1 ignored issue–
                            show | |||
| 35 | ]); | ||
| 0 ignored issues–
                            show 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... | |||
| 36 | } | ||
| 0 ignored issues–
                            show | |||
| 37 | |||
| 38 | /** | ||
| 39 | * Compile: keyword | ||
| 40 | * | ||
| 41 | * @param Fluent $fluent | ||
| 0 ignored issues–
                            show | |||
| 42 | * @return array | ||
| 0 ignored issues–
                            show | |||
| 43 | */ | ||
| 44 | 12 | public function compileKeyword(Fluent $fluent) : array | |
| 45 |     { | ||
| 46 | 12 | return $this->formatAttributes([ | |
| 1 ignored issue–
                            show | |||
| 47 | 12 | 'type' => 'keyword', | |
| 1 ignored issue–
                            show | |||
| 48 | 12 | 'boost' => $fluent->boost, | |
| 1 ignored issue–
                            show | |||
| 49 | 12 | 'doc_values' => $fluent->doc_values, | |
| 1 ignored issue–
                            show | |||
| 50 | 12 | 'eager_global_ordinals' => $fluent->eager_global_ordinals, | |
| 1 ignored issue–
                            show | |||
| 51 | 12 | 'fields' => $fluent->fields, | |
| 1 ignored issue–
                            show | |||
| 52 | 12 | 'ignore_above' => $fluent->ignore_above, | |
| 1 ignored issue–
                            show | |||
| 53 | 12 | 'index' => $fluent->index, | |
| 1 ignored issue–
                            show | |||
| 54 | 12 | 'index_options' => $fluent->index_options, | |
| 1 ignored issue–
                            show | |||
| 55 | 12 | 'norms' => $fluent->norms, | |
| 1 ignored issue–
                            show | |||
| 56 | 12 | 'null_value' => $fluent->null_value, | |
| 1 ignored issue–
                            show | |||
| 57 | 12 | 'store' => $fluent->store, | |
| 1 ignored issue–
                            show | |||
| 58 | 12 | 'similarity' => $fluent->similarity, | |
| 1 ignored issue–
                            show | |||
| 59 | 12 | 'normalizer' => $fluent->normalizer, | |
| 1 ignored issue–
                            show | |||
| 60 | 12 | 'split_queries_on_whitespace' => $fluent->split_queries_on_whitespace | |
| 1 ignored issue–
                            show | |||
| 61 | ]); | ||
| 0 ignored issues–
                            show 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... | |||
| 62 | } | ||
| 0 ignored issues–
                            show | |||
| 63 | |||
| 64 | /** | ||
| 65 | * Compile: long | ||
| 66 | * | ||
| 67 | * @param Fluent $fluent | ||
| 0 ignored issues–
                            show | |||
| 68 | * @return array | ||
| 0 ignored issues–
                            show | |||
| 69 | */ | ||
| 70 | 2 | public function compileLong(Fluent $fluent) : array | |
| 71 |     { | ||
| 72 | 2 | return $this->compileNumeric($fluent); | |
| 73 | } | ||
| 0 ignored issues–
                            show | |||
| 74 | |||
| 75 | /** | ||
| 76 | * Compile: integer | ||
| 77 | * | ||
| 78 | * @param Fluent $fluent | ||
| 0 ignored issues–
                            show | |||
| 79 | * @return array | ||
| 0 ignored issues–
                            show | |||
| 80 | */ | ||
| 81 | 10 | public function compileInteger(Fluent $fluent) : array | |
| 82 |     { | ||
| 83 | 10 | return $this->compileNumeric($fluent); | |
| 84 | } | ||
| 0 ignored issues–
                            show | |||
| 85 | |||
| 86 | /** | ||
| 87 | * Compile: short | ||
| 88 | * | ||
| 89 | * @param Fluent $fluent | ||
| 0 ignored issues–
                            show | |||
| 90 | * @return array | ||
| 0 ignored issues–
                            show | |||
| 91 | */ | ||
| 92 | 2 | public function compileShort(Fluent $fluent) : array | |
| 93 |     { | ||
| 94 | 2 | return $this->compileNumeric($fluent); | |
| 95 | } | ||
| 0 ignored issues–
                            show | |||
| 96 | |||
| 97 | /** | ||
| 98 | * Compile: byte | ||
| 99 | * | ||
| 100 | * @param Fluent $fluent | ||
| 0 ignored issues–
                            show | |||
| 101 | * @return array | ||
| 0 ignored issues–
                            show | |||
| 102 | */ | ||
| 103 | 2 | public function compileByte(Fluent $fluent) : array | |
| 104 |     { | ||
| 105 | 2 | return $this->compileNumeric($fluent); | |
| 106 | } | ||
| 0 ignored issues–
                            show | |||
| 107 | |||
| 108 | /** | ||
| 109 | * Compile: double | ||
| 110 | * | ||
| 111 | * @param Fluent $fluent | ||
| 0 ignored issues–
                            show | |||
| 112 | * @return array | ||
| 0 ignored issues–
                            show | |||
| 113 | */ | ||
| 114 | 2 | public function compileDouble(Fluent $fluent) : array | |
| 115 |     { | ||
| 116 | 2 | return $this->compileNumeric($fluent); | |
| 117 | } | ||
| 0 ignored issues–
                            show | |||
| 118 | |||
| 119 | /** | ||
| 120 | * Compile: float | ||
| 121 | * | ||
| 122 | * @param Fluent $fluent | ||
| 0 ignored issues–
                            show | |||
| 123 | * @return array | ||
| 0 ignored issues–
                            show | |||
| 124 | */ | ||
| 125 | 2 | public function compileFloat(Fluent $fluent) : array | |
| 126 |     { | ||
| 127 | 2 | return $this->compileNumeric($fluent); | |
| 128 | } | ||
| 0 ignored issues–
                            show | |||
| 129 | |||
| 130 | /** | ||
| 131 | * Compile: half float | ||
| 132 | * | ||
| 133 | * @param Fluent $fluent | ||
| 0 ignored issues–
                            show | |||
| 134 | * @return array | ||
| 0 ignored issues–
                            show | |||
| 135 | */ | ||
| 136 | 2 | public function compileHalfFloat(Fluent $fluent) : array | |
| 137 |     { | ||
| 138 | 2 | return $this->compileNumeric($fluent); | |
| 139 | } | ||
| 0 ignored issues–
                            show | |||
| 140 | |||
| 141 | /** | ||
| 142 | * Compile: scaled float | ||
| 143 | * | ||
| 144 | * @param Fluent $fluent | ||
| 0 ignored issues–
                            show | |||
| 145 | * @return array | ||
| 0 ignored issues–
                            show | |||
| 146 | */ | ||
| 147 | 2 | public function compileScaledFloat(Fluent $fluent) : array | |
| 148 |     { | ||
| 149 | 2 | return $this->compileNumeric($fluent); | |
| 150 | } | ||
| 0 ignored issues–
                            show | |||
| 151 | |||
| 152 | /** | ||
| 153 | * Compile: numeric | ||
| 154 | * | ||
| 155 | * @param Fluent $fluent | ||
| 0 ignored issues–
                            show | |||
| 156 | * @return array | ||
| 0 ignored issues–
                            show | |||
| 157 | */ | ||
| 158 | 17 | public function compileNumeric(Fluent $fluent) : array | |
| 159 |     { | ||
| 160 | 17 | return $this->formatAttributes([ | |
| 1 ignored issue–
                            show | |||
| 161 | 17 | 'type' => $fluent->type, | |
| 1 ignored issue–
                            show | |||
| 162 | 17 | 'coerce' => $fluent->coerce, | |
| 1 ignored issue–
                            show | |||
| 163 | 17 | 'boost' => $fluent->boost, | |
| 1 ignored issue–
                            show | |||
| 164 | 17 | 'doc_values' => $fluent->doc_values, | |
| 1 ignored issue–
                            show | |||
| 165 | 17 | 'ignore_malformed' => $fluent->ignore_malformed, | |
| 1 ignored issue–
                            show | |||
| 166 | 17 | 'index' => $fluent->index, | |
| 1 ignored issue–
                            show | |||
| 167 | 17 | 'null_value' => $fluent->null_value, | |
| 1 ignored issue–
                            show | |||
| 168 | 17 | 'store' => $fluent->store | |
| 1 ignored issue–
                            show | |||
| 169 | ]); | ||
| 0 ignored issues–
                            show 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... | |||
| 170 | } | ||
| 0 ignored issues–
                            show | |||
| 171 | |||
| 172 | /** | ||
| 173 | * Compile: date | ||
| 174 | * | ||
| 175 | * @param Fluent $fluent | ||
| 0 ignored issues–
                            show | |||
| 176 | * @return array | ||
| 0 ignored issues–
                            show | |||
| 177 | */ | ||
| 178 | 2 | public function compileDate(Fluent $fluent) : array | |
| 179 |     { | ||
| 180 | 2 | return $this->formatAttributes([ | |
| 1 ignored issue–
                            show | |||
| 181 | 2 | 'type' => 'date', | |
| 1 ignored issue–
                            show | |||
| 182 | 2 | 'boost' => $fluent->boost, | |
| 1 ignored issue–
                            show | |||
| 183 | 2 | 'doc_values' => $fluent->doc_values, | |
| 1 ignored issue–
                            show | |||
| 184 | 2 | 'format' => $fluent->format, | |
| 1 ignored issue–
                            show | |||
| 185 | 2 | 'locale' => $fluent->locale, | |
| 1 ignored issue–
                            show | |||
| 186 | 2 | 'ignore_malformed' => $fluent->ignore_malformed, | |
| 1 ignored issue–
                            show | |||
| 187 | 2 | 'index' => $fluent->index, | |
| 1 ignored issue–
                            show | |||
| 188 | 2 | 'null_value' => $fluent->null_value, | |
| 1 ignored issue–
                            show | |||
| 189 | 2 | 'store' => $fluent->store | |
| 1 ignored issue–
                            show | |||
| 190 | ]); | ||
| 0 ignored issues–
                            show 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... | |||
| 191 | } | ||
| 0 ignored issues–
                            show | |||
| 192 | |||
| 193 | /** | ||
| 194 | * Compile: boolean | ||
| 195 | * | ||
| 196 | * @param Fluent $fluent | ||
| 0 ignored issues–
                            show | |||
| 197 | * @return array | ||
| 0 ignored issues–
                            show | |||
| 198 | */ | ||
| 199 | 2 | public function compileBoolean(Fluent $fluent) : array | |
| 200 |     { | ||
| 201 | 2 | return $this->formatAttributes([ | |
| 1 ignored issue–
                            show | |||
| 202 | 2 | 'type' => 'boolean', | |
| 1 ignored issue–
                            show | |||
| 203 | 2 | 'boost' => $fluent->boost, | |
| 1 ignored issue–
                            show | |||
| 204 | 2 | 'doc_values' => $fluent->doc_values, | |
| 1 ignored issue–
                            show | |||
| 205 | 2 | 'index' => $fluent->index, | |
| 1 ignored issue–
                            show | |||
| 206 | 2 | 'null_value' => $fluent->null_value, | |
| 1 ignored issue–
                            show | |||
| 207 | 2 | 'store' => $fluent->store | |
| 1 ignored issue–
                            show | |||
| 208 | ]); | ||
| 0 ignored issues–
                            show 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... | |||
| 209 | } | ||
| 0 ignored issues–
                            show | |||
| 210 | |||
| 211 | /** | ||
| 212 | * Compile: binary | ||
| 213 | * | ||
| 214 | * @param Fluent $fluent | ||
| 0 ignored issues–
                            show | |||
| 215 | * @return array | ||
| 0 ignored issues–
                            show | |||
| 216 | */ | ||
| 217 | 2 | public function compileBinary(Fluent $fluent) : array | |
| 218 |     { | ||
| 219 | 2 | return $this->formatAttributes([ | |
| 1 ignored issue–
                            show | |||
| 220 | 2 | 'type' => 'binary', | |
| 1 ignored issue–
                            show | |||
| 221 | 2 | 'doc_values' => $fluent->doc_values, | |
| 1 ignored issue–
                            show | |||
| 222 | 2 | 'store' => $fluent->store | |
| 1 ignored issue–
                            show | |||
| 223 | ]); | ||
| 0 ignored issues–
                            show 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... | |||
| 224 | } | ||
| 0 ignored issues–
                            show | |||
| 225 | |||
| 226 | /** | ||
| 227 | * Compile: integer range | ||
| 228 | * | ||
| 229 | * @param Fluent $fluent | ||
| 0 ignored issues–
                            show | |||
| 230 | * @return array | ||
| 0 ignored issues–
                            show | |||
| 231 | */ | ||
| 232 | 4 | public function compileIntegerRange(Fluent $fluent) : array | |
| 233 |     { | ||
| 234 | 4 | return $this->compileRange($fluent); | |
| 235 | } | ||
| 0 ignored issues–
                            show | |||
| 236 | |||
| 237 | /** | ||
| 238 | * Compile: float range | ||
| 239 | * | ||
| 240 | * @param Fluent $fluent | ||
| 0 ignored issues–
                            show | |||
| 241 | * @return array | ||
| 0 ignored issues–
                            show | |||
| 242 | */ | ||
| 243 | 2 | public function compileFloatRange(Fluent $fluent) : array | |
| 244 |     { | ||
| 245 | 2 | return $this->compileRange($fluent); | |
| 246 | } | ||
| 0 ignored issues–
                            show | |||
| 247 | |||
| 248 | /** | ||
| 249 | * Compile: long range | ||
| 250 | * | ||
| 251 | * @param Fluent $fluent | ||
| 0 ignored issues–
                            show | |||
| 252 | * @return array | ||
| 0 ignored issues–
                            show | |||
| 253 | */ | ||
| 254 | 2 | public function compileLongRange(Fluent $fluent) : array | |
| 255 |     { | ||
| 256 | 2 | return $this->compileRange($fluent); | |
| 257 | } | ||
| 0 ignored issues–
                            show | |||
| 258 | |||
| 259 | /** | ||
| 260 | * Compile: double range | ||
| 261 | * | ||
| 262 | * @param Fluent $fluent | ||
| 0 ignored issues–
                            show | |||
| 263 | * @return array | ||
| 0 ignored issues–
                            show | |||
| 264 | */ | ||
| 265 | 2 | public function compileDoubleRange(Fluent $fluent) : array | |
| 266 |     { | ||
| 267 | 2 | return $this->compileRange($fluent); | |
| 268 | } | ||
| 0 ignored issues–
                            show | |||
| 269 | |||
| 270 | /** | ||
| 271 | * Compile: date range | ||
| 272 | * | ||
| 273 | * @param Fluent $fluent | ||
| 0 ignored issues–
                            show | |||
| 274 | * @return array | ||
| 0 ignored issues–
                            show | |||
| 275 | */ | ||
| 276 | 1 | public function compileDateRange(Fluent $fluent) : array | |
| 277 |     { | ||
| 278 | 1 | return $this->compileRange($fluent); | |
| 279 | } | ||
| 0 ignored issues–
                            show | |||
| 280 | |||
| 281 | /** | ||
| 282 | * Compile: ip range | ||
| 283 | * | ||
| 284 | * @param Fluent $fluent | ||
| 0 ignored issues–
                            show | |||
| 285 | * @return array | ||
| 0 ignored issues–
                            show | |||
| 286 | */ | ||
| 287 | 1 | public function compileIpRange(Fluent $fluent) : array | |
| 288 |     { | ||
| 289 | 1 | return $this->compileRange($fluent); | |
| 290 | } | ||
| 0 ignored issues–
                            show | |||
| 291 | |||
| 292 | /** | ||
| 293 | * Compile: range | ||
| 294 | * | ||
| 295 | * @param Fluent $fluent | ||
| 0 ignored issues–
                            show | |||
| 296 | * @return array | ||
| 0 ignored issues–
                            show | |||
| 297 | */ | ||
| 298 | 7 | public function compileRange(Fluent $fluent) : array | |
| 299 |     { | ||
| 300 | 7 | return $this->formatAttributes([ | |
| 1 ignored issue–
                            show | |||
| 301 | 7 | 'type' => $fluent->type, | |
| 1 ignored issue–
                            show | |||
| 302 | 7 | 'coerce' => $fluent->coerce, | |
| 1 ignored issue–
                            show | |||
| 303 | 7 | 'boost' => $fluent->boost, | |
| 1 ignored issue–
                            show | |||
| 304 | 7 | 'index' => $fluent->index, | |
| 1 ignored issue–
                            show | |||
| 305 | 7 | 'store' => $fluent->store | |
| 1 ignored issue–
                            show | |||
| 306 | ]); | ||
| 0 ignored issues–
                            show 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... | |||
| 307 | } | ||
| 0 ignored issues–
                            show | |||
| 308 | |||
| 309 | /** | ||
| 310 | * Compile: nested | ||
| 311 | * | ||
| 312 | * @param Fluent $fluent | ||
| 0 ignored issues–
                            show | |||
| 313 | * @return array | ||
| 0 ignored issues–
                            show | |||
| 314 | */ | ||
| 315 | 2 | public function compileNested(Fluent $fluent) : array | |
| 316 |     { | ||
| 317 | 2 | return $this->formatAttributes([ | |
| 1 ignored issue–
                            show | |||
| 318 | 2 | 'type' => 'nested', | |
| 1 ignored issue–
                            show | |||
| 319 | 2 | 'dynamic' => $fluent->dynamic, | |
| 1 ignored issue–
                            show | |||
| 320 | 2 | 'properties' => $this->compileFields( | |
| 1 ignored issue–
                            show | |||
| 321 | 2 | $this->blueprintCallback( | |
| 322 | 2 | $fluent | |
| 323 | 2 | )->getFields() | |
| 324 | ) | ||
| 325 | ]); | ||
| 0 ignored issues–
                            show 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... | |||
| 326 | } | ||
| 0 ignored issues–
                            show | |||
| 327 | |||
| 328 | /** | ||
| 329 | * Compile: object | ||
| 330 | * | ||
| 331 | * @param Fluent $fluent | ||
| 0 ignored issues–
                            show | |||
| 332 | * @return array | ||
| 0 ignored issues–
                            show | |||
| 333 | */ | ||
| 334 | 2 | public function compileObject(Fluent $fluent) : array | |
| 335 |     { | ||
| 336 | 2 | return $this->formatAttributes([ | |
| 1 ignored issue–
                            show | |||
| 337 | 2 | 'type' => 'nested', | |
| 1 ignored issue–
                            show | |||
| 338 | 2 | 'dynamic' => $fluent->dynamic, | |
| 1 ignored issue–
                            show | |||
| 339 | 2 | 'enabled' => $fluent->enabled, | |
| 1 ignored issue–
                            show | |||
| 340 | 2 | 'properties' => $this->compileFields( | |
| 1 ignored issue–
                            show | |||
| 341 | 2 | $this->blueprintCallback( | |
| 342 | 2 | $fluent | |
| 343 | 2 | )->getFields() | |
| 344 | ) | ||
| 345 | ]); | ||
| 0 ignored issues–
                            show 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... | |||
| 346 | } | ||
| 0 ignored issues–
                            show | |||
| 347 | |||
| 348 | 3 | private function blueprintCallback(Fluent $fluent) : Blueprint | |
| 0 ignored issues–
                            show | |||
| 349 |     { | ||
| 350 | 3 | $blueprint = new Blueprint(); | |
| 351 | |||
| 352 | /** @var \Closure $callback */ | ||
| 0 ignored issues–
                            show | |||
| 353 | 3 | $callback = $fluent->callback; | |
| 354 | |||
| 355 | 3 |         if (is_callable($callback)) { | |
| 356 | 3 | $callback($blueprint); | |
| 357 | } | ||
| 358 | |||
| 359 | 3 | return $blueprint; | |
| 360 | } | ||
| 0 ignored issues–
                            show | |||
| 361 | |||
| 362 | /** | ||
| 363 | * Compile: geo point | ||
| 364 | * | ||
| 365 | * @param Fluent $fluent | ||
| 0 ignored issues–
                            show | |||
| 366 | * @return array | ||
| 0 ignored issues–
                            show | |||
| 367 | */ | ||
| 368 | 2 | public function compileGeoPoint(Fluent $fluent) : array | |
| 369 |     { | ||
| 370 | 2 | return $this->formatAttributes([ | |
| 1 ignored issue–
                            show | |||
| 371 | 2 | 'type' => 'geo_point', | |
| 1 ignored issue–
                            show | |||
| 372 | 2 | 'ignore_malformed' => $fluent->ignore_malformed, | |
| 1 ignored issue–
                            show | |||
| 373 | 2 | 'ignore_z_value' => $fluent->ignore_z_value, | |
| 1 ignored issue–
                            show | |||
| 374 | 2 | 'null_value' => $fluent->null_value | |
| 1 ignored issue–
                            show | |||
| 375 | ]); | ||
| 0 ignored issues–
                            show 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... | |||
| 376 | } | ||
| 0 ignored issues–
                            show | |||
| 377 | |||
| 378 | /** | ||
| 379 | * Compile: geo shape | ||
| 380 | * | ||
| 381 | * @param Fluent $fluent | ||
| 0 ignored issues–
                            show | |||
| 382 | * @return array | ||
| 0 ignored issues–
                            show | |||
| 383 | */ | ||
| 384 | 2 | public function compileGeoShape(Fluent $fluent) : array | |
| 385 |     { | ||
| 386 | 2 | return $this->formatAttributes([ | |
| 1 ignored issue–
                            show | |||
| 387 | 2 | 'type' => 'geo_shape', | |
| 1 ignored issue–
                            show | |||
| 388 | 2 | 'tree' => $fluent->tree, | |
| 1 ignored issue–
                            show | |||
| 389 | 2 | 'precision' => $fluent->precision, | |
| 1 ignored issue–
                            show | |||
| 390 | 2 | 'tree_levels' => $fluent->tree_levels, | |
| 1 ignored issue–
                            show | |||
| 391 | 2 | 'strategy' => $fluent->strategy, | |
| 1 ignored issue–
                            show | |||
| 392 | 2 | 'distance_error_pct' => $fluent->distance_error_pct, | |
| 1 ignored issue–
                            show | |||
| 393 | 2 | 'orientation' => $fluent->orientation, | |
| 1 ignored issue–
                            show | |||
| 394 | 2 | 'points_only' => $fluent->points_only, | |
| 1 ignored issue–
                            show | |||
| 395 | 2 | 'ignore_malformed' => $fluent->ignore_malformed, | |
| 1 ignored issue–
                            show | |||
| 396 | 2 | 'ignore_z_value' => $fluent->ignore_z_value | |
| 1 ignored issue–
                            show | |||
| 397 | ]); | ||
| 0 ignored issues–
                            show 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... | |||
| 398 | } | ||
| 0 ignored issues–
                            show | |||
| 399 | |||
| 400 | /** | ||
| 401 | * Compile: ip | ||
| 402 | * | ||
| 403 | * @param Fluent $fluent | ||
| 0 ignored issues–
                            show | |||
| 404 | * @return array | ||
| 0 ignored issues–
                            show | |||
| 405 | */ | ||
| 406 | 2 | public function compileIp(Fluent $fluent) : array | |
| 407 |     { | ||
| 408 | 2 | return $this->formatAttributes([ | |
| 1 ignored issue–
                            show | |||
| 409 | 2 | 'type' => 'ip', | |
| 1 ignored issue–
                            show | |||
| 410 | 2 | 'boost' => $fluent->boost, | |
| 1 ignored issue–
                            show | |||
| 411 | 2 | 'doc_values' => $fluent->doc_values, | |
| 1 ignored issue–
                            show | |||
| 412 | 2 | 'index' => $fluent->index, | |
| 1 ignored issue–
                            show | |||
| 413 | 2 | 'null_value' => $fluent->null_value, | |
| 1 ignored issue–
                            show | |||
| 414 | 2 | 'store' => $fluent->store | |
| 1 ignored issue–
                            show | |||
| 415 | ]); | ||
| 0 ignored issues–
                            show 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... | |||
| 416 | } | ||
| 0 ignored issues–
                            show | |||
| 417 | |||
| 418 | /** | ||
| 419 | * Compile: completion | ||
| 420 | * | ||
| 421 | * @param Fluent $fluent | ||
| 0 ignored issues–
                            show | |||
| 422 | * @return array | ||
| 0 ignored issues–
                            show | |||
| 423 | */ | ||
| 424 | 2 | public function compileCompletion(Fluent $fluent) : array | |
| 425 |     { | ||
| 426 | 2 | return $this->formatAttributes([ | |
| 1 ignored issue–
                            show | |||
| 427 | 2 | 'type' => 'completion', | |
| 1 ignored issue–
                            show | |||
| 428 | 2 | 'analyzer' => $fluent->analyzer, | |
| 1 ignored issue–
                            show | |||
| 429 | 2 | 'search_analyzer' => $fluent->search_analyzer, | |
| 1 ignored issue–
                            show | |||
| 430 | 2 | 'preserve_separators' => $fluent->preserve_separators, | |
| 1 ignored issue–
                            show | |||
| 431 | 2 | 'preserve_position_increments' => $fluent->preserve_position_increments, | |
| 1 ignored issue–
                            show | |||
| 432 | 2 | 'max_input_length' => $fluent->max_input_length | |
| 1 ignored issue–
                            show | |||
| 433 | ]); | ||
| 0 ignored issues–
                            show 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... | |||
| 434 | } | ||
| 0 ignored issues–
                            show | |||
| 435 | |||
| 436 | /** | ||
| 437 | * Compile: token count | ||
| 438 | * | ||
| 439 | * @param Fluent $fluent | ||
| 0 ignored issues–
                            show | |||
| 440 | * @return array | ||
| 0 ignored issues–
                            show | |||
| 441 | */ | ||
| 442 | 2 | public function compileTokenCount(Fluent $fluent) : array | |
| 443 |     { | ||
| 444 | 2 | return $this->formatAttributes([ | |
| 1 ignored issue–
                            show | |||
| 445 | 2 | 'type' => 'token_count', | |
| 1 ignored issue–
                            show | |||
| 446 | 2 | 'analyzer' => $fluent->analyzer, | |
| 1 ignored issue–
                            show | |||
| 447 | 2 | 'enable_position_increments' => $fluent->enable_position_increments, | |
| 1 ignored issue–
                            show | |||
| 448 | 2 | 'boost' => $fluent->boost, | |
| 1 ignored issue–
                            show | |||
| 449 | 2 | 'doc_values' => $fluent->doc_values, | |
| 1 ignored issue–
                            show | |||
| 450 | 2 | 'index' => $fluent->index, | |
| 1 ignored issue–
                            show | |||
| 451 | 2 | 'null_value' => $fluent->null_value, | |
| 1 ignored issue–
                            show | |||
| 452 | 2 | 'store' => $fluent->store | |
| 1 ignored issue–
                            show | |||
| 453 | ]); | ||
| 0 ignored issues–
                            show 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... | |||
| 454 | } | ||
| 0 ignored issues–
                            show | |||
| 455 | |||
| 456 | 36 | private function formatAttributes(array $attributes) : array | |
| 0 ignored issues–
                            show | |||
| 457 |     { | ||
| 458 | 36 | return array_filter($attributes); | |
| 459 | } | ||
| 0 ignored issues–
                            show | |||
| 460 | |||
| 461 | /** | ||
| 462 | * Compile fields | ||
| 463 | * | ||
| 464 | * @param array $fields | ||
| 0 ignored issues–
                            show | |||
| 465 | * @return array | ||
| 0 ignored issues–
                            show | |||
| 466 | */ | ||
| 467 | 12 | public function compileFields(array $fields) : array | |
| 468 |     { | ||
| 469 | 12 | $statements = []; | |
| 470 | |||
| 471 | 12 |         foreach ($fields as $field) { | |
| 472 | 12 |             if ($field instanceof Fluent && !is_null($field->type)) { | |
| 0 ignored issues–
                            show | |||
| 473 | 12 | $method = 'compile' . ucfirst($this->camelize($field->type)); | |
| 0 ignored issues–
                            show | |||
| 474 | 12 |                 if (method_exists($this, $method)) { | |
| 475 | 12 | $statements[$field->name] = (array)$this->$method($field); | |
| 476 | } | ||
| 477 | } | ||
| 478 | } | ||
| 479 | |||
| 480 | 12 | return $statements; | |
| 481 | } | ||
| 0 ignored issues–
                            show | |||
| 482 | |||
| 483 | 12 | private function camelize(string $input, string $separator = '_') : string | |
| 0 ignored issues–
                            show | |||
| 484 |     { | ||
| 485 | 12 | return str_replace($separator, '', ucwords($input, $separator)); | |
| 486 | } | ||
| 0 ignored issues–
                            show | |||
| 487 | } | ||
| 0 ignored issues–
                            show | |||
| 488 | 
