2015-05-16 07:51:23 -05:00
|
|
|
<?php
|
2016-05-20 05:27:31 -05:00
|
|
|
/**
|
|
|
|
* Balance.php
|
|
|
|
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
|
|
|
*
|
2016-10-04 23:52:15 -05:00
|
|
|
* 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-05-20 05:27:31 -05:00
|
|
|
*/
|
|
|
|
|
2017-04-09 00:44:22 -05:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2015-05-16 07:51:23 -05:00
|
|
|
namespace FireflyIII\Helpers\Collection;
|
2015-05-20 12:55:53 -05:00
|
|
|
|
2015-05-16 07:51:23 -05:00
|
|
|
use Illuminate\Support\Collection;
|
|
|
|
|
|
|
|
/**
|
2015-05-16 12:08:54 -05:00
|
|
|
*
|
2015-05-16 07:51:23 -05:00
|
|
|
* Class Balance
|
|
|
|
*
|
|
|
|
* @package FireflyIII\Helpers\Collection
|
|
|
|
*/
|
|
|
|
class Balance
|
|
|
|
{
|
|
|
|
|
|
|
|
/** @var BalanceHeader */
|
|
|
|
protected $balanceHeader;
|
|
|
|
|
|
|
|
/** @var Collection */
|
|
|
|
protected $balanceLines;
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
$this->balanceLines = new Collection;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param BalanceLine $line
|
|
|
|
*/
|
|
|
|
public function addBalanceLine(BalanceLine $line)
|
|
|
|
{
|
|
|
|
$this->balanceLines->push($line);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return BalanceHeader
|
|
|
|
*/
|
2016-02-18 00:21:48 -06:00
|
|
|
public function getBalanceHeader(): BalanceHeader
|
2015-05-16 07:51:23 -05:00
|
|
|
{
|
2016-03-02 06:13:33 -06:00
|
|
|
return $this->balanceHeader ?? new BalanceHeader;
|
2015-05-16 07:51:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param BalanceHeader $balanceHeader
|
|
|
|
*/
|
2016-02-05 02:25:15 -06:00
|
|
|
public function setBalanceHeader(BalanceHeader $balanceHeader)
|
2015-05-16 07:51:23 -05:00
|
|
|
{
|
|
|
|
$this->balanceHeader = $balanceHeader;
|
|
|
|
}
|
|
|
|
|
2015-05-16 08:43:58 -05:00
|
|
|
/**
|
2016-02-18 00:21:48 -06:00
|
|
|
* @return Collection
|
2015-05-16 08:43:58 -05:00
|
|
|
*/
|
2016-02-18 00:21:48 -06:00
|
|
|
public function getBalanceLines(): Collection
|
2015-05-16 08:43:58 -05:00
|
|
|
{
|
|
|
|
return $this->balanceLines;
|
|
|
|
}
|
|
|
|
|
2016-04-29 04:05:52 -05:00
|
|
|
/**
|
|
|
|
* @param Collection $balanceLines
|
|
|
|
*/
|
|
|
|
public function setBalanceLines(Collection $balanceLines)
|
|
|
|
{
|
|
|
|
$this->balanceLines = $balanceLines;
|
|
|
|
}
|
|
|
|
|
2015-05-16 08:43:58 -05:00
|
|
|
|
2015-05-20 12:56:14 -05:00
|
|
|
}
|