protected function BankAccount::setBalance

Sets the bank account's balance.

Parameters

float $balance:

Throws

BankAccountException

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

File

drupal/core/vendor/phpunit/phpunit/Tests/_files/BankAccount.php, line 82

Class

BankAccount
A bank account.

Code

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