Complex classes like CollectionProxy 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 CollectionProxy, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 11 | class CollectionProxy extends EntityCollection implements ProxyInterface |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * Indicate if the relationship has been lazy loaded |
||
| 15 | * @var boolean |
||
| 16 | */ |
||
| 17 | protected $relationshipLoaded = false; |
||
| 18 | |||
| 19 | protected $addedItems = []; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * Create a new collection. |
||
| 23 | * |
||
| 24 | * @param mixed $entity |
||
| 25 | * @param string $relation |
||
| 26 | * |
||
| 27 | * @return void |
||
|
|
|||
| 28 | */ |
||
| 29 | public function __construct($entity, $relation) |
||
| 34 | |||
| 35 | /** |
||
| 36 | * Return Items that has been added without lady loading |
||
| 37 | * the underlying collection |
||
| 38 | * |
||
| 39 | * @return array |
||
| 40 | */ |
||
| 41 | public function getAddedItems() |
||
| 45 | |||
| 46 | /** |
||
| 47 | * Force initialization of the proxy |
||
| 48 | * |
||
| 49 | * @return bool true if the proxy could be initialized |
||
| 50 | */ |
||
| 51 | public function initializeProxy() : bool |
||
| 66 | |||
| 67 | /** |
||
| 68 | * Retrieves current initialization status of the proxy |
||
| 69 | * |
||
| 70 | * @return bool |
||
| 71 | */ |
||
| 72 | public function isProxyInitialized() : bool |
||
| 76 | |||
| 77 | /** |
||
| 78 | * Get all of the items in the collection. |
||
| 79 | * |
||
| 80 | * @return array |
||
| 81 | */ |
||
| 82 | public function all() |
||
| 88 | |||
| 89 | /** |
||
| 90 | * Get the average value of a given key. |
||
| 91 | * |
||
| 92 | * @param callable|string|null $callback |
||
| 93 | * @return mixed |
||
| 94 | */ |
||
| 95 | public function avg($callback = null) |
||
| 101 | |||
| 102 | /** |
||
| 103 | * Get the median of a given key. |
||
| 104 | * |
||
| 105 | * @param null $key |
||
| 106 | * @return mixed|null |
||
| 107 | */ |
||
| 108 | public function median($key = null) |
||
| 114 | |||
| 115 | /** |
||
| 116 | * Get the mode of a given key. |
||
| 117 | * |
||
| 118 | * @param mixed $key |
||
| 119 | * @return array |
||
| 120 | */ |
||
| 121 | public function mode($key = null) |
||
| 127 | |||
| 128 | /** |
||
| 129 | * Collapse the collection of items into a single array. |
||
| 130 | * |
||
| 131 | * @return static |
||
| 132 | */ |
||
| 133 | public function collapse() |
||
| 139 | |||
| 140 | /** |
||
| 141 | * Determine if an item exists in the collection. |
||
| 142 | * |
||
| 143 | * @param mixed $key |
||
| 144 | * @param mixed $value |
||
| 145 | * @return bool |
||
| 146 | */ |
||
| 147 | public function contains($key, $value = null) |
||
| 153 | |||
| 154 | /** |
||
| 155 | * Determine if an item exists in the collection using strict comparison. |
||
| 156 | * |
||
| 157 | * @param mixed $key |
||
| 158 | * @param mixed $value |
||
| 159 | * @return bool |
||
| 160 | */ |
||
| 161 | public function containsStrict($key, $value = null) |
||
| 167 | |||
| 168 | /** |
||
| 169 | * Get the items in the collection that are not present in the given items. |
||
| 170 | * |
||
| 171 | * @param mixed $items |
||
| 172 | * @return static |
||
| 173 | */ |
||
| 174 | public function diff($items) |
||
| 180 | |||
| 181 | /** |
||
| 182 | * Get the items in the collection whose keys are not present in the given items. |
||
| 183 | * |
||
| 184 | * @param mixed $items |
||
| 185 | * @return static |
||
| 186 | */ |
||
| 187 | public function diffKeys($items) |
||
| 193 | |||
| 194 | /** |
||
| 195 | * Execute a callback over each item. |
||
| 196 | * |
||
| 197 | * @param callable $callback |
||
| 198 | * @return $this |
||
| 199 | */ |
||
| 200 | public function each(callable $callback) |
||
| 206 | |||
| 207 | /** |
||
| 208 | * Create a new collection consisting of every n-th element. |
||
| 209 | * |
||
| 210 | * @param int $step |
||
| 211 | * @param int $offset |
||
| 212 | * @return static |
||
| 213 | */ |
||
| 214 | public function every($step, $offset = 0) |
||
| 220 | |||
| 221 | /** |
||
| 222 | * Get all items except for those with the specified keys. |
||
| 223 | * |
||
| 224 | * @param mixed $keys |
||
| 225 | * @return static |
||
| 226 | */ |
||
| 227 | public function except($keys) |
||
| 233 | |||
| 234 | /** |
||
| 235 | * Run a filter over each of the items. |
||
| 236 | * |
||
| 237 | * @param callable|null $callback |
||
| 238 | * @return static |
||
| 239 | */ |
||
| 240 | public function filter(callable $callback = null) |
||
| 246 | |||
| 247 | /** |
||
| 248 | * Filter items by the given key value pair. |
||
| 249 | * |
||
| 250 | * @param string $key |
||
| 251 | * @param mixed $operator |
||
| 252 | * @param mixed $value |
||
| 253 | * @return static |
||
| 254 | */ |
||
| 255 | public function where($key, $operator, $value = null) |
||
| 261 | |||
| 262 | /** |
||
| 263 | * Filter items by the given key value pair using strict comparison. |
||
| 264 | * |
||
| 265 | * @param string $key |
||
| 266 | * @param mixed $value |
||
| 267 | * @return static |
||
| 268 | */ |
||
| 269 | public function whereStrict($key, $value) |
||
| 275 | |||
| 276 | /** |
||
| 277 | * Filter items by the given key value pair. |
||
| 278 | * |
||
| 279 | * @param string $key |
||
| 280 | * @param mixed $values |
||
| 281 | * @param bool $strict |
||
| 282 | * @return static |
||
| 283 | */ |
||
| 284 | public function whereIn($key, $values, $strict = false) |
||
| 290 | |||
| 291 | /** |
||
| 292 | * Filter items by the given key value pair using strict comparison. |
||
| 293 | * |
||
| 294 | * @param string $key |
||
| 295 | * @param mixed $values |
||
| 296 | * @return static |
||
| 297 | */ |
||
| 298 | public function whereInStrict($key, $values) |
||
| 304 | |||
| 305 | /** |
||
| 306 | * Get the first item from the collection. |
||
| 307 | * |
||
| 308 | * @param callable|null $callback |
||
| 309 | * @param mixed $default |
||
| 310 | * @return mixed |
||
| 311 | */ |
||
| 312 | public function first(callable $callback = null, $default = null) |
||
| 319 | |||
| 320 | /** |
||
| 321 | * Get a flattened array of the items in the collection. |
||
| 322 | * |
||
| 323 | * @param int $depth |
||
| 324 | * @return static |
||
| 325 | */ |
||
| 326 | public function flatten($depth = INF) |
||
| 332 | |||
| 333 | /** |
||
| 334 | * Flip the items in the collection. |
||
| 335 | * |
||
| 336 | * @return static |
||
| 337 | */ |
||
| 338 | public function flip() |
||
| 344 | |||
| 345 | /** |
||
| 346 | * Remove an item from the collection by key. |
||
| 347 | * |
||
| 348 | * @param string|array $keys |
||
| 349 | * @return $this |
||
| 350 | */ |
||
| 351 | public function forget($keys) |
||
| 360 | |||
| 361 | /** |
||
| 362 | * Get an item from the collection by key. |
||
| 363 | * |
||
| 364 | * @param mixed $key |
||
| 365 | * @param mixed $default |
||
| 366 | * @return mixed |
||
| 367 | */ |
||
| 368 | public function get($key, $default = null) |
||
| 376 | |||
| 377 | /** |
||
| 378 | * Group an associative array by a field or using a callback. |
||
| 379 | * |
||
| 380 | * @param callable|string $groupBy |
||
| 381 | * @param bool $preserveKeys |
||
| 382 | * @return static |
||
| 383 | */ |
||
| 384 | public function groupBy($groupBy, $preserveKeys = false) |
||
| 390 | |||
| 391 | /** |
||
| 392 | * Key an associative array by a field or using a callback. |
||
| 393 | * |
||
| 394 | * @param callable|string $keyBy |
||
| 395 | * @return static |
||
| 396 | */ |
||
| 397 | public function keyBy($keyBy) |
||
| 403 | |||
| 404 | /** |
||
| 405 | * Determine if an item exists in the collection by key. |
||
| 406 | * |
||
| 407 | * @param mixed $key |
||
| 408 | * @return bool |
||
| 409 | */ |
||
| 410 | public function has($key) |
||
| 421 | |||
| 422 | /** |
||
| 423 | * Concatenate values of a given key as a string. |
||
| 424 | * |
||
| 425 | * @param string $value |
||
| 426 | * @param string $glue |
||
| 427 | * @return string |
||
| 428 | */ |
||
| 429 | public function implode($value, $glue = null) |
||
| 435 | |||
| 436 | /** |
||
| 437 | * Intersect the collection with the given items. |
||
| 438 | * |
||
| 439 | * @param mixed $items |
||
| 440 | * @return static |
||
| 441 | */ |
||
| 442 | public function intersect($items) |
||
| 448 | |||
| 449 | /** |
||
| 450 | * Determine if the collection is empty or not. |
||
| 451 | * |
||
| 452 | * @return bool |
||
| 453 | */ |
||
| 454 | public function isEmpty() |
||
| 460 | |||
| 461 | /** |
||
| 462 | * Get the keys of the collection items. |
||
| 463 | * |
||
| 464 | * @return static |
||
| 465 | */ |
||
| 466 | public function keys() |
||
| 472 | |||
| 473 | /** |
||
| 474 | * Get the last item from the collection. |
||
| 475 | * |
||
| 476 | * @param callable|null $callback |
||
| 477 | * @param mixed $default |
||
| 478 | * @return mixed |
||
| 479 | */ |
||
| 480 | public function last(callable $callback = null, $default = null) |
||
| 487 | |||
| 488 | /** |
||
| 489 | * Get the values of a given key. |
||
| 490 | * |
||
| 491 | * @param string $value |
||
| 492 | * @param string|null $key |
||
| 493 | * @return static |
||
| 494 | */ |
||
| 495 | public function pluck($value, $key = null) |
||
| 502 | |||
| 503 | /** |
||
| 504 | * Run a map over each of the items. |
||
| 505 | * |
||
| 506 | * @param callable $callback |
||
| 507 | * @return static |
||
| 508 | */ |
||
| 509 | public function map(callable $callback) |
||
| 515 | |||
| 516 | /** |
||
| 517 | * Run an associative map over each of the items. |
||
| 518 | * |
||
| 519 | * The callback should return an associative array with a single key/value pair. |
||
| 520 | * |
||
| 521 | * @param callable $callback |
||
| 522 | * @return static |
||
| 523 | */ |
||
| 524 | public function mapWithKeys(callable $callback) |
||
| 530 | |||
| 531 | /** |
||
| 532 | * Map a collection and flatten the result by a single level. |
||
| 533 | * |
||
| 534 | * @param callable $callback |
||
| 535 | * @return static |
||
| 536 | */ |
||
| 537 | public function flatMap(callable $callback) |
||
| 543 | |||
| 544 | /** |
||
| 545 | * Get the max value of a given key. |
||
| 546 | * |
||
| 547 | * @param callable|string|null $callback |
||
| 548 | * @return mixed |
||
| 549 | */ |
||
| 550 | public function max($callback = null) |
||
| 556 | |||
| 557 | /** |
||
| 558 | * Merge the collection with the given items. |
||
| 559 | * |
||
| 560 | * @param mixed $items |
||
| 561 | * @return static |
||
| 562 | */ |
||
| 563 | public function merge($items) |
||
| 572 | |||
| 573 | /** |
||
| 574 | * Create a collection by using this collection for keys and another for its values. |
||
| 575 | * |
||
| 576 | * @param mixed $values |
||
| 577 | * @return static |
||
| 578 | */ |
||
| 579 | public function combine($values) |
||
| 588 | |||
| 589 | /** |
||
| 590 | * Union the collection with the given items. |
||
| 591 | * |
||
| 592 | * @param mixed $items |
||
| 593 | * @return static |
||
| 594 | */ |
||
| 595 | public function union($items) |
||
| 604 | |||
| 605 | /** |
||
| 606 | * Get the min value of a given key. |
||
| 607 | * |
||
| 608 | * @param callable|string|null $callback |
||
| 609 | * @return mixed |
||
| 610 | */ |
||
| 611 | public function min($callback = null) |
||
| 620 | |||
| 621 | /** |
||
| 622 | * Get the items with the specified keys. |
||
| 623 | * |
||
| 624 | * @param mixed $keys |
||
| 625 | * @return static |
||
| 626 | */ |
||
| 627 | public function only($keys) |
||
| 635 | |||
| 636 | /** |
||
| 637 | * "Paginate" the collection by slicing it into a smaller collection. |
||
| 638 | * |
||
| 639 | * @param int $page |
||
| 640 | * @param int $perPage |
||
| 641 | * @return static |
||
| 642 | */ |
||
| 643 | public function forPage($page, $perPage) |
||
| 651 | |||
| 652 | /** |
||
| 653 | * Partition the collection into two arrays using the given callback or key. |
||
| 654 | * |
||
| 655 | * @param callable|string $callback |
||
| 656 | * @return static |
||
| 657 | */ |
||
| 658 | public function partition($callback) |
||
| 664 | |||
| 665 | /** |
||
| 666 | * Pass the collection to the given callback and return the result. |
||
| 667 | * |
||
| 668 | * @param callable $callback |
||
| 669 | * @return mixed |
||
| 670 | */ |
||
| 671 | public function pipe(callable $callback) |
||
| 677 | |||
| 678 | /** |
||
| 679 | * Get and remove the last item from the collection. |
||
| 680 | * |
||
| 681 | * @return mixed |
||
| 682 | */ |
||
| 683 | public function pop() |
||
| 689 | |||
| 690 | /** |
||
| 691 | * Push an item onto the beginning of the collection. |
||
| 692 | * |
||
| 693 | * @param mixed $value |
||
| 694 | * @param mixed $key |
||
| 695 | * @return $this |
||
| 696 | */ |
||
| 697 | public function prepend($value, $key = null) |
||
| 707 | |||
| 708 | /** |
||
| 709 | * Push an item onto the end of the collection. |
||
| 710 | * |
||
| 711 | * @param mixed $value |
||
| 712 | * @return $this |
||
| 713 | */ |
||
| 714 | public function push($value) |
||
| 724 | |||
| 725 | /** |
||
| 726 | * Get and remove an item from the collection. |
||
| 727 | * |
||
| 728 | * @param mixed $key |
||
| 729 | * @param mixed $default |
||
| 730 | * @return mixed |
||
| 731 | */ |
||
| 732 | public function pull($key, $default = null) |
||
| 741 | |||
| 742 | /** |
||
| 743 | * Put an item in the collection by key. |
||
| 744 | * |
||
| 745 | * @param mixed $key |
||
| 746 | * @param mixed $value |
||
| 747 | * @return $this |
||
| 748 | */ |
||
| 749 | public function put($key, $value) |
||
| 757 | |||
| 758 | /** |
||
| 759 | * Get one or more items randomly from the collection. |
||
| 760 | * |
||
| 761 | * @param int $amount |
||
| 762 | * @return mixed |
||
| 763 | * |
||
| 764 | * @throws \InvalidArgumentException |
||
| 765 | */ |
||
| 766 | public function random($amount = 1) |
||
| 776 | |||
| 777 | /** |
||
| 778 | * Reduce the collection to a single value. |
||
| 779 | * |
||
| 780 | * @param callable $callback |
||
| 781 | * @param mixed $initial |
||
| 782 | * @return mixed |
||
| 783 | */ |
||
| 784 | public function reduce(callable $callback, $initial = null) |
||
| 790 | |||
| 791 | /** |
||
| 792 | * Create a collection of all elements that do not pass a given truth test. |
||
| 793 | * |
||
| 794 | * @param callable|mixed $callback |
||
| 795 | * @return static |
||
| 796 | */ |
||
| 797 | public function reject($callback) |
||
| 803 | |||
| 804 | /** |
||
| 805 | * Reverse items order. |
||
| 806 | * |
||
| 807 | * @return static |
||
| 808 | */ |
||
| 809 | public function reverse() |
||
| 815 | |||
| 816 | /** |
||
| 817 | * Search the collection for a given value and return the corresponding key if successful. |
||
| 818 | * |
||
| 819 | * @param mixed $value |
||
| 820 | * @param bool $strict |
||
| 821 | * @return mixed |
||
| 822 | */ |
||
| 823 | public function search($value, $strict = false) |
||
| 829 | |||
| 830 | /** |
||
| 831 | * Get and remove the first item from the collection. |
||
| 832 | * |
||
| 833 | * @return mixed |
||
| 834 | */ |
||
| 835 | public function shift() |
||
| 843 | |||
| 844 | /** |
||
| 845 | * Shuffle the items in the collection. |
||
| 846 | * |
||
| 847 | * @param int $seed |
||
| 848 | * @return static |
||
| 849 | */ |
||
| 850 | public function shuffle($seed = null) |
||
| 856 | |||
| 857 | /** |
||
| 858 | * Slice the underlying collection array. |
||
| 859 | * |
||
| 860 | * @param int $offset |
||
| 861 | * @param int $length |
||
| 862 | * @return static |
||
| 863 | */ |
||
| 864 | public function slice($offset, $length = null) |
||
| 870 | |||
| 871 | /** |
||
| 872 | * Split a collection into a certain number of groups. |
||
| 873 | * |
||
| 874 | * @param int $numberOfGroups |
||
| 875 | * @return static |
||
| 876 | */ |
||
| 877 | public function split($numberOfGroups) |
||
| 883 | |||
| 884 | /** |
||
| 885 | * Chunk the underlying collection array. |
||
| 886 | * |
||
| 887 | * @param int $size |
||
| 888 | * @return static |
||
| 889 | */ |
||
| 890 | public function chunk($size) |
||
| 897 | |||
| 898 | /** |
||
| 899 | * Sort through each item with a callback. |
||
| 900 | * |
||
| 901 | * @param callable|null $callback |
||
| 902 | * @return static |
||
| 903 | */ |
||
| 904 | public function sort(callable $callback = null) |
||
| 910 | |||
| 911 | /** |
||
| 912 | * Sort the collection using the given callback. |
||
| 913 | * |
||
| 914 | * @param callable|string $callback |
||
| 915 | * @param int $options |
||
| 916 | * @param bool $descending |
||
| 917 | * @return static |
||
| 918 | */ |
||
| 919 | public function sortBy($callback, $options = SORT_REGULAR, $descending = false) |
||
| 925 | |||
| 926 | /** |
||
| 927 | * Splice a portion of the underlying collection array. |
||
| 928 | * |
||
| 929 | * @param int $offset |
||
| 930 | * @param int|null $length |
||
| 931 | * @param mixed $replacement |
||
| 932 | * @return static |
||
| 933 | */ |
||
| 934 | public function splice($offset, $length = null, $replacement = []) |
||
| 940 | |||
| 941 | /** |
||
| 942 | * Get the sum of the given values. |
||
| 943 | * |
||
| 944 | * @param callable|string|null $callback |
||
| 945 | * @return mixed |
||
| 946 | */ |
||
| 947 | public function sum($callback = null) |
||
| 953 | |||
| 954 | /** |
||
| 955 | * Take the first or last {$limit} items. |
||
| 956 | * |
||
| 957 | * @param int $limit |
||
| 958 | * @return static |
||
| 959 | */ |
||
| 960 | public function take($limit) |
||
| 967 | |||
| 968 | /** |
||
| 969 | * Transform each item in the collection using a callback. |
||
| 970 | * |
||
| 971 | * @param callable $callback |
||
| 972 | * @return $this |
||
| 973 | */ |
||
| 974 | public function transform(callable $callback) |
||
| 980 | |||
| 981 | /** |
||
| 982 | * Return only unique items from the collection array. |
||
| 983 | * |
||
| 984 | * @param string|callable|null $key |
||
| 985 | * @param bool $strict |
||
| 986 | * |
||
| 987 | * @return static |
||
| 988 | */ |
||
| 989 | public function unique($key = null, $strict = false) |
||
| 995 | |||
| 996 | /** |
||
| 997 | * Reset the keys on the underlying array. |
||
| 998 | * |
||
| 999 | * @return static |
||
| 1000 | */ |
||
| 1001 | public function values() |
||
| 1007 | |||
| 1008 | /** |
||
| 1009 | * Zip the collection together with one or more arrays. |
||
| 1010 | * |
||
| 1011 | * e.g. new Collection([1, 2, 3])->zip([4, 5, 6]); |
||
| 1012 | * => [[1, 4], [2, 5], [3, 6]] |
||
| 1013 | * |
||
| 1014 | * @param mixed ...$items |
||
| 1015 | * @return static |
||
| 1016 | */ |
||
| 1017 | public function zip($items) |
||
| 1023 | |||
| 1024 | /** |
||
| 1025 | * Get the collection of items as a plain array. |
||
| 1026 | * |
||
| 1027 | * @return array |
||
| 1028 | */ |
||
| 1029 | public function toArray() |
||
| 1039 | |||
| 1040 | /** |
||
| 1041 | * Convert the object into something JSON serializable. |
||
| 1042 | * |
||
| 1043 | * @return array |
||
| 1044 | */ |
||
| 1045 | public function jsonSerialize() |
||
| 1055 | |||
| 1056 | /** |
||
| 1057 | * Get the collection of items as JSON. |
||
| 1058 | * |
||
| 1059 | * @param int $options |
||
| 1060 | * @return string |
||
| 1061 | */ |
||
| 1062 | public function toJson($options = 0) |
||
| 1072 | |||
| 1073 | /** |
||
| 1074 | * Get an iterator for the items. |
||
| 1075 | * |
||
| 1076 | * @return \ArrayIterator |
||
| 1077 | */ |
||
| 1078 | public function getIterator() |
||
| 1084 | |||
| 1085 | /** |
||
| 1086 | * Get a CachingIterator instance. |
||
| 1087 | * |
||
| 1088 | * @param int $flags |
||
| 1089 | * @return \CachingIterator |
||
| 1090 | */ |
||
| 1091 | public function getCachingIterator($flags = CachingIterator::CALL_TOSTRING) |
||
| 1097 | |||
| 1098 | /** |
||
| 1099 | * Count the number of items in the collection. |
||
| 1100 | * |
||
| 1101 | * @return int |
||
| 1102 | */ |
||
| 1103 | public function count() |
||
| 1110 | |||
| 1111 | /** |
||
| 1112 | * Get a base Support collection instance from this collection. |
||
| 1113 | * |
||
| 1114 | * @return \Illuminate\Support\Collection |
||
| 1115 | */ |
||
| 1116 | public function toBase() |
||
| 1122 | |||
| 1123 | /** |
||
| 1124 | * Determine if an item exists at an offset. |
||
| 1125 | * |
||
| 1126 | * @param mixed $key |
||
| 1127 | * @return bool |
||
| 1128 | */ |
||
| 1129 | public function offsetExists($key) |
||
| 1137 | |||
| 1138 | /** |
||
| 1139 | * Get an item at a given offset. |
||
| 1140 | * |
||
| 1141 | * @param mixed $key |
||
| 1142 | * @return mixed |
||
| 1143 | */ |
||
| 1144 | public function offsetGet($key) |
||
| 1152 | |||
| 1153 | /** |
||
| 1154 | * Set the item at a given offset. |
||
| 1155 | * |
||
| 1156 | * @param mixed $key |
||
| 1157 | * @param mixed $value |
||
| 1158 | * @return void |
||
| 1159 | */ |
||
| 1160 | public function offsetSet($key, $value) |
||
| 1168 | |||
| 1169 | /** |
||
| 1170 | * Unset the item at a given offset. |
||
| 1171 | * |
||
| 1172 | * @param string $key |
||
| 1173 | * @return void |
||
| 1174 | */ |
||
| 1175 | public function offsetUnset($key) |
||
| 1183 | |||
| 1184 | /** |
||
| 1185 | * Dynamically handle calls to the class. |
||
| 1186 | * |
||
| 1187 | * @param string $method |
||
| 1188 | * @param array $parameters |
||
| 1189 | * @return mixed |
||
| 1190 | * |
||
| 1191 | * @throws \BadMethodCallException |
||
| 1192 | */ |
||
| 1193 | public function __call($method, $parameters) |
||
| 1199 | |||
| 1200 | } |
||
| 1201 |
Adding a
@returnannotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.