firefly-iii/app/Helpers/Collection/BillLine.php

172 lines
2.9 KiB
PHP
Raw Normal View History

<?php
/**
* BillLine.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International License.
*
* See the LICENSE file for details.
*/
2016-02-05 05:08:25 -06:00
declare(strict_types = 1);
namespace FireflyIII\Helpers\Collection;
2016-11-20 05:08:43 -06:00
use Carbon\Carbon;
use FireflyIII\Models\Bill as BillModel;
/**
2015-05-21 00:30:38 -05:00
*
* Class BillLine
*
* @package FireflyIII\Helpers\Collection
*/
class BillLine
{
2015-06-14 01:22:02 -05:00
/** @var string */
protected $amount;
/** @var BillModel */
protected $bill;
/** @var bool */
protected $hit;
2015-06-14 01:22:02 -05:00
/** @var string */
protected $max;
2015-06-14 01:22:02 -05:00
/** @var string */
protected $min;
2016-11-20 05:08:43 -06:00
/** @var Carbon */
private $lastHitDate;
/** @var int */
private $transactionJournalId;
2016-11-20 05:08:43 -06:00
/**
* BillLine constructor.
*/
public function __construct()
{
$this->lastHitDate = new Carbon;
}
/**
2015-06-14 01:22:02 -05:00
* @return string
*/
2016-02-18 03:04:26 -06:00
public function getAmount(): string
{
2016-02-18 03:06:34 -06:00
return $this->amount ?? '0';
}
/**
2015-06-14 01:22:02 -05:00
* @param string $amount
*/
2016-02-05 02:25:15 -06:00
public function setAmount(string $amount)
{
$this->amount = $amount;
}
/**
* @return BillModel
*/
2016-02-18 03:04:26 -06:00
public function getBill(): BillModel
{
return $this->bill;
}
/**
* @param BillModel $bill
*/
2016-02-05 02:25:15 -06:00
public function setBill(BillModel $bill)
{
$this->bill = $bill;
}
/**
2015-06-14 01:22:02 -05:00
* @return string
*/
2016-02-18 03:04:26 -06:00
public function getMax(): string
{
return $this->max;
}
/**
2015-06-14 01:22:02 -05:00
* @param string $max
*/
2016-02-05 02:25:15 -06:00
public function setMax(string $max)
{
$this->max = $max;
}
/**
2015-06-14 01:22:02 -05:00
* @return string
*/
2016-02-18 03:04:26 -06:00
public function getMin(): string
{
return $this->min;
}
/**
2015-06-14 01:22:02 -05:00
* @param string $min
*/
2016-02-05 02:25:15 -06:00
public function setMin(string $min)
{
$this->min = $min;
}
/**
* @return int
*/
public function getTransactionJournalId(): int
{
return $this->transactionJournalId ?? 0;
}
/**
* @param int $transactionJournalId
*/
public function setTransactionJournalId(int $transactionJournalId)
{
$this->transactionJournalId = $transactionJournalId;
}
/**
2016-04-06 02:27:45 -05:00
* @return bool
*/
2016-02-18 03:04:26 -06:00
public function isActive(): bool
{
2016-11-20 05:08:43 -06:00
return intval($this->bill->active) === 1;
}
/**
2016-04-06 02:27:45 -05:00
* @return bool
*/
2016-02-18 03:04:26 -06:00
public function isHit(): bool
{
return $this->hit;
}
/**
2016-02-05 02:25:15 -06:00
* @param bool $hit
*/
2016-02-05 02:25:15 -06:00
public function setHit(bool $hit)
{
$this->hit = $hit;
}
2016-11-20 05:08:43 -06:00
/**
* @param Carbon $lastHitDate
*/
public function setLastHitDate(Carbon $lastHitDate)
{
$this->lastHitDate = $lastHitDate;
}
/**
* @return Carbon
*/
public function getLastHitDate(): Carbon
{
return $this->lastHitDate;
}
2015-05-20 12:56:14 -05:00
}