ParserFactory.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /**
  3. * Parser factory
  4. *
  5. * Copyright © Magento, Inc. All rights reserved.
  6. * See COPYING.txt for license details.
  7. */
  8. namespace Magento\Framework\Translate\Inline;
  9. class ParserFactory
  10. {
  11. /**
  12. * Default instance type
  13. */
  14. const DEFAULT_INSTANCE_TYPE = \Magento\Framework\Translate\Inline\ParserInterface::class;
  15. /**
  16. * Object Manager
  17. *
  18. * @var \Magento\Framework\ObjectManagerInterface
  19. */
  20. protected $_objectManager;
  21. /**
  22. * Object constructor
  23. * @param \Magento\Framework\ObjectManagerInterface $objectManager
  24. */
  25. public function __construct(\Magento\Framework\ObjectManagerInterface $objectManager)
  26. {
  27. $this->_objectManager = $objectManager;
  28. }
  29. /**
  30. * Return instance of inline translate parser object
  31. *
  32. * @return \Magento\Framework\Translate\Inline\ParserInterface
  33. */
  34. public function get()
  35. {
  36. return $this->_objectManager->get(self::DEFAULT_INSTANCE_TYPE);
  37. }
  38. /**
  39. * @param array $arguments
  40. * @return \Magento\Framework\Translate\Inline\ParserInterface
  41. */
  42. public function create(array $arguments = [])
  43. {
  44. return $this->_objectManager->create(self::DEFAULT_INSTANCE_TYPE, $arguments);
  45. }
  46. }