<commit_before><?php

namespace Xola\OmnipayBundle\Service;

use Symfony\Component\DependencyInjection\Container as Helper;
use Omnipay\Common\GatewayInterface;
use Omnipay\Common\GatewayFactory;

class Omnipay
{
    protected $config;

    public function __construct(Helper $container)
    {
        $this->parameters = $container->getParameterBag()->all();
    }

    public function create($name)
    {
        $config = $this->getConfig();

        /** @var GatewayInterface $gateway */
        $gateway = GatewayFactory::create($config[$name]['gateway']);

        // Initialize the gateway with config parameters
        if (isset($config[$name])) {
            $gateway->initialize($config[$name]);
        }

        return $gateway;
    }

    public function getConfig()
    {
        $key = 'omnipay';
        if (!isset($this->config)) {
            // Asked config is not parsed yet. Parse it.
            $configs = array($key);
            foreach ($this->parameters as $param => $value) {
                if (!preg_match("/^$key/", $param)) {
                    continue;
                }
                $this->assignArrayByPath($configs, $param, $value);
            }

            $this->config = isset($configs[$key]) ? $configs[$key] : null;
        }

        return $this->config;<commit_msg>The GatewayFactory class no longer be called in a static fashion.<commit_after><?php

namespace Xola\OmnipayBundle\Service;

use Symfony\Component\DependencyInjection\Container as Helper;
use Omnipay\Common\GatewayInterface;
use Omnipay\Common\GatewayFactory;

class Omnipay
{
    protected $config;

    public function __construct(Helper $container)
    {
        $this->parameters = $container->getParameterBag()->all();
    }

    public function create($name)
    {
        $config = $this->getConfig();

        $factory = new GatewayFactory();
        /** @var GatewayInterface $gateway */
        $gateway = $factory->create($config[$name]['gateway']);

        // Initialize the gateway with config parameters
        if (isset($config[$name])) {
            $gateway->initialize($config[$name]);
        }

        return $gateway;
    }

    public function getConfig()
    {
        $key = 'omnipay';
        if (!isset($this->config)) {
            // Asked config is not parsed yet. Parse it.
            $configs = array($key);
            foreach ($this->parameters as $param => $value) {
                if (!preg_match("/^$key/", $param)) {
                    continue;
                }
                $this->assignArrayByPath($configs, $param, $value);
            }

            $this->config = isset($configs[$key]) ? $configs[$key] : null;
        }

        return $this->config;
{'fraction_non_alphanumeric': 0.13918472273228058, 'fraction_numerical': 0.0, 'mean_word_length': 2.185964912280702, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 26, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1260551', 'n_tokens_mistral': 774, 'n_tokens_neox': 747, 'n_words': 166}