<commit_before><?php

namespace Omnipay\GoPay;

use Omnipay\Common\AbstractGateway;
use Omnipay\Common\Message\ResponseInterface;
use Omnipay\GoPay\Message\AccessTokenRequest;
use Omnipay\GoPay\Message\AccessTokenResponse;
use Omnipay\GoPay\Message\PurchaseRequest;
use Omnipay\GoPay\Message\PurchaseResponse;
use Omnipay\GoPay\Message\StatusRequest;
use Omnipay\GoPay\Message\Notification;

/**
 * GoPay payment gateway
 *
 * @package Omnipay\GoPay
 * @see https://doc.gopay.com/en/
 */
class Gateway extends AbstractGateway
{

    const URL_SANDBOX = 'https://gw.sandbox.gopay.com';
    const URL_PRODUCTION = 'https://gate.gopay.cz';

    /**
     * Get gateway display name
     *
     * This can be used by carts to get the display name for each gateway.
     */
    public function getName()
    {
        return 'GoPay';
    }

    /**
     * Get gateway short name
     *
     * This name can be used with GatewayFactory as an alias of the gateway class,
     * to create new instances of this gateway.
     */
    public function getShortName()
    {
        return 'gopay';
    }

    /**
     * Define gateway parameters, in the following format:
     *
     * array(
     *     'username' => '', // string variable
     *     'testMode' => false, // boolean variable
     *     'landingPage' => array('billing', 'login'), // enum variable, first item is default
     * );
     */
    public function getDefaultParameters()
    {
        return [
            'goId' => '',
            'clientId' => '',
            'clientSecret' => '',
            'testMode' => true,
        ];
    }

    /**
     * Initialize gateway with parameters
     */
    public function initialize(array $parameters = [])
    {
        parent::initialize($parameters);
        $this->setApiUrl();
        return $this;
    }

    /**
     * @return AccessTokenResponse|ResponseInterface
     */
    public function getAccessToken()
    {
        /** @var AccessTokenRequest $request */
        $request = parent::createRequest(AccessTokenRequest::class, $this->getParameters());
        $response = $request->send();
        return $response;
    }

    /**
     * @param array $options
     * @return PurchaseResponse|ResponseInterface
     */
    public function purchase(array $options = array())
    {
        $this->setToken($this->getAccessToken()->getToken());
        $request = parent::createRequest(PurchaseRequest::class, $options);
        $response = $request->send();
        return $response;
    }

    /**
     * @param array $parameters
     * @return PurchaseResponse|ResponseInterface
     */
    public function completePurchase(array $parameters = array())
    {
        $this->setToken($this->getAccessToken()->getToken());
        $request = parent::createRequest(StatusRequest::class, $parameters);
        $response = $request->send();
        return $response;
    }
<commit_msg>Simplified return type annotations on methods in gateway<commit_after><?php

namespace Omnipay\GoPay;

use Omnipay\Common\AbstractGateway;
use Omnipay\Common\Message\ResponseInterface;
use Omnipay\GoPay\Message\AccessTokenRequest;
use Omnipay\GoPay\Message\AccessTokenResponse;
use Omnipay\GoPay\Message\PurchaseRequest;
use Omnipay\GoPay\Message\PurchaseResponse;
use Omnipay\GoPay\Message\StatusRequest;
use Omnipay\GoPay\Message\Notification;

/**
 * GoPay payment gateway
 *
 * @package Omnipay\GoPay
 * @see https://doc.gopay.com/en/
 */
class Gateway extends AbstractGateway
{

    const URL_SANDBOX = 'https://gw.sandbox.gopay.com';
    const URL_PRODUCTION = 'https://gate.gopay.cz';

    /**
     * Get gateway display name
     *
     * This can be used by carts to get the display name for each gateway.
     */
    public function getName()
    {
        return 'GoPay';
    }

    /**
     * Get gateway short name
     *
     * This name can be used with GatewayFactory as an alias of the gateway class,
     * to create new instances of this gateway.
     */
    public function getShortName()
    {
        return 'gopay';
    }

    /**
     * Define gateway parameters, in the following format:
     *
     * array(
     *     'username' => '', // string variable
     *     'testMode' => false, // boolean variable
     *     'landingPage' => array('billing', 'login'), // enum variable, first item is default
     * );
     */
    public function getDefaultParameters()
    {
        return [
            'goId' => '',
            'clientId' => '',
            'clientSecret' => '',
            'testMode' => true,
        ];
    }

    /**
     * Initialize gateway with parameters
     */
    public function initialize(array $parameters = [])
    {
        parent::initialize($parameters);
        $this->setApiUrl();
        return $this;
    }

    /**
     * @return AccessTokenResponse
     */
    public function getAccessToken()
    {
        /** @var AccessTokenRequest $request */
        $request = parent::createRequest(AccessTokenRequest::class, $this->getParameters());
        $response = $request->send();
        return $response;
    }

    /**
     * @param array $options
     * @return PurchaseResponse
     */
    public function purchase(array $options = array())
    {
        $this->setToken($this->getAccessToken()->getToken());
        $request = parent::createRequest(PurchaseRequest::class, $options);
        $response = $request->send();
        return $response;
    }

    /**
     * @param array $parameters
     * @return PurchaseResponse
     */
    public function completePurchase(array $parameters = array())
    {
        $this->setToken($this->getAccessToken()->getToken());
        $request = parent::createRequest(StatusRequest::class, $parameters);
        $response = $request->send();
        return $response;
    }

{'fraction_non_alphanumeric': 0.12891503720366845, 'fraction_numerical': 0.0, 'mean_word_length': 2.461077844311377, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 39, 'https://': 6, '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': '6563230', 'n_tokens_mistral': 1679, 'n_tokens_neox': 1634, 'n_words': 377}