<commit_before><?php

declare(strict_types=1);

namespace Phpro\SoapClient\Soap\Driver\ExtSoap;

use Phpro\SoapClient\Soap\Driver\ExtSoap\Generator\DummyMethodArgumentsGenerator;
use Phpro\SoapClient\Soap\Engine\DecoderInterface;
use Phpro\SoapClient\Soap\HttpBinding\SoapResponse;

class ExtSoapDecoder implements DecoderInterface
{
    /**
     * @var AbusedClient
     */
    private $client;

    /**
     * @var DummyMethodArgumentsGenerator
     */
    private $argumentsGenerator;

    public function __construct(AbusedClient $client, DummyMethodArgumentsGenerator $argumentsGenerator)
    {
        $this->client = $client;
        $this->argumentsGenerator = $argumentsGenerator;
    }

    public function decode(string $method, SoapResponse $response)
    {
        $this->client->registerResponse($response);
        $decoded =  $this->client->__soapCall($method, $this->argumentsGenerator->generateForSoapCall($method));
        $this->client->cleanUpTemporaryState();

        return $decoded;
    }
}
<commit_msg>call cleanUpTemporaryState() if SoapFault is thrown in __soapCall<commit_after><?php

declare(strict_types=1);

namespace Phpro\SoapClient\Soap\Driver\ExtSoap;

use Phpro\SoapClient\Soap\Driver\ExtSoap\Generator\DummyMethodArgumentsGenerator;
use Phpro\SoapClient\Soap\Engine\DecoderInterface;
use Phpro\SoapClient\Soap\HttpBinding\SoapResponse;

class ExtSoapDecoder implements DecoderInterface
{
    /**
     * @var AbusedClient
     */
    private $client;

    /**
     * @var DummyMethodArgumentsGenerator
     */
    private $argumentsGenerator;

    public function __construct(AbusedClient $client, DummyMethodArgumentsGenerator $argumentsGenerator)
    {
        $this->client = $client;
        $this->argumentsGenerator = $argumentsGenerator;
    }

    public function decode(string $method, SoapResponse $response)
    {
        $this->client->registerResponse($response);
        try {
            $decoded = $this->client->__soapCall($method, $this->argumentsGenerator->generateForSoapCall($method));
        } catch (\Exception $e) {
            $this->client->cleanUpTemporaryState();
            throw $e;
        }
        $this->client->cleanUpTemporaryState();

        return $decoded;
    }
}

{'fraction_non_alphanumeric': 0.11224944320712694, 'fraction_numerical': 0.0008908685968819599, 'mean_word_length': 3.574338085539715, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 25, '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': '3748186', 'n_tokens_mistral': 655, 'n_tokens_neox': 646, 'n_words': 104}