1
0
mirror of https://github.com/e107inc/e107.git synced 2025-10-15 06:54:25 +02:00
Files
php-e107/vendor/phpunit/php-code-coverage/tests/_files/BankAccount.php
2018-02-06 03:18:31 -06:00

34 lines
630 B
PHP

<?php
class BankAccount
{
protected $balance = 0;
public function getBalance()
{
return $this->balance;
}
protected function setBalance($balance)
{
if ($balance >= 0) {
$this->balance = $balance;
} else {
throw new RuntimeException;
}
}
public function depositMoney($balance)
{
$this->setBalance($this->getBalance() + $balance);
return $this->getBalance();
}
public function withdrawMoney($balance)
{
$this->setBalance($this->getBalance() - $balance);
return $this->getBalance();
}
}