You are here

protected function BankAccount::setBalance in Zircon Profile 8.0

Same name in this branch
  1. 8.0 vendor/phpunit/phpunit/tests/_files/BankAccount.php \BankAccount::setBalance()
  2. 8.0 vendor/phpunit/php-code-coverage/tests/_files/BankAccount.php \BankAccount::setBalance()
Same name and namespace in other branches
  1. 8 vendor/phpunit/phpunit/tests/_files/BankAccount.php \BankAccount::setBalance()
  2. 8 vendor/phpunit/php-code-coverage/tests/_files/BankAccount.php \BankAccount::setBalance()

Sets the bank account's balance.

Parameters

float $balance:

Throws

BankAccountException

4 calls to BankAccount::setBalance()
BankAccount::depositMoney in vendor/phpunit/phpunit/tests/_files/BankAccount.php
Deposits an amount of money to the bank account.
BankAccount::depositMoney in vendor/phpunit/php-code-coverage/tests/_files/BankAccount.php
BankAccount::withdrawMoney in vendor/phpunit/phpunit/tests/_files/BankAccount.php
Withdraws an amount of money from the bank account.
BankAccount::withdrawMoney in vendor/phpunit/php-code-coverage/tests/_files/BankAccount.php

File

vendor/phpunit/phpunit/tests/_files/BankAccount.php, line 45

Class

BankAccount
A bank account.

Code

protected function setBalance($balance) {
  if ($balance >= 0) {
    $this->balance = $balance;
  }
  else {
    throw new BankAccountException();
  }
}