123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- <?php
- /**
- * @copyright Vertex. All rights reserved. https://www.vertexinc.com/
- * @author Mediotype https://www.mediotype.com/
- */
- namespace Vertex\Tax\Model\Repository;
- use Magento\Framework\Api\SearchCriteriaInterface;
- use Vertex\Tax\Api\Data\LogEntrySearchResultsInterface;
- /**
- * Search result implementation for repository lookup.
- *
- * Methods duplicated from SearchResults and AbstractSimpleObject as they are not in the public API
- */
- class LogEntrySearchResult implements LogEntrySearchResultsInterface
- {
- const KEY_ITEMS = 'items';
- const KEY_SEARCH_CRITERIA = 'search_criteria';
- const KEY_TOTAL_COUNT = 'total_count';
- /**
- * @var array
- */
- private $data;
- /**
- * Initialize internal storage
- *
- * @param array $data
- */
- public function __construct(array $data = [])
- {
- $this->data = $data;
- }
- /**
- * Retrieves a value from the data array if set, or null otherwise.
- *
- * @param string $key
- * @return mixed|null
- */
- private function getData($key)
- {
- return isset($this->data[$key]) ? $this->data[$key] : null;
- }
- /**
- * Set value for the given key
- *
- * @param string $key
- * @param mixed $value
- * @return $this
- */
- private function setData($key, $value)
- {
- $this->data[$key] = $value;
- return $this;
- }
- /**
- * Get items
- *
- * @return \Magento\Framework\Api\AbstractExtensibleObject[]
- */
- public function getItems()
- {
- return $this->getData(self::KEY_ITEMS) === null ? [] : $this->getData(self::KEY_ITEMS);
- }
- /**
- * Set items
- *
- * @param \Magento\Framework\Api\AbstractExtensibleObject[] $items
- * @return $this
- */
- public function setItems(array $items)
- {
- return $this->setData(self::KEY_ITEMS, $items);
- }
- /**
- * Get search criteria
- *
- * @return \Magento\Framework\Api\SearchCriteria
- */
- public function getSearchCriteria()
- {
- return $this->getData(self::KEY_SEARCH_CRITERIA);
- }
- /**
- * Set search criteria
- *
- * @param SearchCriteriaInterface $searchCriteria
- * @return $this
- */
- public function setSearchCriteria(SearchCriteriaInterface $searchCriteria)
- {
- return $this->setData(self::KEY_SEARCH_CRITERIA, $searchCriteria);
- }
- /**
- * Get total count
- *
- * @return int
- */
- public function getTotalCount()
- {
- return $this->getData(self::KEY_TOTAL_COUNT);
- }
- /**
- * Set total count
- *
- * @param int $count
- * @return $this
- */
- public function setTotalCount($count)
- {
- return $this->setData(self::KEY_TOTAL_COUNT, $count);
- }
- }
|