ConfigFactory.php 1008 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Payment\Gateway\Config;
  7. use Magento\Framework\ObjectManagerInterface;
  8. use Magento\Payment\Gateway\ConfigFactoryInterface;
  9. class ConfigFactory implements ConfigFactoryInterface
  10. {
  11. /**
  12. * @var ObjectManagerInterface
  13. */
  14. private $om;
  15. /**
  16. * ConfigFactory constructor.
  17. * @param ObjectManagerInterface $om
  18. */
  19. public function __construct(
  20. ObjectManagerInterface $om
  21. ) {
  22. $this->om = $om;
  23. }
  24. /**
  25. * @param string|null $paymentCode
  26. * @param string|null $pathPattern
  27. * @return mixed
  28. */
  29. public function create($paymentCode = null, $pathPattern = null)
  30. {
  31. $arguments = [
  32. 'methodCode' => $paymentCode
  33. ];
  34. if ($pathPattern !== null) {
  35. $arguments['pathPattern'] = $pathPattern;
  36. }
  37. return $this->om->create(Config::class, $arguments);
  38. }
  39. }