backend-01

ref: master

app/models/Bill.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php

class Bill extends Base {
  private $title;
  private $amount;
  private $dueDate;
  private $paid;
  private $pdfPath;

  private $userId;
  private $tags;

  public function __construct($id, $title, $amount, $dueDate, $paid, $userId, $tags, $pdfPath = null) {
    $this->id = $id;
    $this->title = $title;
    $this->amount = $amount;
    $this->dueDate = $dueDate;
    $this->paid = $paid;
    $this->userId = $userId;
    $this->tags = $tags;
    $this->pdfPath = $pdfPath;
  }

  // TODO: Move this to use some sort of translation service instead
  public function isPaidLabel() {
    return $this->paid ? 'Sim' : 'Não';
  }

  public function getTitle() {
    return $this->title;
  }

  public function getAmount() {
    return $this->amount;
  }

  public function getDueDate() {
    return $this->dueDate;
  }

  public function isPaid() {
    return $this->paid;
  }

  public function setTitle($title) {
    $this->title = $title;
  }

  public function setAmount($amount) {
    $this->amount = $amount;
  }

  public function setDueDate($dueDate) {
    $this->dueDate = $dueDate;
  }

  public function setPaid($paid) {
    $this->paid = $paid;
  }

  public function getUserId() {
    return $this->userId;
  }

  public function getTags() {
    return $this->tags;
  }

  public function setTags($tags) {
    $this->tags = $tags;
  }

  public function getPdfPath() {
    return $this->pdfPath;
  }

  public function setPdfPath($pdfPath) {
    $this->pdfPath = $pdfPath;
  }

  public function toArray() {
    return [
      'amount' => $this->amount,
      'dueDate' => $this->dueDate,
      'paid' => $this->paid
    ];
  }
}