DimensionFactory.php 959 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. declare(strict_types=1);
  7. namespace Magento\Framework\Indexer;
  8. use Magento\Framework\ObjectManagerInterface;
  9. /**
  10. * Dimension Factory
  11. *
  12. * @api
  13. * @since 101.0.6
  14. */
  15. class DimensionFactory
  16. {
  17. /**
  18. * @var ObjectManagerInterface
  19. */
  20. private $objectManager;
  21. /**
  22. * @param ObjectManagerInterface $objectManager
  23. */
  24. public function __construct(ObjectManagerInterface $objectManager)
  25. {
  26. $this->objectManager = $objectManager;
  27. }
  28. /**
  29. * @param string $name
  30. * @param string $value
  31. * @return Dimension
  32. * @since 101.0.6
  33. */
  34. public function create(string $name, string $value): Dimension
  35. {
  36. return $this->objectManager->create(
  37. Dimension::class,
  38. [
  39. 'name' => $name,
  40. 'value' => $value,
  41. ]
  42. );
  43. }
  44. }