BucketDTO.php 334 B

12345678910111213141516171819
  1. <?php
  2. namespace App\DTO\Search;
  3. class BucketDTO
  4. {
  5. public function __construct(
  6. public string $key,
  7. public int $doc_count,
  8. ) {}
  9. public static function fromArray(array $data): self
  10. {
  11. return new self(
  12. key: $data['key'],
  13. doc_count: $data['doc_count'],
  14. );
  15. }
  16. }