<commit_before><?php
/**
 * Account.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\Services\Spectre\Object;

use Carbon\Carbon;

/**
 * Class Account
 *
 * @codeCoverageIgnore
 * @SuppressWarnings(PHPMD.ShortVariable)
 */
class Account extends SpectreObject
{
    /** @var float */
    private $balance;
    /** @var Carbon */
    private $createdAt;
    /** @var string */
    private $currencyCode;
    /** @var array */
    private $extra = [];
    /** @var int */
    private $id;
    /** @var int */
    private $loginId;
    /** @var string */
    private $name;
    /** @var string */
    private $nature;
    /** @var Carbon */
    private $updatedAt;

    /**
     * Account constructor.
     *
     * @param array $data
     */
    public function __construct(array $data)
    {
        $this->id           = (int)$data['id'];
        $this->loginId      = $data['login_id'];
        $this->currencyCode = $data['currency_code'];
        $this->balance      = $data['balance'];
        $this->name         = $data['name'];
        $this->nature       = $data['nature'];
        $this->createdAt    = new Carbon($data['created_at']);
        $this->updatedAt    = new Carbon($data['updated_at']);

        foreach ($data['extra'] as $key => $value) {
            $this->extra[$key] = $value;
        }
    }

    /**
     * @return float
     */
    public function getBalance(): float
    {
        return $this->balance;
    }

    /**
     * @return string
     */
    public function getCurrencyCode(): string
    {
        return $this->currencyCode;
    }

    /**
     * @return array
     */
    public function getExtra(): array
    {
        return $this->extra;
    }

    /**
     * @return int
     */<commit_msg>Fix bug in Spectre import.<commit_after><?php
/**
 * Account.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\Services\Spectre\Object;

use Carbon\Carbon;

/**
 * Class Account
 *
 * @codeCoverageIgnore
 * @SuppressWarnings(PHPMD.ShortVariable)
 */
class Account extends SpectreObject
{
    /** @var float */
    private $balance;
    /** @var Carbon */
    private $createdAt;
    /** @var string */
    private $currencyCode;
    /** @var array */
    private $extra = [];
    /** @var int */
    private $id;
    /** @var int */
    private $loginId;
    /** @var string */
    private $name;
    /** @var string */
    private $nature;
    /** @var Carbon */
    private $updatedAt;

    /**
     * Account constructor.
     *
     * @param array $data
     */
    public function __construct(array $data)
    {
        $this->id           = (int)$data['id'];
        $this->loginId      = $data['login_id'];
        $this->currencyCode = $data['currency_code'];
        $this->balance      = $data['balance'];
        $this->name         = $data['name'];
        $this->nature       = $data['nature'];
        $this->createdAt    = new Carbon($data['created_at']);
        $this->updatedAt    = new Carbon($data['updated_at']);
        $extraArray         = \is_array($data['extra']) ? $data['extra'] : [];
        foreach ($extraArray as $key => $value) {
            $this->extra[$key] = $value;
        }
    }

    /**
     * @return float
     */
    public function getBalance(): float
    {
        return $this->balance;
    }

    /**
     * @return string
     */
    public function getCurrencyCode(): string
    {
        return $this->currencyCode;
    }

    /**
     * @return array
     */
    public function getExtra(): array
    {
        return $this->extra;
    }

    /**
     * @return int
     */
{'fraction_non_alphanumeric': 0.13723531761885738, 'fraction_numerical': 0.0023971234518577705, 'mean_word_length': 2.2449773169151004, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 33, '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': '3939081', 'n_tokens_mistral': 1467, 'n_tokens_neox': 1431, 'n_words': 449}