ExcelFactory.php 996 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Framework\Convert;
  7. use Magento\Framework\ObjectManagerInterface;
  8. class ExcelFactory
  9. {
  10. /**
  11. * @var ObjectManagerInterface
  12. */
  13. protected $objectManager;
  14. /**
  15. * @var string
  16. */
  17. protected $instanceName;
  18. /**
  19. * @param ObjectManagerInterface $objectManager
  20. * @param string $instanceName
  21. */
  22. public function __construct(
  23. ObjectManagerInterface $objectManager,
  24. $instanceName = \Magento\Framework\Convert\Excel::class
  25. ) {
  26. $this->objectManager = $objectManager;
  27. $this->instanceName = $instanceName;
  28. }
  29. /**
  30. * Create class instance with specified parameters
  31. *
  32. * @param array $data
  33. * @return \Magento\Framework\Convert\Excel
  34. */
  35. public function create(array $data = [])
  36. {
  37. return $this->objectManager->create($this->instanceName, $data);
  38. }
  39. }