| Total Complexity | 4 |
| Total Lines | 30 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | final class RedisWallet implements Wallet |
||
| 11 | { |
||
| 12 | private $client; |
||
| 13 | private $walletKey; |
||
| 14 | private $identity; |
||
| 15 | |||
| 16 | public function __construct(ClientInterface $client, string $walletKey, string $identity) |
||
| 17 | { |
||
| 18 | $this->client = $client; |
||
| 19 | $this->walletKey = $walletKey; |
||
| 20 | $this->identity = $identity; |
||
| 21 | } |
||
| 22 | |||
| 23 | public function balance(): Credit |
||
| 24 | { |
||
| 25 | $balance = $this->client->hget($this->walletKey, $this->identity) ?? 0; |
||
| 26 | |||
| 27 | return Credit::fromInteger((int) $balance); |
||
| 28 | } |
||
| 29 | |||
| 30 | public function deposit(Credit $credit): void |
||
| 33 | } |
||
| 34 | |||
| 35 | public function withdraw(Credit $credit): void |
||
| 40 | } |
||
| 41 | } |
||
| 42 |