SearchResultProcessorFactory.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Framework\Data;
  7. /**
  8. * Class SearchResultProcessorFactory
  9. */
  10. class SearchResultProcessorFactory
  11. {
  12. const DEFAULT_INSTANCE_NAME = \Magento\Framework\Data\SearchResultProcessor::class;
  13. /**
  14. * Object Manager instance
  15. *
  16. * @var \Magento\Framework\ObjectManagerInterface
  17. */
  18. protected $objectManager;
  19. /**
  20. * Factory constructor
  21. *
  22. * @param \Magento\Framework\ObjectManagerInterface $objectManager
  23. */
  24. public function __construct(
  25. \Magento\Framework\ObjectManagerInterface $objectManager
  26. ) {
  27. $this->objectManager = $objectManager;
  28. }
  29. /**
  30. * Create class instance with specified parameters
  31. *
  32. * @param AbstractSearchResult $collection
  33. * @return SearchResultProcessor
  34. */
  35. public function create(AbstractSearchResult $collection)
  36. {
  37. return $this->objectManager->create(static::DEFAULT_INSTANCE_NAME, ['searchResult' => $collection]);
  38. }
  39. }