<commit_before><?php
/**
 * Transaction.php
 * Copyright (c) 2018 <EMAIL>
 *
 * This file is part of Firefly III.
 *
 * Firefly III is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Firefly III is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
 */

declare(strict_types=1);

namespace FireflyIII\Support\Import\Placeholder;

use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Import\Converter\Amount;
use FireflyIII\Import\Converter\AmountCredit;
use FireflyIII\Import\Converter\AmountDebit;
use FireflyIII\Import\Converter\ConverterInterface;
use Log;

/**
 * Class ImportTransaction
 */
class ImportTransaction
{
    /** @var string */
    public $accountBic;
    /** @var string */
    public $accountIban;
    /** @var int */
    public $accountId;
    /** @var string */
    public $accountName;
    /** @var string */
    public $accountNumber;
    /** @var string */
    public $amount;
    /** @var string */
    public $amountCredit;
    /** @var string */
    public $amountDebit;
    /** @var int */
    public $billId;
    /** @var string */
    public $billName;
    /** @var int */
    public $budgetId;
    /** @var string */
    public $budgetName;
    /** @var int */
    public $categoryId;
    /** @var string */
    public $categoryName;
    /** @var string */
    public $currencyCode;
    /** @var int */
    public $currencyId;
    /** @var string */
    public $currencyName;
    /** @var string */
    public $currencySymbol;
    /** @var string */
    public $date;
    /** @var string */
    public $description;
    /** @var string */
    public $externalId;
    /** @var string */
    public $foreignAmount;
    /** @var string */
    public $foreignCurrencyCode;
    /** @var int */
    public $foreignCurrencyId;
    /** @var array */
    public $meta;
    /** @var array */
    public $modifiers;
    /** @var string */
    public $note;
    /** @var string */
    public $opposingBic;
    /** @var string */
    public $opposingIban;
    /** @var int */
    public $opposingId;
    /** @var string */
    public $opposingName;
    /** @var string */
    public $opposingNumber;
    /** @var array */
    public $tags;

    /**
     * ImportTransaction constructor.
     */
    public function __construct()
    {
        $this->tags        = [];
        $this->modifiers   = [];
        $this->meta        = [];
        $this->description = '';
        $this->note        = '';

        // mappable items, set to 0:
        $this->accountId         = 0;
        $this->budgetId          = 0;
        $this->billId            = 0;
        $this->currencyId        = 0;
        $this->categoryId        = 0;
        $this->foreignCurrencyId = 0;
        $this->opposingId        = 0;

    }

    /**
     * @param ColumnValue $columnValue
     *
     * @throws FireflyException
     */
    public function addColumnValue(ColumnValue $columnValue): void
    {
        $role   = $columnValue->getRole();
        $basics = [
            'account-iban'          => 'accountIban',
            'account-name'          => 'accountName',
            'account-bic'           => 'accountBic',
            'account-number'        => 'accountNumber',
            'amount_debit'          => 'amountDebit',
            'amount_credit'         => 'amountCredit',
            'amount'                => 'amount',
            'amount_foreign'        => 'foreignAmount',
            'bill-name'             => 'billName',
            'budget-name'           => 'budgetName',
            'category-name'         => 'categoryName',
            'currency-name'         => 'currencyName',
            'currency-code'         => 'currencyCode',
            'currency-symbol'       => 'currencySymbol',
            'external-id'           => 'externalId',
            'foreign-currency-code' => 'foreignCurrencyCode',
            'date-transaction'      => 'date',
            'opposing-iban'         => 'opposingIban',
            'opposing-name'         => 'opposingName',
            'opposing-bic'          => 'opposingBic',
            'opposing-number'       => 'opposingNumber',
        ];
        if (isset($basics[$role])) {
            $field        = $basics[$role];
            $this->$field = $columnValue->getValue();

            return;
        }

        $mapped = [
            'account-id'          => 'accountId',
            'bill-id'             => 'billId',
            'budget-id'           => 'budgetId',
            'category-id'         => 'categoryId',
            'currency-id'         => 'currencyId',
            'foreign-currency-id' => 'foreignCurrencyId',
            'opposing-id'         => 'opposingId',
        ];
        if (isset($mapped[$role])) {
            $field        = $basics[$role];
            $mappedValue  = $this->getMappedValue($columnValue);
            $this->$field = $mappedValue;
            Log::debug(sprintf('Going to set the %s. Original value is "%s", mapped value is "%s".', $role, $columnValue->getValue(), $mappedValue));

            return;
        }<commit_msg>Referenced the wrong array.<commit_after><?php
/**
 * Transaction.php
 * Copyright (c) 2018 <EMAIL>
 *
 * This file is part of Firefly III.
 *
 * Firefly III is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Firefly III is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
 */

declare(strict_types=1);

namespace FireflyIII\Support\Import\Placeholder;

use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Import\Converter\Amount;
use FireflyIII\Import\Converter\AmountCredit;
use FireflyIII\Import\Converter\AmountDebit;
use FireflyIII\Import\Converter\ConverterInterface;
use Log;

/**
 * Class ImportTransaction
 */
class ImportTransaction
{
    /** @var string */
    public $accountBic;
    /** @var string */
    public $accountIban;
    /** @var int */
    public $accountId;
    /** @var string */
    public $accountName;
    /** @var string */
    public $accountNumber;
    /** @var string */
    public $amount;
    /** @var string */
    public $amountCredit;
    /** @var string */
    public $amountDebit;
    /** @var int */
    public $billId;
    /** @var string */
    public $billName;
    /** @var int */
    public $budgetId;
    /** @var string */
    public $budgetName;
    /** @var int */
    public $categoryId;
    /** @var string */
    public $categoryName;
    /** @var string */
    public $currencyCode;
    /** @var int */
    public $currencyId;
    /** @var string */
    public $currencyName;
    /** @var string */
    public $currencySymbol;
    /** @var string */
    public $date;
    /** @var string */
    public $description;
    /** @var string */
    public $externalId;
    /** @var string */
    public $foreignAmount;
    /** @var string */
    public $foreignCurrencyCode;
    /** @var int */
    public $foreignCurrencyId;
    /** @var array */
    public $meta;
    /** @var array */
    public $modifiers;
    /** @var string */
    public $note;
    /** @var string */
    public $opposingBic;
    /** @var string */
    public $opposingIban;
    /** @var int */
    public $opposingId;
    /** @var string */
    public $opposingName;
    /** @var string */
    public $opposingNumber;
    /** @var array */
    public $tags;

    /**
     * ImportTransaction constructor.
     */
    public function __construct()
    {
        $this->tags        = [];
        $this->modifiers   = [];
        $this->meta        = [];
        $this->description = '';
        $this->note        = '';

        // mappable items, set to 0:
        $this->accountId         = 0;
        $this->budgetId          = 0;
        $this->billId            = 0;
        $this->currencyId        = 0;
        $this->categoryId        = 0;
        $this->foreignCurrencyId = 0;
        $this->opposingId        = 0;

    }

    /**
     * @param ColumnValue $columnValue
     *
     * @throws FireflyException
     */
    public function addColumnValue(ColumnValue $columnValue): void
    {
        $role   = $columnValue->getRole();
        $basics = [
            'account-iban'          => 'accountIban',
            'account-name'          => 'accountName',
            'account-bic'           => 'accountBic',
            'account-number'        => 'accountNumber',
            'amount_debit'          => 'amountDebit',
            'amount_credit'         => 'amountCredit',
            'amount'                => 'amount',
            'amount_foreign'        => 'foreignAmount',
            'bill-name'             => 'billName',
            'budget-name'           => 'budgetName',
            'category-name'         => 'categoryName',
            'currency-name'         => 'currencyName',
            'currency-code'         => 'currencyCode',
            'currency-symbol'       => 'currencySymbol',
            'external-id'           => 'externalId',
            'foreign-currency-code' => 'foreignCurrencyCode',
            'date-transaction'      => 'date',
            'opposing-iban'         => 'opposingIban',
            'opposing-name'         => 'opposingName',
            'opposing-bic'          => 'opposingBic',
            'opposing-number'       => 'opposingNumber',
        ];
        if (isset($basics[$role])) {
            $field        = $basics[$role];
            $this->$field = $columnValue->getValue();

            return;
        }

        $mapped = [
            'account-id'          => 'accountId',
            'bill-id'             => 'billId',
            'budget-id'           => 'budgetId',
            'category-id'         => 'categoryId',
            'currency-id'         => 'currencyId',
            'foreign-currency-id' => 'foreignCurrencyId',
            'opposing-id'         => 'opposingId',
        ];
        if (isset($mapped[$role])) {
            $field        = $mapped[$role];
            $mappedValue  = $this->getMappedValue($columnValue);
            $this->$field = $mappedValue;
            Log::debug(sprintf('Going to set the %s. Original value is "%s", mapped value is "%s".', $role, $columnValue->getValue(), $mappedValue));

            return;
        }
{'fraction_non_alphanumeric': 0.14158735859220686, 'fraction_numerical': 0.002513916322499551, 'mean_word_length': 1.7994470972606182, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 99, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2363273', 'n_tokens_mistral': 3198, 'n_tokens_neox': 3111, 'n_words': 791}