<commit_before><?php
namespace Bigbank\MobileId\Request;

use Bigbank\MobileId\IdException;
use Bigbank\MobileId\SoapClient;

/**
 * Abstract base class for SOAP requests
 */
abstract class AbstractRequest implements RequestInterface
{

    /**
     * @var SoapClient
     */
    protected $client;

    /**
     * {@inheritdoc}
     */
    public function send(array $arguments)
    {

        $arguments = array_replace($this->getDefaultArguments(), $arguments);
        $arguments = array_values($arguments);

        try {
            $response = call_user_func_array([$this->client, $this->getRequestName()], array_values($arguments));
        } catch (\SoapFault $fault) {
            throw new IdException(
                $fault->faultcode,
                $fault->faultstring
            );
        }
        return $response;
    }

    /**
     * {@inheritdoc}
     */
    public function factory($apiUrl, array $options = [])
    {

        $this->client = new SoapClient($apiUrl, $options);
        return $this;
    }


    /**
     * @return string Returns the SOAP method name for the request
     */
    protected function getRequestName()
    {

        $reflectionClass = new \ReflectionClass($this);
        return $reflectionClass->getShortName();
    }
}
<commit_msg>API-1510 Extract SOAP request call into its own method<commit_after><?php
namespace Bigbank\MobileId\Request;

use Bigbank\MobileId\IdException;
use Bigbank\MobileId\SoapClient;

/**
 * Abstract base class for SOAP requests
 */
abstract class AbstractRequest implements RequestInterface
{

    /**
     * @var SoapClient
     */
    protected $client;

    /**
     * {@inheritdoc}
     */
    public function send(array $arguments)
    {

        $arguments = array_replace($this->getDefaultArguments(), $arguments);
        $arguments = array_values($arguments);

        try {
            return $this->callSoapMethod(array_values($arguments));
        } catch (\SoapFault $fault) {
            throw new IdException(
                $fault->faultcode,
                $fault->faultstring
            );
        }
    }

    /**
     * {@inheritdoc}
     */
    public function factory($apiUrl, array $options = [])
    {

        $this->client = new SoapClient($apiUrl, $options);
        return $this;
    }


    /**
     * @return string Returns the SOAP method name for the request
     */
    protected function getRequestName()
    {

        $reflectionClass = new \ReflectionClass($this);
        return $reflectionClass->getShortName();
    }

    /**
     * @param array $arguments
     *
     * @return array
     */
    private function callSoapMethod(array $arguments)
    {

        return call_user_func_array([$this->client, $this->getRequestName()], $arguments);
    }
}

{'fraction_non_alphanumeric': 0.12081984897518878, 'fraction_numerical': 0.001438331535418914, 'mean_word_length': 2.2576112412177984, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 18, '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': '2863474', 'n_tokens_mistral': 796, 'n_tokens_neox': 762, 'n_words': 171}