api de gestion de ticket, basé sur php-crud-api. Le but est de décorrélé les outils de gestion des données, afin
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ListDocument.php 769B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace Tqdev\PhpCrudApi\Record\Document;
  3. class ListDocument implements \JsonSerializable
  4. {
  5. private $records;
  6. private $results;
  7. public function __construct(array $records, int $results)
  8. {
  9. $this->records = $records;
  10. $this->results = $results;
  11. }
  12. public function getRecords(): array
  13. {
  14. return $this->records;
  15. }
  16. public function getResults(): int
  17. {
  18. return $this->results;
  19. }
  20. public function serialize()
  21. {
  22. return [
  23. 'records' => $this->records,
  24. 'results' => $this->results,
  25. ];
  26. }
  27. public function jsonSerialize()
  28. {
  29. return array_filter($this->serialize(), function ($v) {
  30. return $v !== 0;
  31. });
  32. }
  33. }