commitall
This commit is contained in:
33
vendor/phpunit/php-code-coverage/tests/_files/BankAccount.php
vendored
Normal file
33
vendor/phpunit/php-code-coverage/tests/_files/BankAccount.php
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
<?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();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user