Complex classes like Schema often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use Schema, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 17 | class Schema |
||
| 18 | { |
||
| 19 | /** |
||
| 20 | * @var string |
||
| 21 | */ |
||
| 22 | protected $title; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @var string |
||
| 26 | */ |
||
| 27 | protected $description; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @var SchemaType |
||
| 31 | */ |
||
| 32 | protected $type; |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @var string |
||
| 36 | */ |
||
| 37 | protected $format; |
||
| 38 | |||
| 39 | /** |
||
| 40 | * @var Schema |
||
| 41 | */ |
||
| 42 | protected $items; |
||
| 43 | |||
| 44 | /** |
||
| 45 | * @var ArrayCollection |
||
| 46 | */ |
||
| 47 | protected $properties; |
||
| 48 | |||
| 49 | /** |
||
| 50 | * @var SchemaAdditionalProperties |
||
| 51 | */ |
||
| 52 | protected $additionalProperties; |
||
| 53 | |||
| 54 | /** |
||
| 55 | * @var string[] |
||
| 56 | */ |
||
| 57 | protected $required = []; |
||
| 58 | |||
| 59 | /** |
||
| 60 | * @var boolean |
||
| 61 | */ |
||
| 62 | protected $translatable; |
||
| 63 | |||
| 64 | /** |
||
| 65 | * @var array |
||
| 66 | */ |
||
| 67 | protected $refCollection = []; |
||
| 68 | |||
| 69 | /** |
||
| 70 | * possible event names this collection implements (queue events) |
||
| 71 | * |
||
| 72 | * @var array |
||
| 73 | */ |
||
| 74 | protected $eventNames = []; |
||
| 75 | |||
| 76 | /** |
||
| 77 | * @var bool |
||
| 78 | */ |
||
| 79 | protected $readOnly = false; |
||
| 80 | |||
| 81 | /** |
||
| 82 | * @var bool |
||
| 83 | */ |
||
| 84 | protected $recordOriginModifiable; |
||
| 85 | |||
| 86 | /** |
||
| 87 | * @var bool |
||
| 88 | */ |
||
| 89 | protected $recordOriginException; |
||
| 90 | |||
| 91 | /** |
||
| 92 | * @var string[] |
||
| 93 | */ |
||
| 94 | protected $searchable = []; |
||
| 95 | |||
| 96 | /** |
||
| 97 | * @var int |
||
| 98 | */ |
||
| 99 | protected $minLength; |
||
| 100 | |||
| 101 | /** |
||
| 102 | * @var int |
||
| 103 | */ |
||
| 104 | protected $maxLength; |
||
| 105 | |||
| 106 | /** |
||
| 107 | * @var int |
||
| 108 | */ |
||
| 109 | protected $minItems; |
||
| 110 | |||
| 111 | /** |
||
| 112 | * @var int |
||
| 113 | */ |
||
| 114 | protected $maxItems; |
||
| 115 | |||
| 116 | /** |
||
| 117 | * @var float |
||
| 118 | */ |
||
| 119 | protected $numericMinimum; |
||
| 120 | |||
| 121 | /** |
||
| 122 | * @var float |
||
| 123 | */ |
||
| 124 | protected $numericMaximum; |
||
| 125 | |||
| 126 | /** |
||
| 127 | * @var SchemaEnum |
||
| 128 | */ |
||
| 129 | protected $enum; |
||
| 130 | |||
| 131 | /** |
||
| 132 | * @var string |
||
| 133 | */ |
||
| 134 | protected $regexPattern; |
||
| 135 | |||
| 136 | /** |
||
| 137 | * @var string |
||
| 138 | */ |
||
| 139 | protected $documentClass; |
||
| 140 | |||
| 141 | /** |
||
| 142 | * @var array<string> |
||
| 143 | */ |
||
| 144 | protected $constraints; |
||
| 145 | |||
| 146 | /** |
||
| 147 | * @var array<string> |
||
| 148 | */ |
||
| 149 | protected $textIndexes; |
||
| 150 | |||
| 151 | /** |
||
| 152 | * these are the BSON primitive types. |
||
| 153 | * http://json-schema.org/latest/json-schema-core.html#anchor8 |
||
| 154 | * every type set *not* in this set will be carried over to 'format' |
||
| 155 | * |
||
| 156 | * @var string[] |
||
| 157 | */ |
||
| 158 | protected $primitiveTypes = [ |
||
| 159 | 'array', |
||
| 160 | 'boolean', |
||
| 161 | 'integer', |
||
| 162 | 'number', |
||
| 163 | 'null', |
||
| 164 | 'object', |
||
| 165 | 'string' |
||
| 166 | ]; |
||
| 167 | |||
| 168 | /** |
||
| 169 | * those are types that when they are required, a minimal length |
||
| 170 | * shall be specified in schema (or allow null if not required; that will lead |
||
| 171 | * to the inclusion of "null" in the "type" property array) |
||
| 172 | * |
||
| 173 | * @var array |
||
| 174 | */ |
||
| 175 | protected $minLengthTypes = [ |
||
| 176 | 'integer', |
||
| 177 | 'number', |
||
| 178 | 'float', |
||
| 179 | 'double', |
||
| 180 | 'decimal', |
||
| 181 | 'string', |
||
| 182 | 'date', |
||
| 183 | 'extref' |
||
| 184 | ]; |
||
| 185 | |||
| 186 | /** |
||
| 187 | * known non-primitive types we map to primitives here. |
||
| 188 | * the type itself is set to the format. |
||
| 189 | * |
||
| 190 | * @var string[] |
||
| 191 | */ |
||
| 192 | protected $specialTypeMapping = [ |
||
| 193 | 'extref' => 'string', |
||
| 194 | 'translatable' => 'object', |
||
| 195 | 'date' => 'string', |
||
| 196 | 'float' => 'number', |
||
| 197 | 'double' => 'number', |
||
| 198 | 'decimal' => 'number' |
||
| 199 | ]; |
||
| 200 | |||
| 201 | protected $formatOverrides = [ |
||
| 202 | 'date' => 'date-time' |
||
| 203 | ]; |
||
| 204 | |||
| 205 | /** |
||
| 206 | * Build properties |
||
| 207 | */ |
||
| 208 | 2 | public function __construct() |
|
| 212 | |||
| 213 | /** |
||
| 214 | * set title |
||
| 215 | * |
||
| 216 | * @param string $title title |
||
| 217 | * |
||
| 218 | * @return void |
||
| 219 | */ |
||
| 220 | 2 | public function setTitle($title) |
|
| 224 | |||
| 225 | /** |
||
| 226 | * get title |
||
| 227 | * |
||
| 228 | * @return string |
||
| 229 | */ |
||
| 230 | 2 | public function getTitle() |
|
| 234 | |||
| 235 | /** |
||
| 236 | * set description |
||
| 237 | * |
||
| 238 | * @param string $description description |
||
| 239 | * |
||
| 240 | * @return void |
||
| 241 | */ |
||
| 242 | public function setDescription($description) |
||
| 246 | |||
| 247 | /** |
||
| 248 | * get description |
||
| 249 | * |
||
| 250 | * @return string |
||
| 251 | */ |
||
| 252 | public function getDescription() |
||
| 256 | |||
| 257 | /** |
||
| 258 | * set type |
||
| 259 | * |
||
| 260 | * @param string|array $types types |
||
| 261 | * |
||
| 262 | * @return void |
||
| 263 | */ |
||
| 264 | public function setType($types) |
||
| 265 | { |
||
| 266 | if (!is_array($types)) { |
||
| 267 | $types = [$types]; |
||
| 268 | } |
||
| 269 | |||
| 270 | $typesToSet = []; |
||
| 271 | foreach ($types as $type) { |
||
| 272 | if ($type === 'int') { |
||
| 273 | $type = 'integer'; |
||
| 274 | } |
||
| 275 | if ($type === 'hash') { |
||
| 276 | $type = 'object'; |
||
| 277 | } |
||
| 278 | |||
| 279 | // handle non-primitive types |
||
| 280 | if (!in_array($type, $this->primitiveTypes)) { |
||
| 281 | $setType = 'string'; |
||
| 282 | if (isset($this->specialTypeMapping[$type])) { |
||
| 283 | $setType = $this->specialTypeMapping[$type]; |
||
| 284 | } |
||
| 285 | $typesToSet[] = $setType; |
||
| 286 | |||
| 287 | if (isset($this->formatOverrides[$type])) { |
||
| 288 | $type = $this->formatOverrides[$type]; |
||
| 289 | } |
||
| 290 | |||
| 291 | $this->setFormat($type); |
||
| 292 | } else { |
||
| 293 | $typesToSet[] = $type; |
||
| 294 | } |
||
| 295 | } |
||
| 296 | |||
| 297 | $this->type = new SchemaType($typesToSet); |
||
| 298 | } |
||
| 299 | |||
| 300 | /** |
||
| 301 | * get type |
||
| 302 | * |
||
| 303 | * @return SchemaType type |
||
| 304 | */ |
||
| 305 | public function getType() |
||
| 309 | |||
| 310 | /** |
||
| 311 | * get MinLengthTypes |
||
| 312 | * |
||
| 313 | * @return array MinLengthTypes |
||
| 314 | */ |
||
| 315 | public function getMinLengthTypes() |
||
| 316 | { |
||
| 317 | return $this->minLengthTypes; |
||
| 318 | } |
||
| 319 | |||
| 320 | /** |
||
| 321 | * get format |
||
| 322 | * |
||
| 323 | * @return string format |
||
| 324 | */ |
||
| 325 | public function getFormat() |
||
| 326 | { |
||
| 327 | return $this->format; |
||
| 328 | } |
||
| 329 | |||
| 330 | /** |
||
| 331 | * sets format |
||
| 332 | * |
||
| 333 | * @param string $format format |
||
| 334 | * |
||
| 335 | * @return void |
||
| 336 | */ |
||
| 337 | public function setFormat($format) |
||
| 338 | { |
||
| 339 | $this->format = $format; |
||
| 340 | } |
||
| 341 | |||
| 342 | /** |
||
| 343 | * get numeric minimum |
||
| 344 | * |
||
| 345 | * @return float numeric minimum |
||
| 346 | */ |
||
| 347 | public function getNumericMinimum() |
||
| 348 | { |
||
| 349 | return $this->numericMinimum; |
||
| 350 | } |
||
| 351 | |||
| 352 | /** |
||
| 353 | * set numeric minimum |
||
| 354 | * |
||
| 355 | * @param float $numericMinimum numeric mimimum |
||
| 356 | * |
||
| 357 | * @return void |
||
| 358 | */ |
||
| 359 | public function setNumericMinimum($numericMinimum) |
||
| 360 | { |
||
| 361 | $this->numericMinimum = $numericMinimum; |
||
| 362 | } |
||
| 363 | |||
| 364 | /** |
||
| 365 | * get numeric maximum |
||
| 366 | * |
||
| 367 | * @return float numeric maximum |
||
| 368 | */ |
||
| 369 | public function getNumericMaximum() |
||
| 370 | { |
||
| 371 | return $this->numericMaximum; |
||
| 372 | } |
||
| 373 | |||
| 374 | /** |
||
| 375 | * set numeric maximum |
||
| 376 | * |
||
| 377 | * @param float $numericMaximum maximum |
||
| 378 | * |
||
| 379 | * @return void |
||
| 380 | */ |
||
| 381 | public function setNumericMaximum($numericMaximum) |
||
| 382 | { |
||
| 383 | $this->numericMaximum = $numericMaximum; |
||
| 384 | } |
||
| 385 | |||
| 386 | /** |
||
| 387 | * set min length |
||
| 388 | * |
||
| 389 | * @return int length |
||
| 390 | */ |
||
| 391 | public function getMinLength() |
||
| 392 | { |
||
| 393 | return $this->minLength; |
||
| 394 | } |
||
| 395 | |||
| 396 | /** |
||
| 397 | * get min length |
||
| 398 | * |
||
| 399 | * @param int $minLength length |
||
| 400 | * |
||
| 401 | * @return void |
||
| 402 | */ |
||
| 403 | public function setMinLength($minLength) |
||
| 404 | { |
||
| 405 | $this->minLength = $minLength; |
||
| 406 | } |
||
| 407 | |||
| 408 | /** |
||
| 409 | * gets maxlength |
||
| 410 | * |
||
| 411 | * @return int length |
||
| 412 | */ |
||
| 413 | public function getMaxLength() |
||
| 414 | { |
||
| 415 | return $this->maxLength; |
||
| 416 | } |
||
| 417 | |||
| 418 | /** |
||
| 419 | * set maxlength |
||
| 420 | * |
||
| 421 | * @param int $maxLength length |
||
| 422 | * |
||
| 423 | * @return void |
||
| 424 | */ |
||
| 425 | public function setMaxLength($maxLength) |
||
| 426 | { |
||
| 427 | $this->maxLength = $maxLength; |
||
| 428 | } |
||
| 429 | |||
| 430 | /** |
||
| 431 | * set min Items |
||
| 432 | * |
||
| 433 | * @return int Items |
||
| 434 | */ |
||
| 435 | public function getMinItems() |
||
| 436 | { |
||
| 437 | return $this->minItems; |
||
| 438 | } |
||
| 439 | |||
| 440 | /** |
||
| 441 | * get min Items |
||
| 442 | * |
||
| 443 | * @param int $minItems length |
||
| 444 | * |
||
| 445 | * @return void |
||
| 446 | */ |
||
| 447 | public function setMinItems($minItems) |
||
| 448 | { |
||
| 449 | $this->minItems = $minItems; |
||
| 450 | } |
||
| 451 | |||
| 452 | /** |
||
| 453 | * gets maxItems |
||
| 454 | * |
||
| 455 | * @return int Items |
||
| 456 | */ |
||
| 457 | public function getMaxItems() |
||
| 458 | { |
||
| 459 | return $this->maxItems; |
||
| 460 | } |
||
| 461 | |||
| 462 | /** |
||
| 463 | * set maxItems |
||
| 464 | * |
||
| 465 | * @param int $maxItems Items |
||
| 466 | * |
||
| 467 | * @return void |
||
| 468 | */ |
||
| 469 | public function setMaxItems($maxItems) |
||
| 470 | { |
||
| 471 | $this->maxItems = $maxItems; |
||
| 472 | } |
||
| 473 | |||
| 474 | /** |
||
| 475 | * get Enum |
||
| 476 | * |
||
| 477 | * @return array Enum |
||
|
|
|||
| 478 | */ |
||
| 479 | public function getEnum() |
||
| 480 | { |
||
| 481 | return $this->enum; |
||
| 482 | } |
||
| 483 | |||
| 484 | /** |
||
| 485 | * set Enum |
||
| 486 | * |
||
| 487 | * @param array $enum enum |
||
| 488 | * |
||
| 489 | * @return void |
||
| 490 | */ |
||
| 491 | public function setEnum(array $enum) |
||
| 492 | { |
||
| 493 | $this->enum = new SchemaEnum($enum); |
||
| 494 | } |
||
| 495 | |||
| 496 | /** |
||
| 497 | * get regex pattern |
||
| 498 | * |
||
| 499 | * @return string pattern |
||
| 500 | */ |
||
| 501 | public function getRegexPattern() |
||
| 502 | { |
||
| 503 | return $this->regexPattern; |
||
| 504 | } |
||
| 505 | |||
| 506 | /** |
||
| 507 | * set regex pattern |
||
| 508 | * |
||
| 509 | * @param string $regexPattern regex pattern |
||
| 510 | * |
||
| 511 | * @return void |
||
| 512 | */ |
||
| 513 | public function setRegexPattern($regexPattern) |
||
| 514 | { |
||
| 515 | $this->regexPattern = $regexPattern; |
||
| 516 | } |
||
| 517 | |||
| 518 | /** |
||
| 519 | * get DocumentClass |
||
| 520 | * |
||
| 521 | * @return string DocumentClass |
||
| 522 | */ |
||
| 523 | public function getDocumentClass() |
||
| 524 | { |
||
| 525 | return $this->documentClass; |
||
| 526 | } |
||
| 527 | |||
| 528 | /** |
||
| 529 | * set DocumentClass |
||
| 530 | * |
||
| 531 | * @param string $documentClass documentClass |
||
| 532 | * |
||
| 533 | * @return void |
||
| 534 | */ |
||
| 535 | public function setDocumentClass($documentClass) |
||
| 536 | { |
||
| 537 | $this->documentClass = $documentClass; |
||
| 538 | } |
||
| 539 | |||
| 540 | /** |
||
| 541 | * get Constraints |
||
| 542 | * |
||
| 543 | * @return mixed Constraints |
||
| 544 | */ |
||
| 545 | public function getConstraints() |
||
| 546 | { |
||
| 547 | return $this->constraints; |
||
| 548 | } |
||
| 549 | |||
| 550 | /** |
||
| 551 | * set Constraints |
||
| 552 | * |
||
| 553 | * @param mixed $constraints constraints |
||
| 554 | * |
||
| 555 | * @return void |
||
| 556 | */ |
||
| 557 | public function setConstraints($constraints) |
||
| 558 | { |
||
| 559 | $this->constraints = $constraints; |
||
| 560 | } |
||
| 561 | |||
| 562 | /** |
||
| 563 | * add a constraint |
||
| 564 | * |
||
| 565 | * @param string $name constraint name |
||
| 566 | * |
||
| 567 | * @return void |
||
| 568 | */ |
||
| 569 | public function addConstraint($name) |
||
| 570 | { |
||
| 571 | $this->constraints[] = $name; |
||
| 572 | } |
||
| 573 | |||
| 574 | /** |
||
| 575 | * set items |
||
| 576 | * |
||
| 577 | * @param Schema $items items schema |
||
| 578 | * |
||
| 579 | * @return void |
||
| 580 | */ |
||
| 581 | public function setItems($items) |
||
| 585 | |||
| 586 | /** |
||
| 587 | * get items |
||
| 588 | * |
||
| 589 | * @return Schema |
||
| 590 | */ |
||
| 591 | public function getItems() |
||
| 595 | |||
| 596 | /** |
||
| 597 | * add a property |
||
| 598 | * |
||
| 599 | * @param string $name property name |
||
| 600 | * @param Schema $property property |
||
| 601 | * |
||
| 602 | * @return void |
||
| 603 | */ |
||
| 604 | public function addProperty($name, $property) |
||
| 608 | |||
| 609 | /** |
||
| 610 | * removes a property |
||
| 611 | * |
||
| 612 | * @param string $name property name |
||
| 613 | * |
||
| 614 | * @return void |
||
| 615 | */ |
||
| 616 | public function removeProperty($name) |
||
| 622 | |||
| 623 | /** |
||
| 624 | * returns a property |
||
| 625 | * |
||
| 626 | * @param string $name property name |
||
| 627 | * |
||
| 628 | * @return null|Schema property |
||
| 629 | */ |
||
| 630 | public function getProperty($name = null) |
||
| 631 | { |
||
| 632 | if (is_null($name)) { |
||
| 633 | return null; |
||
| 634 | } |
||
| 635 | return $this->properties->get($name); |
||
| 636 | } |
||
| 637 | |||
| 638 | /** |
||
| 639 | * get properties |
||
| 640 | * |
||
| 641 | * @return ArrayCollection|null |
||
| 642 | */ |
||
| 643 | public function getProperties() |
||
| 644 | { |
||
| 645 | if ($this->properties->isEmpty()) { |
||
| 646 | return null; |
||
| 647 | } else { |
||
| 648 | return $this->properties; |
||
| 651 | |||
| 652 | /** |
||
| 653 | * set additionalProperties on schema |
||
| 654 | * |
||
| 655 | * @param SchemaAdditionalProperties $additionalProperties additional properties |
||
| 656 | * |
||
| 657 | * @return void |
||
| 658 | */ |
||
| 659 | public function setAdditionalProperties(SchemaAdditionalProperties $additionalProperties) |
||
| 663 | |||
| 664 | /** |
||
| 665 | * get addtionalProperties for schema |
||
| 666 | * |
||
| 667 | * @return SchemaAdditionalProperties |
||
| 668 | */ |
||
| 669 | public function getAdditionalProperties() |
||
| 673 | |||
| 674 | /** |
||
| 675 | * set required variables |
||
| 676 | * |
||
| 677 | * @param string[] $required array of required fields |
||
| 678 | * |
||
| 679 | * @return void |
||
| 680 | */ |
||
| 681 | public function setRequired(array $required) |
||
| 686 | |||
| 687 | /** |
||
| 688 | * get required fields |
||
| 689 | * |
||
| 690 | * @return string[]|null |
||
| 691 | */ |
||
| 692 | public function getRequired() |
||
| 701 | |||
| 702 | /** |
||
| 703 | * set translatable flag |
||
| 704 | * |
||
| 705 | * This flag is a local extension to json schema. |
||
| 706 | * |
||
| 707 | * @param boolean $translatable translatable flag |
||
| 708 | * |
||
| 709 | * @return void |
||
| 710 | */ |
||
| 711 | public function setTranslatable($translatable) |
||
| 719 | |||
| 720 | /** |
||
| 721 | * get translatable flag |
||
| 722 | * |
||
| 723 | * @return boolean |
||
| 724 | */ |
||
| 725 | public function isTranslatable() |
||
| 734 | |||
| 735 | /** |
||
| 736 | * set a array of urls that can extref refer to |
||
| 737 | * |
||
| 738 | * @param array $refCollection urls |
||
| 739 | * |
||
| 740 | * @return void |
||
| 741 | */ |
||
| 742 | public function setRefCollection(array $refCollection) |
||
| 746 | |||
| 747 | /** |
||
| 748 | * get a collection of urls that can extref refer to |
||
| 749 | * |
||
| 750 | * @return array |
||
| 751 | */ |
||
| 752 | public function getRefCollection() |
||
| 761 | |||
| 762 | /** |
||
| 763 | * set an array of possible event names |
||
| 764 | * |
||
| 765 | * @param array $eventNames event names |
||
| 766 | * |
||
| 767 | * @return void |
||
| 768 | */ |
||
| 769 | public function setEventNames(array $eventNames) |
||
| 773 | |||
| 774 | /** |
||
| 775 | * get a collection of possible event names |
||
| 776 | * |
||
| 777 | * @return array |
||
| 778 | */ |
||
| 779 | public function getEventNames() |
||
| 788 | |||
| 789 | /** |
||
| 790 | * Set the readOnly flag |
||
| 791 | * |
||
| 792 | * @param bool $readOnly ReadOnly flag |
||
| 793 | * |
||
| 794 | * @return void |
||
| 795 | */ |
||
| 796 | public function setReadOnly($readOnly) |
||
| 800 | |||
| 801 | /** |
||
| 802 | * Get the readOnly flag. |
||
| 803 | * Returns null if the flag is set to false so the serializer will ignore it. |
||
| 804 | * |
||
| 805 | * @return bool|null true if readOnly isset to true or null if not |
||
| 806 | */ |
||
| 807 | public function getReadOnly() |
||
| 811 | |||
| 812 | /** |
||
| 813 | * get RecordOriginModifiable |
||
| 814 | * |
||
| 815 | * @return boolean RecordOriginModifiable |
||
| 816 | */ |
||
| 817 | public function isRecordOriginModifiable() |
||
| 821 | |||
| 822 | /** |
||
| 823 | * set RecordOriginModifiable |
||
| 824 | * |
||
| 825 | * @param boolean $recordOriginModifiable recordOriginModifiable |
||
| 826 | * |
||
| 827 | * @return void |
||
| 828 | */ |
||
| 829 | public function setRecordOriginModifiable($recordOriginModifiable) |
||
| 833 | |||
| 834 | /** |
||
| 835 | * get RecordOriginException |
||
| 836 | * |
||
| 837 | * @return boolean RecordOriginException |
||
| 838 | */ |
||
| 839 | public function isRecordOriginException() |
||
| 843 | |||
| 844 | /** |
||
| 845 | * set RecordOriginException |
||
| 846 | * |
||
| 847 | * @param boolean $recordOriginException recordOriginException |
||
| 848 | * |
||
| 849 | * @return void |
||
| 850 | */ |
||
| 851 | public function setRecordOriginException($recordOriginException) |
||
| 855 | |||
| 856 | /** |
||
| 857 | * set searchable variables |
||
| 858 | * |
||
| 859 | * @param string[] $searchable array of searchable fields |
||
| 860 | * |
||
| 861 | * @return void |
||
| 862 | */ |
||
| 863 | public function setSearchable($searchable) |
||
| 867 | |||
| 868 | /** |
||
| 869 | * get searchable fields |
||
| 870 | * |
||
| 871 | * @return string[]|null |
||
| 872 | */ |
||
| 873 | public function getSearchable() |
||
| 880 | |||
| 881 | /** |
||
| 882 | * @return array |
||
| 883 | */ |
||
| 884 | public function getTextIndexes() |
||
| 888 | |||
| 889 | /** |
||
| 890 | * get textIndexes fields |
||
| 891 | * |
||
| 892 | * @param array $textIndexes Data array of special text search values |
||
| 893 | * |
||
| 894 | * @return void |
||
| 895 | */ |
||
| 896 | public function setTextIndexes($textIndexes) |
||
| 900 | } |
||
| 901 |
This check compares the return type specified in the
@returnannotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.