UrlFactory.php 918 B

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