AggregationsDTO.php 667 B

1234567891011121314151617181920212223
  1. <?php
  2. namespace App\DTO\Search;
  3. class AggregationsDTO
  4. {
  5. public function __construct(
  6. public AggregationDTO $granularity,
  7. public AggregationDTO $resource_type,
  8. public AggregationDTO $language,
  9. public AggregationDTO $category,
  10. ) {}
  11. public static function fromArray(array $data): self
  12. {
  13. return new self(
  14. granularity: AggregationDTO::fromArray($data['granularity']),
  15. resource_type: AggregationDTO::fromArray($data['resource_type']),
  16. language: AggregationDTO::fromArray($data['language']),
  17. category: AggregationDTO::fromArray($data['category']),
  18. );
  19. }
  20. }