<commit_before><?php

namespace AppBundle\Entity\Ndr;

use AppBundle\Entity\Ndr\Traits\HasNdrTrait;
use JMS\Serializer\Annotation as JMS;
use Symfony\Component\Validator\Constraints as Assert;

class BankAccount
{
    use HasNdrTrait;

    /**
     * Keep in sync with api.
     */
    public static $types = [
        'current' => 'Current account',
        'savings' => 'Savings account',
        'isa' => 'ISA',
        'postoffice' => 'Post Office account',
        'cfo' => 'Court Funds Office account',
        'other' => 'Other type of account',
        'other_no_sortcode' => 'Other type of account without sort code',
    ];

    private static $typesNotRequiringSortCode = [
        'postoffice',
        'cfo',
        'other_no_sortcode'
    ];

    private static $typesNotRequiringBankName = [
        'postoffice',
        'cfo'
    ];

    /**
     * @JMS\Type("integer")
     * @JMS\Groups({"bank-account"})
     *
     * @var int
     */
    private $id;

    /**
     * @JMS\Type("string")
     * @JMS\Groups({"bank-account"})
     *
     * @Assert\NotBlank(message="ndr.account.accountType.notBlank", groups={"bank-account-type"})
     * @Assert\Length(max=100, maxMessage="ndr.account.accountType.maxMessage", groups={"bank-account-type"})
     *
     * @var string
     */
    private $accountType;

    /**
     * @JMS\Type("string")
     * @JMS\Groups({"bank-account"})
     *
     * @Assert\NotBlank(message="ndr.account.bank.notBlank", groups={"bank-account-name"})
     * @Assert\Length(max=500, min=2,  minMessage="ndr.account.bank.minMessage", maxMessage="ndr.account.bank.maxMessage", groups={"bank-account-name"})
     *
     * @var string
     */
    private $bank;


    /**
     * @JMS\Type("string")
     *
     * @var string
     */
    private $accountTypeText;

    /**
     * @JMS\Type("string")
     * @JMS\Groups({"bank-account"})
     *
     * @var string
     */
    private $sortCode;

    /**
     * @JMS\Type("string")
     * @JMS\Groups({"bank-account"})
     *
     * @Assert\NotBlank(message="ndr.account.accountNumber.notBlank", groups={"bank-account-number"})
     * @Assert\Type(type="alnum", message="ndr.account.accountNumber.type", groups={"bank-account-number"})
     * @Assert\Length(exactMessage="ndr.account.accountNumber.length",min=4, max=4, groups={"bank-account-number"})
     *
     * @var string
     */
    private $accountNumber;

    /**
     * @JMS\Type("string")
     * @JMS\Groups({"bank-account"})
     *
     * @Assert\NotBlank(message="ndr.account.balanceOnCourtOrderDate.notBlank", groups={"bank-account-balance-on-cot"})
     * @Assert\Type(type="numeric", message="ndr.account.balanceOnCourtOrderDate.type", groups={"bank-account-balance-on-cot"})
     * @Assert\Range(max=10000000000, maxMessage="ndr.account.balanceOnCourtOrderDate.outOfRange", groups={"bank-account-balance-on-cot"})
     *
     * @var decimal
     */
    private $balanceOnCourtOrderDate;

    /**
     * @JMS\Type("string")
     * @JMS\Groups({"bank-account"})
     *
     * @Assert\NotBlank(message="ndr.account.isJointAccount.notBlank", groups={"bank-account-is-joint"})
     *
     * @var string
     */
    private $isJointAccount;

    /**
     * @return mixed
     */
    public static function getTypes()
    {
        return self::$types;
    }

    /**
     * @param mixed $types
     */
    public static function setTypes($types)
    {
        self::$types = $types;
    }

    /**
     * @return int
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * @param int $id
     */
    public function setId($id)
    {
        $this->id = $id;
    }

    /**
     * @return string
     */
    public function getBank()
    {
        return $this->bank;
    }

    /**
     * @param string $bank
     */
    public function setBank($bank)
    {
        $this->bank = $bank;
    }

    /**
     * @return string
     */
    public function getAccountType()
    {
        return $this->accountType;
    }

    /**
     * @param string $accountType
     */
    public function setAccountType($accountType)
    {
        $this->accountType = $accountType;
    }

    /**
     * @return string
     */
    public function getAccountTypeText()
    {
        return $this->accountTypeText;
    }

    /**
     * @param string $accountTypeText
     */
    public function setAccountTypeText($accountTypeText)
    {
        $this->accountTypeText = $accountTypeText;
    }

    /**
     * @return string
     */
    public function getSortCode()
    {
        return $this->sortCode;
    }

    /**
     * @param string $sortCode
     */
    public function setSortCode($sortCode)
    {
        $this->sortCode = $sortCode;
    }

    /**
     * @return string
     */
    public function getAccountNumber()
    {
        return $this->accountNumber;
    }

    /**
     * @param string $accountNumber
     */
    public function setAccountNumber($accountNumber)
    {
        $this->accountNumber = $accountNumber;
    }

    /**
     * @return decimal
     */
    public function getOpeningBalance()
    {
        return $this->openingBalance;
    }

    /**
     * @param decimal $openingBalance
     */
    public function setOpeningBalance($openingBalance)
    {
        $this->openingBalance = $openingBalance;
    }

    /**
     * @return decimal
     */
    public function getBalanceOnCourtOrderDate()
    {
        return $this->balanceOnCourtOrderDate;
    }

    /**
     * @param decimal $balanceOnCourtOrderDate
     */
    public function setBalanceOnCourtOrderDate($balanceOnCourtOrderDate)
    {
        $this->balanceOnCourtOrderDate = $balanceOnCourtOrderDate;
    }

    /**
     * Sort code required.
     *
     * @return string
     */
    public function requiresSortCode()
    {
        return !in_array($this->getAccountType(), self::$typesNotRequiringSortCode);
    }

    /**
     * Bank name required.
     *
     * @return string
     */
    public function requiresBankName()
    {
        return !in_array($this->getAccountType(), self::$typesNotRequiringBankName);
    }

    public function getIsJointAccount()
    {
        return $this->isJointAccount;
    }

    public function setIsJointAccount($isJointAccount)
    {
        $this->isJointAccount = $isJointAccount;

        return $this;
    }
}
<commit_msg>fix NDR bank account static config<commit_after><?php

namespace AppBundle\Entity\Ndr;

use AppBundle\Entity\Ndr\Traits\HasNdrTrait;
use JMS\Serializer\Annotation as JMS;
use Symfony\Component\Validator\Constraints as Assert;

class BankAccount
{
    use HasNdrTrait;

    /**
     * Keep in sync with api.
     */
    public static $types = [
        'current',
        'savings',
        'isa',
        'postoffice',
        'cfo',
        'other',
        'other_no_sortcode',
    ];

    private static $typesNotRequiringSortCode = [
        'postoffice',
        'cfo',
        'other_no_sortcode'
    ];

    private static $typesNotRequiringBankName = [
        'postoffice',
        'cfo'
    ];

    /**
     * @JMS\Type("integer")
     * @JMS\Groups({"bank-account"})
     *
     * @var int
     */
    private $id;

    /**
     * @JMS\Type("string")
     * @JMS\Groups({"bank-account"})
     *
     * @Assert\NotBlank(message="ndr.account.accountType.notBlank", groups={"bank-account-type"})
     * @Assert\Length(max=100, maxMessage="ndr.account.accountType.maxMessage", groups={"bank-account-type"})
     *
     * @var string
     */
    private $accountType;

    /**
     * @JMS\Type("string")
     * @JMS\Groups({"bank-account"})
     *
     * @Assert\NotBlank(message="ndr.account.bank.notBlank", groups={"bank-account-name"})
     * @Assert\Length(max=500, min=2,  minMessage="ndr.account.bank.minMessage", maxMessage="ndr.account.bank.maxMessage", groups={"bank-account-name"})
     *
     * @var string
     */
    private $bank;


    /**
     * @JMS\Type("string")
     *
     * @var string
     */
    private $accountTypeText;

    /**
     * @JMS\Type("string")
     * @JMS\Groups({"bank-account"})
     *
     * @var string
     */
    private $sortCode;

    /**
     * @JMS\Type("string")
     * @JMS\Groups({"bank-account"})
     *
     * @Assert\NotBlank(message="ndr.account.accountNumber.notBlank", groups={"bank-account-number"})
     * @Assert\Type(type="alnum", message="ndr.account.accountNumber.type", groups={"bank-account-number"})
     * @Assert\Length(exactMessage="ndr.account.accountNumber.length",min=4, max=4, groups={"bank-account-number"})
     *
     * @var string
     */
    private $accountNumber;

    /**
     * @JMS\Type("string")
     * @JMS\Groups({"bank-account"})
     *
     * @Assert\NotBlank(message="ndr.account.balanceOnCourtOrderDate.notBlank", groups={"bank-account-balance-on-cot"})
     * @Assert\Type(type="numeric", message="ndr.account.balanceOnCourtOrderDate.type", groups={"bank-account-balance-on-cot"})
     * @Assert\Range(max=10000000000, maxMessage="ndr.account.balanceOnCourtOrderDate.outOfRange", groups={"bank-account-balance-on-cot"})
     *
     * @var decimal
     */
    private $balanceOnCourtOrderDate;

    /**
     * @JMS\Type("string")
     * @JMS\Groups({"bank-account"})
     *
     * @Assert\NotBlank(message="ndr.account.isJointAccount.notBlank", groups={"bank-account-is-joint"})
     *
     * @var string
     */
    private $isJointAccount;

    /**
     * @return mixed
     */
    public static function getTypes()
    {
        return self::$types;
    }

    /**
     * @param mixed $types
     */
    public static function setTypes($types)
    {
        self::$types = $types;
    }

    /**
     * @return int
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * @param int $id
     */
    public function setId($id)
    {
        $this->id = $id;
    }

    /**
     * @return string
     */
    public function getBank()
    {
        return $this->bank;
    }

    /**
     * @param string $bank
     */
    public function setBank($bank)
    {
        $this->bank = $bank;
    }

    /**
     * @return string
     */
    public function getAccountType()
    {
        return $this->accountType;
    }

    /**
     * @param string $accountType
     */
    public function setAccountType($accountType)
    {
        $this->accountType = $accountType;
    }

    /**
     * @return string
     */
    public function getAccountTypeText()
    {
        return $this->accountTypeText;
    }

    /**
     * @param string $accountTypeText
     */
    public function setAccountTypeText($accountTypeText)
    {
        $this->accountTypeText = $accountTypeText;
    }

    /**
     * @return string
     */
    public function getSortCode()
    {
        return $this->sortCode;
    }

    /**
     * @param string $sortCode
     */
    public function setSortCode($sortCode)
    {
        $this->sortCode = $sortCode;
    }

    /**
     * @return string
     */
    public function getAccountNumber()
    {
        return $this->accountNumber;
    }

    /**
     * @param string $accountNumber
     */
    public function setAccountNumber($accountNumber)
    {
        $this->accountNumber = $accountNumber;
    }

    /**
     * @return decimal
     */
    public function getOpeningBalance()
    {
        return $this->openingBalance;
    }

    /**
     * @param decimal $openingBalance
     */
    public function setOpeningBalance($openingBalance)
    {
        $this->openingBalance = $openingBalance;
    }

    /**
     * @return decimal
     */
    public function getBalanceOnCourtOrderDate()
    {
        return $this->balanceOnCourtOrderDate;
    }

    /**
     * @param decimal $balanceOnCourtOrderDate
     */
    public function setBalanceOnCourtOrderDate($balanceOnCourtOrderDate)
    {
        $this->balanceOnCourtOrderDate = $balanceOnCourtOrderDate;
    }

    /**
     * Sort code required.
     *
     * @return string
     */
    public function requiresSortCode()
    {
        return !in_array($this->getAccountType(), self::$typesNotRequiringSortCode);
    }

    /**
     * Bank name required.
     *
     * @return string
     */
    public function requiresBankName()
    {
        return !in_array($this->getAccountType(), self::$typesNotRequiringBankName);
    }

    public function getIsJointAccount()
    {
        return $this->isJointAccount;
    }

    public function setIsJointAccount($isJointAccount)
    {
        $this->isJointAccount = $isJointAccount;

        return $this;
    }
}

{'fraction_non_alphanumeric': 0.14842063174730108, 'fraction_numerical': 0.003198720511795282, 'mean_word_length': 2.193564862104188, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 50, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, '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': '6188952', 'n_tokens_mistral': 4088, 'n_tokens_neox': 3925, 'n_words': 610}