forked from php-deal/framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAccountContractInterface.php
51 lines (45 loc) · 1.16 KB
/
AccountContractInterface.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
declare(strict_types=1);
/**
* PHP Deal framework
*
* @copyright Copyright 2019, Lisachenko Alexander <[email protected]>
*
* This source file is subject to the license that is bundled
* with this source code in the file LICENSE.
*/
namespace Demo;
use PhpDeal\Annotation as Contract;
/**
* Simple trade account contract
*/
interface AccountContractInterface
{
/**
* Deposits fixed amount of money to the account
*
* @param float $amount
*
* @Contract\Verify("$amount>0 && is_numeric($amount)")
* @Contract\Ensure("$this->balance == $__old->balance+$amount")
*/
public function deposit($amount);
/**
* Withdraw amount of money from account.
*
* We don't allow withdrawal of more than 50
* @Contract\Verify("$amount <= $this->balance")
* @Contract\Verify("$amount <= 50")
* @Contract\Ensure("$this->balance == $__old->balance-$amount")
* @param float $amount
*/
public function withdraw($amount);
/**
* Returns current balance
*
* @Contract\Ensure("$__result == $this->balance")
*
* @return float
*/
public function getBalance();
}