-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConta.php
70 lines (56 loc) · 1.42 KB
/
Conta.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
/**
* Description of Conta
*
* @author alex.matos
*/
class Conta {
private $titular;
private $agencia;
private $conta;
private $saldo;
private $dataAbertura;
private $estado;
function __construct($titular, $agencia, $conta, $saldo, $dataAbertura) {
$this->titular = $titular;
$this->agencia = $agencia;
$this->conta = $conta;
$this->saldo = $saldo;
$this->dataAbertura = $dataAbertura;
if ($saldo < 0) {
$this->estado = new Negativo();
} else {
$this->estado = new Positivo();
}
}
public function saque($valor) {
$this->estado->saque($this, $valor);
}
public function deposita($valor) {
$this->estado->deposito($this, $valor);
}
public function getTitular() {
return $this->titular;
}
public function getConta() {
return $this->conta;
}
public function getAgencia() {
return $this->agencia;
}
public function getSaldo() {
return $this->saldo;
}
public function setSaldo($valor) {
$this->saldo = $valor;
}
function getDataAbertura() {
return $this->dataAbertura;
}
function getEstado() {
return $this->estado->toString();
}
function setEstado($estado) {
$this->estado = $estado;
}
}