vendor/payum/payum/src/Payum/Core/GatewayFactory.php line 33

Open in your IDE?
  1. <?php
  2. namespace Payum\Core;
  3. use Payum\Core\Bridge\Spl\ArrayObject;
  4. class GatewayFactory implements GatewayFactoryInterface
  5. {
  6.     /**
  7.      * @var GatewayFactoryInterface
  8.      */
  9.     protected $coreGatewayFactory;
  10.     /**
  11.      * @var array
  12.      */
  13.     protected $defaultConfig;
  14.     /**
  15.      * @param array $defaultConfig
  16.      * @param GatewayFactoryInterface $coreGatewayFactory
  17.      */
  18.     public function __construct(array $defaultConfig = array(), GatewayFactoryInterface $coreGatewayFactory null)
  19.     {
  20.         $this->coreGatewayFactory $coreGatewayFactory ?: new CoreGatewayFactory();
  21.         $this->defaultConfig $defaultConfig;
  22.     }
  23.     /**
  24.      * {@inheritDoc}
  25.      */
  26.     public function create(array $config = array())
  27.     {
  28.         return $this->coreGatewayFactory->create($this->createConfig($config));
  29.     }
  30.     /**
  31.      * {@inheritDoc}
  32.      */
  33.     public function createConfig(array $config = array())
  34.     {
  35.         $config ArrayObject::ensureArrayObject($config);
  36.         $config->defaults($this->defaultConfig);
  37.         $config->defaults($this->coreGatewayFactory->createConfig((array) $config));
  38.         $this->populateConfig($config);
  39.         return (array) $config;
  40.     }
  41.     /**
  42.      * {@inheritDoc}
  43.      */
  44.     protected function populateConfig(ArrayObject $config)
  45.     {
  46.     }
  47. }