ObjectCollectionInterface.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. /**
  3. * @package Grav\Framework\Object
  4. *
  5. * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved.
  6. * @license MIT License; see LICENSE file for details.
  7. */
  8. namespace Grav\Framework\Object\Interfaces;
  9. use Doctrine\Common\Collections\Selectable;
  10. use Grav\Framework\Collection\CollectionInterface;
  11. /**
  12. * ObjectCollection Interface
  13. * @package Grav\Framework\Collection
  14. */
  15. interface ObjectCollectionInterface extends CollectionInterface, Selectable, ObjectInterface
  16. {
  17. /**
  18. * Create a copy from this collection by cloning all objects in the collection.
  19. *
  20. * @return static
  21. */
  22. public function copy();
  23. /**
  24. * @param string $key
  25. * @return $this
  26. */
  27. public function setKey($key);
  28. /**
  29. * @return array
  30. */
  31. public function getObjectKeys();
  32. /**
  33. * @param string $property Object property to be fetched.
  34. * @param mixed $default Default value if not set.
  35. * @return array Property value.
  36. */
  37. public function getProperty($property, $default = null);
  38. /**
  39. * @param string $name Method name.
  40. * @param array $arguments List of arguments passed to the function.
  41. * @return array Return values.
  42. */
  43. public function call($name, array $arguments);
  44. /**
  45. * Group items in the collection by a field and return them as associated array.
  46. *
  47. * @param string $property
  48. * @return array
  49. */
  50. public function group($property);
  51. /**
  52. * Group items in the collection by a field and return them as associated array of collections.
  53. *
  54. * @param string $property
  55. * @return static[]
  56. */
  57. public function collectionGroup($property);
  58. }