Passed
Push — master ( 37b02e...ebbbe1 )
by James
08:59
created

app/Helpers/Collection/BillLine.php (1 issue)

Labels
Severity
1
<?php
2
/**
3
 * BillLine.php
4
 * Copyright (c) 2017 [email protected]
5
 *
6
 * This file is part of Firefly III.
7
 *
8
 * Firefly III is free software: you can redistribute it and/or modify
9
 * it under the terms of the GNU General Public License as published by
10
 * the Free Software Foundation, either version 3 of the License, or
11
 * (at your option) any later version.
12
 *
13
 * Firefly III is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
20
 */
21
declare(strict_types=1);
22
23
namespace FireflyIII\Helpers\Collection;
24
25
use Carbon\Carbon;
26
use FireflyIII\Models\Bill as BillModel;
27
28
/**
29
 * Class BillLine.
30
 */
31
class BillLine
32
{
33
    /** @var string */
34
    protected $amount;
35
    /** @var BillModel */
36
    protected $bill;
37
    /** @var bool */
38
    protected $hit;
39
    /** @var string */
40
    protected $max;
41
    /** @var string */
42
    protected $min;
43
    /** @var Carbon */
44
    private $endOfPayDate;
45
    /** @var Carbon */
46
    private $lastHitDate;
47
    /** @var Carbon */
48
    private $payDate;
49
    /** @var int */
50
    private $transactionJournalId;
51
52
    /**
53
     * BillLine constructor.
54
     */
55
    public function __construct()
56
    {
57
        $this->lastHitDate = new Carbon;
58
    }
59
60
    /**
61
     * @return string
62
     */
63
    public function getAmount(): string
64
    {
65
        return $this->amount ?? '0';
66
    }
67
68
    /**
69
     * @param string $amount
70
     */
71
    public function setAmount(string $amount)
72
    {
73
        $this->amount = $amount;
74
    }
75
76
    /**
77
     * @return BillModel
78
     */
79
    public function getBill(): BillModel
80
    {
81
        return $this->bill;
82
    }
83
84
    /**
85
     * @param BillModel $bill
86
     */
87
    public function setBill(BillModel $bill)
88
    {
89
        $this->bill = $bill;
90
    }
91
92
    /**
93
     * @return Carbon
94
     */
95
    public function getEndOfPayDate(): Carbon
96
    {
97
        return $this->endOfPayDate;
98
    }
99
100
    /**
101
     * @param Carbon $endOfPayDate
102
     */
103
    public function setEndOfPayDate(Carbon $endOfPayDate): void
104
    {
105
        $this->endOfPayDate = $endOfPayDate;
106
    }
107
108
    /**
109
     * @return Carbon
110
     */
111
    public function getLastHitDate(): Carbon
112
    {
113
        return $this->lastHitDate;
114
    }
115
116
    /**
117
     * @param Carbon $lastHitDate
118
     */
119
    public function setLastHitDate(Carbon $lastHitDate)
120
    {
121
        $this->lastHitDate = $lastHitDate;
122
    }
123
124
    /**
125
     * @return string
126
     */
127
    public function getMax(): string
128
    {
129
        return $this->max;
130
    }
131
132
    /**
133
     * @param string $max
134
     */
135
    public function setMax(string $max)
136
    {
137
        $this->max = $max;
138
    }
139
140
    /**
141
     * @return string
142
     */
143
    public function getMin(): string
144
    {
145
        return $this->min;
146
    }
147
148
    /**
149
     * @param string $min
150
     */
151
    public function setMin(string $min)
152
    {
153
        $this->min = $min;
154
    }
155
156
    /**
157
     * @return Carbon
158
     */
159
    public function getPayDate(): Carbon
160
    {
161
        return $this->payDate;
162
    }
163
164
    /**
165
     * @param Carbon $payDate
166
     */
167
    public function setPayDate(Carbon $payDate): void
168
    {
169
        $this->payDate = $payDate;
170
    }
171
172
    /**
173
     * @return int
174
     */
175
    public function getTransactionJournalId(): int
176
    {
177
        return $this->transactionJournalId ?? 0;
178
    }
179
180
    /**
181
     * @param int $transactionJournalId
182
     */
183
    public function setTransactionJournalId(int $transactionJournalId)
184
    {
185
        $this->transactionJournalId = $transactionJournalId;
186
    }
187
188
    /**
189
     * @return bool
190
     */
191
    public function isActive(): bool
192
    {
193
        return 1 === intval($this->bill->active);
0 ignored issues
show
The property active does not seem to exist on FireflyIII\Models\Bill. Are you sure there is no database migration missing?

Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.

Loading history...
194
    }
195
196
    /**
197
     * @return bool
198
     */
199
    public function isHit(): bool
200
    {
201
        return $this->hit;
202
    }
203
204
    /**
205
     * @param bool $hit
206
     */
207
    public function setHit(bool $hit)
208
    {
209
        $this->hit = $hit;
210
    }
211
}
212