ContextFactory.php 917 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Framework\View\Element\UiComponent;
  7. use Magento\Framework\ObjectManagerInterface;
  8. /**
  9. * Class ContextFactory
  10. */
  11. class ContextFactory
  12. {
  13. const INSTANCE_NAME = \Magento\Framework\View\Element\UiComponent\ContextInterface::class;
  14. /**
  15. * @var ObjectManagerInterface
  16. */
  17. protected $objectManager;
  18. /**
  19. * Constructor
  20. *
  21. * @param ObjectManagerInterface $objectManager
  22. */
  23. public function __construct(ObjectManagerInterface $objectManager)
  24. {
  25. $this->objectManager = $objectManager;
  26. }
  27. /**
  28. * Create context
  29. *
  30. * @param array $arguments
  31. * @return ContextInterface
  32. */
  33. public function create(array $arguments = [])
  34. {
  35. return $this->objectManager->create(static::INSTANCE_NAME, $arguments);
  36. }
  37. }