<commit_before><?php

namespace hipanel\modules\finance\transaction;

use hiqdev\hiart\AbstractConnection;
use hiqdev\hiart\ConnectionInterface;
use hiqdev\hiart\ResponseErrorException;
use hiqdev\yii2\merchant\transactions\Transaction;
use hiqdev\yii2\merchant\transactions\TransactionException;
use hiqdev\yii2\merchant\transactions\TransactionRepositoryInterface;
use ReflectionObject;
use yii\helpers\Json;

class ApiTransactionRepository implements TransactionRepositoryInterface
{
    /**
     * @var ConnectionInterface|AbstractConnection
     */
    private $connection;

    /**
     * ApiTransactionRepository constructor.
     * @param ConnectionInterface $connection
     */
    function __construct(ConnectionInterface $connection)
    {
        $this->connection = $connection;
    }

    /**
     * @param string $id
     * @return Transaction
     * @throws TransactionException when transaction with the specified ID
     * does not exists
     */
    public function findById($id)
    {
        try {
            $data = $this->connection->callWithDisabledAuth(function () use ($id) {
                return $this->connection->createCommand()->perform('merchantTransactionGet', null, ['id' => $id]);
            });
        } catch (ResponseErrorException $e) {
            throw new TransactionException('Failed to get transaction information');
        }

        if (empty($data)) {
            throw new TransactionException('Transaction not found');
        }

        return $this->instantiate($data);
    }

    /**
     * @inheritdoc
     */
    public function insert($transaction)
    {
        return $this->save($transaction);
    }
<commit_msg>fixed getting response data (according to changes in yii2-hiart)<commit_after><?php

namespace hipanel\modules\finance\transaction;

use hiqdev\hiart\AbstractConnection;
use hiqdev\hiart\ConnectionInterface;
use hiqdev\hiart\ResponseErrorException;
use hiqdev\yii2\merchant\transactions\Transaction;
use hiqdev\yii2\merchant\transactions\TransactionException;
use hiqdev\yii2\merchant\transactions\TransactionRepositoryInterface;
use ReflectionObject;
use yii\helpers\Json;

class ApiTransactionRepository implements TransactionRepositoryInterface
{
    /**
     * @var ConnectionInterface|AbstractConnection
     */
    private $connection;

    /**
     * ApiTransactionRepository constructor.
     * @param ConnectionInterface $connection
     */
    function __construct(ConnectionInterface $connection)
    {
        $this->connection = $connection;
    }

    /**
     * @param string $id
     * @return Transaction
     * @throws TransactionException when transaction with the specified ID
     * does not exists
     */
    public function findById($id)
    {
        try {
            $data = $this->connection->callWithDisabledAuth(function () use ($id) {
                return $this->connection->createCommand()->perform('merchantTransactionGet', null, ['id' => $id]);
            })->getData();
        } catch (ResponseErrorException $e) {
            throw new TransactionException('Failed to get transaction information');
        }

        if (empty($data)) {
            throw new TransactionException('Transaction not found');
        }

        return $this->instantiate($data);
    }

    /**
     * @inheritdoc
     */
    public function insert($transaction)
    {
        return $this->save($transaction);
    }

{'fraction_non_alphanumeric': 0.10580304806565065, 'fraction_numerical': 0.0020515826494724504, 'mean_word_length': 3.0295159386068478, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 22, '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': '4617161', 'n_tokens_mistral': 884, 'n_tokens_neox': 878, 'n_words': 191}