ClientFactory.php 1016 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\AdvancedSearch\Model\Client;
  7. use Magento\Framework\ObjectManagerInterface;
  8. class ClientFactory implements ClientFactoryInterface
  9. {
  10. /**
  11. * Object manager
  12. *
  13. * @var ObjectManagerInterface
  14. */
  15. protected $objectManager;
  16. /**
  17. * @var string
  18. */
  19. private $clientClass;
  20. /**
  21. * @param ObjectManagerInterface $objectManager
  22. * @param string $clientClass
  23. */
  24. public function __construct(ObjectManagerInterface $objectManager, $clientClass)
  25. {
  26. $this->objectManager = $objectManager;
  27. $this->clientClass = $clientClass;
  28. }
  29. /**
  30. * Return search client
  31. *
  32. * @param array $options
  33. * @return ClientInterface
  34. */
  35. public function create(array $options = [])
  36. {
  37. return $this->objectManager->create(
  38. $this->clientClass,
  39. ['options' => $options]
  40. );
  41. }
  42. }