Enumerable.php 24 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027
  1. <?php
  2. namespace Illuminate\Support;
  3. use Countable;
  4. use Illuminate\Contracts\Support\Arrayable;
  5. use Illuminate\Contracts\Support\Jsonable;
  6. use IteratorAggregate;
  7. use JsonSerializable;
  8. interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable, JsonSerializable
  9. {
  10. /**
  11. * Create a new collection instance if the value isn't one already.
  12. *
  13. * @param mixed $items
  14. * @return static
  15. */
  16. public static function make($items = []);
  17. /**
  18. * Create a new instance by invoking the callback a given amount of times.
  19. *
  20. * @param int $number
  21. * @param callable|null $callback
  22. * @return static
  23. */
  24. public static function times($number, callable $callback = null);
  25. /**
  26. * Create a collection with the given range.
  27. *
  28. * @param int $from
  29. * @param int $to
  30. * @return static
  31. */
  32. public static function range($from, $to);
  33. /**
  34. * Wrap the given value in a collection if applicable.
  35. *
  36. * @param mixed $value
  37. * @return static
  38. */
  39. public static function wrap($value);
  40. /**
  41. * Get the underlying items from the given collection if applicable.
  42. *
  43. * @param array|static $value
  44. * @return array
  45. */
  46. public static function unwrap($value);
  47. /**
  48. * Create a new instance with no items.
  49. *
  50. * @return static
  51. */
  52. public static function empty();
  53. /**
  54. * Get all items in the enumerable.
  55. *
  56. * @return array
  57. */
  58. public function all();
  59. /**
  60. * Alias for the "avg" method.
  61. *
  62. * @param callable|string|null $callback
  63. * @return mixed
  64. */
  65. public function average($callback = null);
  66. /**
  67. * Get the median of a given key.
  68. *
  69. * @param string|array|null $key
  70. * @return mixed
  71. */
  72. public function median($key = null);
  73. /**
  74. * Get the mode of a given key.
  75. *
  76. * @param string|array|null $key
  77. * @return array|null
  78. */
  79. public function mode($key = null);
  80. /**
  81. * Collapse the items into a single enumerable.
  82. *
  83. * @return static
  84. */
  85. public function collapse();
  86. /**
  87. * Alias for the "contains" method.
  88. *
  89. * @param mixed $key
  90. * @param mixed $operator
  91. * @param mixed $value
  92. * @return bool
  93. */
  94. public function some($key, $operator = null, $value = null);
  95. /**
  96. * Determine if an item exists, using strict comparison.
  97. *
  98. * @param mixed $key
  99. * @param mixed $value
  100. * @return bool
  101. */
  102. public function containsStrict($key, $value = null);
  103. /**
  104. * Get the average value of a given key.
  105. *
  106. * @param callable|string|null $callback
  107. * @return mixed
  108. */
  109. public function avg($callback = null);
  110. /**
  111. * Determine if an item exists in the enumerable.
  112. *
  113. * @param mixed $key
  114. * @param mixed $operator
  115. * @param mixed $value
  116. * @return bool
  117. */
  118. public function contains($key, $operator = null, $value = null);
  119. /**
  120. * Cross join with the given lists, returning all possible permutations.
  121. *
  122. * @param mixed ...$lists
  123. * @return static
  124. */
  125. public function crossJoin(...$lists);
  126. /**
  127. * Dump the collection and end the script.
  128. *
  129. * @param mixed ...$args
  130. * @return void
  131. */
  132. public function dd(...$args);
  133. /**
  134. * Dump the collection.
  135. *
  136. * @return $this
  137. */
  138. public function dump();
  139. /**
  140. * Get the items that are not present in the given items.
  141. *
  142. * @param mixed $items
  143. * @return static
  144. */
  145. public function diff($items);
  146. /**
  147. * Get the items that are not present in the given items, using the callback.
  148. *
  149. * @param mixed $items
  150. * @param callable $callback
  151. * @return static
  152. */
  153. public function diffUsing($items, callable $callback);
  154. /**
  155. * Get the items whose keys and values are not present in the given items.
  156. *
  157. * @param mixed $items
  158. * @return static
  159. */
  160. public function diffAssoc($items);
  161. /**
  162. * Get the items whose keys and values are not present in the given items, using the callback.
  163. *
  164. * @param mixed $items
  165. * @param callable $callback
  166. * @return static
  167. */
  168. public function diffAssocUsing($items, callable $callback);
  169. /**
  170. * Get the items whose keys are not present in the given items.
  171. *
  172. * @param mixed $items
  173. * @return static
  174. */
  175. public function diffKeys($items);
  176. /**
  177. * Get the items whose keys are not present in the given items, using the callback.
  178. *
  179. * @param mixed $items
  180. * @param callable $callback
  181. * @return static
  182. */
  183. public function diffKeysUsing($items, callable $callback);
  184. /**
  185. * Retrieve duplicate items.
  186. *
  187. * @param callable|string|null $callback
  188. * @param bool $strict
  189. * @return static
  190. */
  191. public function duplicates($callback = null, $strict = false);
  192. /**
  193. * Retrieve duplicate items using strict comparison.
  194. *
  195. * @param callable|string|null $callback
  196. * @return static
  197. */
  198. public function duplicatesStrict($callback = null);
  199. /**
  200. * Execute a callback over each item.
  201. *
  202. * @param callable $callback
  203. * @return $this
  204. */
  205. public function each(callable $callback);
  206. /**
  207. * Execute a callback over each nested chunk of items.
  208. *
  209. * @param callable $callback
  210. * @return static
  211. */
  212. public function eachSpread(callable $callback);
  213. /**
  214. * Determine if all items pass the given truth test.
  215. *
  216. * @param string|callable $key
  217. * @param mixed $operator
  218. * @param mixed $value
  219. * @return bool
  220. */
  221. public function every($key, $operator = null, $value = null);
  222. /**
  223. * Get all items except for those with the specified keys.
  224. *
  225. * @param mixed $keys
  226. * @return static
  227. */
  228. public function except($keys);
  229. /**
  230. * Run a filter over each of the items.
  231. *
  232. * @param callable|null $callback
  233. * @return static
  234. */
  235. public function filter(callable $callback = null);
  236. /**
  237. * Apply the callback if the value is truthy.
  238. *
  239. * @param bool $value
  240. * @param callable $callback
  241. * @param callable|null $default
  242. * @return static|mixed
  243. */
  244. public function when($value, callable $callback, callable $default = null);
  245. /**
  246. * Apply the callback if the collection is empty.
  247. *
  248. * @param callable $callback
  249. * @param callable|null $default
  250. * @return static|mixed
  251. */
  252. public function whenEmpty(callable $callback, callable $default = null);
  253. /**
  254. * Apply the callback if the collection is not empty.
  255. *
  256. * @param callable $callback
  257. * @param callable|null $default
  258. * @return static|mixed
  259. */
  260. public function whenNotEmpty(callable $callback, callable $default = null);
  261. /**
  262. * Apply the callback if the value is falsy.
  263. *
  264. * @param bool $value
  265. * @param callable $callback
  266. * @param callable|null $default
  267. * @return static|mixed
  268. */
  269. public function unless($value, callable $callback, callable $default = null);
  270. /**
  271. * Apply the callback unless the collection is empty.
  272. *
  273. * @param callable $callback
  274. * @param callable|null $default
  275. * @return static|mixed
  276. */
  277. public function unlessEmpty(callable $callback, callable $default = null);
  278. /**
  279. * Apply the callback unless the collection is not empty.
  280. *
  281. * @param callable $callback
  282. * @param callable|null $default
  283. * @return static|mixed
  284. */
  285. public function unlessNotEmpty(callable $callback, callable $default = null);
  286. /**
  287. * Filter items by the given key value pair.
  288. *
  289. * @param string $key
  290. * @param mixed $operator
  291. * @param mixed $value
  292. * @return static
  293. */
  294. public function where($key, $operator = null, $value = null);
  295. /**
  296. * Filter items where the value for the given key is null.
  297. *
  298. * @param string|null $key
  299. * @return static
  300. */
  301. public function whereNull($key = null);
  302. /**
  303. * Filter items where the value for the given key is not null.
  304. *
  305. * @param string|null $key
  306. * @return static
  307. */
  308. public function whereNotNull($key = null);
  309. /**
  310. * Filter items by the given key value pair using strict comparison.
  311. *
  312. * @param string $key
  313. * @param mixed $value
  314. * @return static
  315. */
  316. public function whereStrict($key, $value);
  317. /**
  318. * Filter items by the given key value pair.
  319. *
  320. * @param string $key
  321. * @param mixed $values
  322. * @param bool $strict
  323. * @return static
  324. */
  325. public function whereIn($key, $values, $strict = false);
  326. /**
  327. * Filter items by the given key value pair using strict comparison.
  328. *
  329. * @param string $key
  330. * @param mixed $values
  331. * @return static
  332. */
  333. public function whereInStrict($key, $values);
  334. /**
  335. * Filter items such that the value of the given key is between the given values.
  336. *
  337. * @param string $key
  338. * @param array $values
  339. * @return static
  340. */
  341. public function whereBetween($key, $values);
  342. /**
  343. * Filter items such that the value of the given key is not between the given values.
  344. *
  345. * @param string $key
  346. * @param array $values
  347. * @return static
  348. */
  349. public function whereNotBetween($key, $values);
  350. /**
  351. * Filter items by the given key value pair.
  352. *
  353. * @param string $key
  354. * @param mixed $values
  355. * @param bool $strict
  356. * @return static
  357. */
  358. public function whereNotIn($key, $values, $strict = false);
  359. /**
  360. * Filter items by the given key value pair using strict comparison.
  361. *
  362. * @param string $key
  363. * @param mixed $values
  364. * @return static
  365. */
  366. public function whereNotInStrict($key, $values);
  367. /**
  368. * Filter the items, removing any items that don't match the given type(s).
  369. *
  370. * @param string|string[] $type
  371. * @return static
  372. */
  373. public function whereInstanceOf($type);
  374. /**
  375. * Get the first item from the enumerable passing the given truth test.
  376. *
  377. * @param callable|null $callback
  378. * @param mixed $default
  379. * @return mixed
  380. */
  381. public function first(callable $callback = null, $default = null);
  382. /**
  383. * Get the first item by the given key value pair.
  384. *
  385. * @param string $key
  386. * @param mixed $operator
  387. * @param mixed $value
  388. * @return mixed
  389. */
  390. public function firstWhere($key, $operator = null, $value = null);
  391. /**
  392. * Get a flattened array of the items in the collection.
  393. *
  394. * @param int $depth
  395. * @return static
  396. */
  397. public function flatten($depth = INF);
  398. /**
  399. * Flip the values with their keys.
  400. *
  401. * @return static
  402. */
  403. public function flip();
  404. /**
  405. * Get an item from the collection by key.
  406. *
  407. * @param mixed $key
  408. * @param mixed $default
  409. * @return mixed
  410. */
  411. public function get($key, $default = null);
  412. /**
  413. * Group an associative array by a field or using a callback.
  414. *
  415. * @param array|callable|string $groupBy
  416. * @param bool $preserveKeys
  417. * @return static
  418. */
  419. public function groupBy($groupBy, $preserveKeys = false);
  420. /**
  421. * Key an associative array by a field or using a callback.
  422. *
  423. * @param callable|string $keyBy
  424. * @return static
  425. */
  426. public function keyBy($keyBy);
  427. /**
  428. * Determine if an item exists in the collection by key.
  429. *
  430. * @param mixed $key
  431. * @return bool
  432. */
  433. public function has($key);
  434. /**
  435. * Concatenate values of a given key as a string.
  436. *
  437. * @param string $value
  438. * @param string|null $glue
  439. * @return string
  440. */
  441. public function implode($value, $glue = null);
  442. /**
  443. * Intersect the collection with the given items.
  444. *
  445. * @param mixed $items
  446. * @return static
  447. */
  448. public function intersect($items);
  449. /**
  450. * Intersect the collection with the given items by key.
  451. *
  452. * @param mixed $items
  453. * @return static
  454. */
  455. public function intersectByKeys($items);
  456. /**
  457. * Determine if the collection is empty or not.
  458. *
  459. * @return bool
  460. */
  461. public function isEmpty();
  462. /**
  463. * Determine if the collection is not empty.
  464. *
  465. * @return bool
  466. */
  467. public function isNotEmpty();
  468. /**
  469. * Join all items from the collection using a string. The final items can use a separate glue string.
  470. *
  471. * @param string $glue
  472. * @param string $finalGlue
  473. * @return string
  474. */
  475. public function join($glue, $finalGlue = '');
  476. /**
  477. * Get the keys of the collection items.
  478. *
  479. * @return static
  480. */
  481. public function keys();
  482. /**
  483. * Get the last item from the collection.
  484. *
  485. * @param callable|null $callback
  486. * @param mixed $default
  487. * @return mixed
  488. */
  489. public function last(callable $callback = null, $default = null);
  490. /**
  491. * Run a map over each of the items.
  492. *
  493. * @param callable $callback
  494. * @return static
  495. */
  496. public function map(callable $callback);
  497. /**
  498. * Run a map over each nested chunk of items.
  499. *
  500. * @param callable $callback
  501. * @return static
  502. */
  503. public function mapSpread(callable $callback);
  504. /**
  505. * Run a dictionary map over the items.
  506. *
  507. * The callback should return an associative array with a single key/value pair.
  508. *
  509. * @param callable $callback
  510. * @return static
  511. */
  512. public function mapToDictionary(callable $callback);
  513. /**
  514. * Run a grouping map over the items.
  515. *
  516. * The callback should return an associative array with a single key/value pair.
  517. *
  518. * @param callable $callback
  519. * @return static
  520. */
  521. public function mapToGroups(callable $callback);
  522. /**
  523. * Run an associative map over each of the items.
  524. *
  525. * The callback should return an associative array with a single key/value pair.
  526. *
  527. * @param callable $callback
  528. * @return static
  529. */
  530. public function mapWithKeys(callable $callback);
  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);
  538. /**
  539. * Map the values into a new class.
  540. *
  541. * @param string $class
  542. * @return static
  543. */
  544. public function mapInto($class);
  545. /**
  546. * Merge the collection with the given items.
  547. *
  548. * @param mixed $items
  549. * @return static
  550. */
  551. public function merge($items);
  552. /**
  553. * Recursively merge the collection with the given items.
  554. *
  555. * @param mixed $items
  556. * @return static
  557. */
  558. public function mergeRecursive($items);
  559. /**
  560. * Create a collection by using this collection for keys and another for its values.
  561. *
  562. * @param mixed $values
  563. * @return static
  564. */
  565. public function combine($values);
  566. /**
  567. * Union the collection with the given items.
  568. *
  569. * @param mixed $items
  570. * @return static
  571. */
  572. public function union($items);
  573. /**
  574. * Get the min value of a given key.
  575. *
  576. * @param callable|string|null $callback
  577. * @return mixed
  578. */
  579. public function min($callback = null);
  580. /**
  581. * Get the max value of a given key.
  582. *
  583. * @param callable|string|null $callback
  584. * @return mixed
  585. */
  586. public function max($callback = null);
  587. /**
  588. * Create a new collection consisting of every n-th element.
  589. *
  590. * @param int $step
  591. * @param int $offset
  592. * @return static
  593. */
  594. public function nth($step, $offset = 0);
  595. /**
  596. * Get the items with the specified keys.
  597. *
  598. * @param mixed $keys
  599. * @return static
  600. */
  601. public function only($keys);
  602. /**
  603. * "Paginate" the collection by slicing it into a smaller collection.
  604. *
  605. * @param int $page
  606. * @param int $perPage
  607. * @return static
  608. */
  609. public function forPage($page, $perPage);
  610. /**
  611. * Partition the collection into two arrays using the given callback or key.
  612. *
  613. * @param callable|string $key
  614. * @param mixed $operator
  615. * @param mixed $value
  616. * @return static
  617. */
  618. public function partition($key, $operator = null, $value = null);
  619. /**
  620. * Push all of the given items onto the collection.
  621. *
  622. * @param iterable $source
  623. * @return static
  624. */
  625. public function concat($source);
  626. /**
  627. * Get one or a specified number of items randomly from the collection.
  628. *
  629. * @param int|null $number
  630. * @return static|mixed
  631. *
  632. * @throws \InvalidArgumentException
  633. */
  634. public function random($number = null);
  635. /**
  636. * Reduce the collection to a single value.
  637. *
  638. * @param callable $callback
  639. * @param mixed $initial
  640. * @return mixed
  641. */
  642. public function reduce(callable $callback, $initial = null);
  643. /**
  644. * Replace the collection items with the given items.
  645. *
  646. * @param mixed $items
  647. * @return static
  648. */
  649. public function replace($items);
  650. /**
  651. * Recursively replace the collection items with the given items.
  652. *
  653. * @param mixed $items
  654. * @return static
  655. */
  656. public function replaceRecursive($items);
  657. /**
  658. * Reverse items order.
  659. *
  660. * @return static
  661. */
  662. public function reverse();
  663. /**
  664. * Search the collection for a given value and return the corresponding key if successful.
  665. *
  666. * @param mixed $value
  667. * @param bool $strict
  668. * @return mixed
  669. */
  670. public function search($value, $strict = false);
  671. /**
  672. * Shuffle the items in the collection.
  673. *
  674. * @param int|null $seed
  675. * @return static
  676. */
  677. public function shuffle($seed = null);
  678. /**
  679. * Skip the first {$count} items.
  680. *
  681. * @param int $count
  682. * @return static
  683. */
  684. public function skip($count);
  685. /**
  686. * Skip items in the collection until the given condition is met.
  687. *
  688. * @param mixed $value
  689. * @return static
  690. */
  691. public function skipUntil($value);
  692. /**
  693. * Skip items in the collection while the given condition is met.
  694. *
  695. * @param mixed $value
  696. * @return static
  697. */
  698. public function skipWhile($value);
  699. /**
  700. * Get a slice of items from the enumerable.
  701. *
  702. * @param int $offset
  703. * @param int|null $length
  704. * @return static
  705. */
  706. public function slice($offset, $length = null);
  707. /**
  708. * Split a collection into a certain number of groups.
  709. *
  710. * @param int $numberOfGroups
  711. * @return static
  712. */
  713. public function split($numberOfGroups);
  714. /**
  715. * Chunk the collection into chunks of the given size.
  716. *
  717. * @param int $size
  718. * @return static
  719. */
  720. public function chunk($size);
  721. /**
  722. * Chunk the collection into chunks with a callback.
  723. *
  724. * @param callable $callback
  725. * @return static
  726. */
  727. public function chunkWhile(callable $callback);
  728. /**
  729. * Sort through each item with a callback.
  730. *
  731. * @param callable|null|int $callback
  732. * @return static
  733. */
  734. public function sort($callback = null);
  735. /**
  736. * Sort items in descending order.
  737. *
  738. * @param int $options
  739. * @return static
  740. */
  741. public function sortDesc($options = SORT_REGULAR);
  742. /**
  743. * Sort the collection using the given callback.
  744. *
  745. * @param callable|string $callback
  746. * @param int $options
  747. * @param bool $descending
  748. * @return static
  749. */
  750. public function sortBy($callback, $options = SORT_REGULAR, $descending = false);
  751. /**
  752. * Sort the collection in descending order using the given callback.
  753. *
  754. * @param callable|string $callback
  755. * @param int $options
  756. * @return static
  757. */
  758. public function sortByDesc($callback, $options = SORT_REGULAR);
  759. /**
  760. * Sort the collection keys.
  761. *
  762. * @param int $options
  763. * @param bool $descending
  764. * @return static
  765. */
  766. public function sortKeys($options = SORT_REGULAR, $descending = false);
  767. /**
  768. * Sort the collection keys in descending order.
  769. *
  770. * @param int $options
  771. * @return static
  772. */
  773. public function sortKeysDesc($options = SORT_REGULAR);
  774. /**
  775. * Get the sum of the given values.
  776. *
  777. * @param callable|string|null $callback
  778. * @return mixed
  779. */
  780. public function sum($callback = null);
  781. /**
  782. * Take the first or last {$limit} items.
  783. *
  784. * @param int $limit
  785. * @return static
  786. */
  787. public function take($limit);
  788. /**
  789. * Take items in the collection until the given condition is met.
  790. *
  791. * @param mixed $value
  792. * @return static
  793. */
  794. public function takeUntil($value);
  795. /**
  796. * Take items in the collection while the given condition is met.
  797. *
  798. * @param mixed $value
  799. * @return static
  800. */
  801. public function takeWhile($value);
  802. /**
  803. * Pass the collection to the given callback and then return it.
  804. *
  805. * @param callable $callback
  806. * @return $this
  807. */
  808. public function tap(callable $callback);
  809. /**
  810. * Pass the enumerable to the given callback and return the result.
  811. *
  812. * @param callable $callback
  813. * @return mixed
  814. */
  815. public function pipe(callable $callback);
  816. /**
  817. * Get the values of a given key.
  818. *
  819. * @param string|array $value
  820. * @param string|null $key
  821. * @return static
  822. */
  823. public function pluck($value, $key = null);
  824. /**
  825. * Create a collection of all elements that do not pass a given truth test.
  826. *
  827. * @param callable|mixed $callback
  828. * @return static
  829. */
  830. public function reject($callback = true);
  831. /**
  832. * Return only unique items from the collection array.
  833. *
  834. * @param string|callable|null $key
  835. * @param bool $strict
  836. * @return static
  837. */
  838. public function unique($key = null, $strict = false);
  839. /**
  840. * Return only unique items from the collection array using strict comparison.
  841. *
  842. * @param string|callable|null $key
  843. * @return static
  844. */
  845. public function uniqueStrict($key = null);
  846. /**
  847. * Reset the keys on the underlying array.
  848. *
  849. * @return static
  850. */
  851. public function values();
  852. /**
  853. * Pad collection to the specified length with a value.
  854. *
  855. * @param int $size
  856. * @param mixed $value
  857. * @return static
  858. */
  859. public function pad($size, $value);
  860. /**
  861. * Count the number of items in the collection using a given truth test.
  862. *
  863. * @param callable|null $callback
  864. * @return static
  865. */
  866. public function countBy($callback = null);
  867. /**
  868. * Zip the collection together with one or more arrays.
  869. *
  870. * e.g. new Collection([1, 2, 3])->zip([4, 5, 6]);
  871. * => [[1, 4], [2, 5], [3, 6]]
  872. *
  873. * @param mixed ...$items
  874. * @return static
  875. */
  876. public function zip($items);
  877. /**
  878. * Collect the values into a collection.
  879. *
  880. * @return \Illuminate\Support\Collection
  881. */
  882. public function collect();
  883. /**
  884. * Convert the collection to its string representation.
  885. *
  886. * @return string
  887. */
  888. public function __toString();
  889. /**
  890. * Add a method to the list of proxied methods.
  891. *
  892. * @param string $method
  893. * @return void
  894. */
  895. public static function proxy($method);
  896. /**
  897. * Dynamically access collection proxies.
  898. *
  899. * @param string $key
  900. * @return mixed
  901. *
  902. * @throws \Exception
  903. */
  904. public function __get($key);
  905. }