<commit_before><?php

namespace Omnipay\AlliedWallet\Message;

use Omnipay\Common\Message\AbstractResponse;

/**
 * Allied Wallet SOAP Response
 */
class SoapResponse extends AbstractResponse
{
    public function __construct(SoapAbstractRequest $request, $data)
    {
        parent::__construct($request, $data);

        // Convert the SOAP Response (stdClass containing a stdClass) to an array.
        $responseName = $request->responseName;
        $this->data   = json_decode(json_encode($data->$responseName), true);
    }

    public function isSuccessful()
    {
        if (! empty($this->data['Status']) && $this->data['Status'] == 1) {
            return true;
        }
        return false;
    }

    /**
     * Response Message
     *
     * @return null|string A response message from the payment gateway
     */
    public function getMessage()
    {
        if (! empty($this->data['Message'])) {
            return $this->data['Message'];
        }
        return null;
    }

    /**
     * Response code
     *
     * @return null|string A response code from the payment gateway
     */
    public function getCode()
    {
        if (! empty($this->data['Status'])) {
            return $this->data['Status'];
        }
        return null;
    }

    /**
     * Gateway Reference
     *
     * @return null|string A reference provided by the gateway to represent this transaction
     */
    public function getTransactionReference()
    {
        if (! empty($this->data['TransactionID'])) {
            return $this->data['TransactionID'];
        }
        return null;
    }
}<commit_msg>Fix getCode function when the response codeis decline<commit_after><?php

namespace Omnipay\AlliedWallet\Message;

use Omnipay\Common\Message\AbstractResponse;

/**
 * Allied Wallet SOAP Response
 */
class SoapResponse extends AbstractResponse
{
    public function __construct(SoapAbstractRequest $request, $data)
    {
        parent::__construct($request, $data);

        // Convert the SOAP Response (stdClass containing a stdClass) to an array.
        $responseName = $request->responseName;
        $this->data   = json_decode(json_encode($data->$responseName), true);
    }

    public function isSuccessful()
    {
        if (! empty($this->data['Status']) && $this->data['Status'] == 1) {
            return true;
        }
        return false;
    }

    /**
     * Response Message
     *
     * @return null|string A response message from the payment gateway
     */
    public function getMessage()
    {
        if (! empty($this->data['Message'])) {
            return $this->data['Message'];
        }
        return null;
    }

    /**
     * Response code
     *
     * @return null|string A response code from the payment gateway
     */
    public function getCode()
    {
        // One of the response code from the gateway is Status : 0
        // Therefore using empty() PHP function will fail the condition.
        if (isset($this->data['Status']) && ! is_null($this->data['Status'])) {
            return $this->data['Status'];
        }
        return null;
    }

    /**
     * Gateway Reference
     *
     * @return null|string A reference provided by the gateway to represent this transaction
     */
    public function getTransactionReference()
    {
        if (! empty($this->data['TransactionID'])) {
            return $this->data['TransactionID'];
        }
        return null;
    }
}
{'fraction_non_alphanumeric': 0.12267981438515081, 'fraction_numerical': 0.0008700696055684454, 'mean_word_length': 2.2507068803016024, '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': '5368437', 'n_tokens_mistral': 935, 'n_tokens_neox': 913, 'n_words': 248}