123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- <?php
- /**
- * Copyright © Magento, Inc. All rights reserved.
- * See COPYING.txt for license details.
- */
- namespace Magento\Framework\Search\Response;
- use Magento\Framework\Api\Search\AggregationInterface;
- use Magento\Framework\Api\Search\Document;
- use Magento\Framework\Search\ResponseInterface;
- /**
- * Search Response
- * @api
- * @since 100.0.2
- */
- class QueryResponse implements ResponseInterface
- {
- /**
- * Document Collection
- *
- * @var Document[]
- */
- protected $documents;
- /**
- * Aggregation Collection
- *
- * @var AggregationInterface
- */
- protected $aggregations;
- /**
- * @param Document[] $documents
- * @param AggregationInterface $aggregations
- */
- public function __construct(array $documents, AggregationInterface $aggregations)
- {
- $this->documents = $documents;
- $this->aggregations = $aggregations;
- }
- /**
- * Countable: return count of fields in document
- * @return int
- */
- public function count()
- {
- return count($this->documents);
- }
- /**
- * Implementation of \IteratorAggregate::getIterator()
- *
- * @return \ArrayIterator
- */
- public function getIterator()
- {
- return new \ArrayIterator($this->documents);
- }
- /**
- * {@inheritdoc}
- */
- public function getAggregations()
- {
- return $this->aggregations;
- }
- }
|