mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-12-29 02:11:12 -06:00
57 lines
901 B
PHP
57 lines
901 B
PHP
<?php
|
|
declare(strict_types = 1);
|
|
namespace FireflyIII\Helpers\Collection;
|
|
|
|
|
|
use Illuminate\Support\Collection;
|
|
|
|
/**
|
|
* @codeCoverageIgnore
|
|
* Class Bill
|
|
*
|
|
* @package FireflyIII\Helpers\Collection
|
|
*/
|
|
class Bill
|
|
{
|
|
|
|
/**
|
|
* @var Collection
|
|
*/
|
|
protected $bills;
|
|
|
|
/**
|
|
*
|
|
*/
|
|
public function __construct()
|
|
{
|
|
$this->bills = new Collection;
|
|
}
|
|
|
|
/**
|
|
* @param BillLine $bill
|
|
*/
|
|
public function addBill(BillLine $bill)
|
|
{
|
|
$this->bills->push($bill);
|
|
}
|
|
|
|
/**
|
|
* @return Collection
|
|
*/
|
|
public function getBills()
|
|
{
|
|
$set = $this->bills->sortBy(
|
|
function (BillLine $bill) {
|
|
$active = intval($bill->getBill()->active) == 0 ? 1 : 0;
|
|
$name = $bill->getBill()->name;
|
|
|
|
return $active . $name;
|
|
}
|
|
);
|
|
|
|
|
|
return $set;
|
|
}
|
|
|
|
}
|