public function addAccount(ChartAccountsAccount $account) {
        foreach ($this->accounts as $current) {
            if ($current->getNumber() === $account->getNumber()) {
                throw new AccountAlreadyExistsException($account);
            }
        }
        $this->accounts[] = $account;
        return $this;
    }
public function addAccount(ChartAccountsAccount $account) {
        foreach ($this->accounts as $current) {
            if ($current->getNumber() === $account->getNumber()) {
                throw new AccountAlreadyExistsException($account);
            }
        }
        $this->accounts[] = $account;
        return $this;
    }
public function addAccount ( ChartAccountsAccount $ account ) { foreach ( $ this -> accounts as $ current ) { if ( $ current -> getNumber ( ) === $ account -> getNumber ( ) ) { throw new AccountAlreadyExistsException ( $ account ) ; } } $ this -> accounts [ ] = $ account ; return $ this ; }
Add an account.

@param ChartAccountsAccount $account The account.
@return AbstractChartAccountsModel Returns this charts of accounts model.
@throws AccountAlreadyExistsException Throws an account already exists.
Add an account .