PatchRegistryFactory.php 902 B

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