WebflowApiCollectionItems.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. namespace App\Http\WebflowApi;
  3. interface WebflowPaginationInterface {
  4. public function getCount(): int;
  5. public function getLimit(): int;
  6. public function getOffset(): int;
  7. public function getTotal(): int;
  8. public function next();
  9. }
  10. class WebflowApiCollectionItems extends AbstractWebflowApiCollection implements WebflowPaginationInterface, \IteratorAggregate {
  11. private $count = 0;
  12. private $limit = 0;
  13. private $offset = 0;
  14. private $total = 0;
  15. protected function getLoadScope(): string
  16. {
  17. return sprintf("collections/%s/items", $this->parent->id['_id']);
  18. }
  19. public function createEntry($key, $value): ?AbstractWebflowApiField
  20. {
  21. return new WebflowApiCollectionItem($this->getClient(), $value);
  22. }
  23. public function getIterator(): \Traversable {
  24. return new \ArrayIterator($this->getData());
  25. }
  26. public function getCount(): int {
  27. return $this->count;
  28. }
  29. public function setCount(int $c): self {
  30. $this->count = $c;
  31. return $this;
  32. }
  33. public function getLimit(): int {
  34. return $this->limit;
  35. }
  36. public function setLimit(int $l): self {
  37. $this->limit = $l;
  38. return $this;
  39. }
  40. public function getOffset(): int {
  41. return $this->offset;
  42. }
  43. public function setOffset(int $o): self {
  44. $this->offset = $o;
  45. return $this;
  46. }
  47. public function getTotal(): int {
  48. return $this->total;
  49. }
  50. public function setTotal(int $i): self {
  51. $this->total = $i;
  52. return $this;
  53. }
  54. public function next() {
  55. }
  56. }