Files
firefly-iii/app/Helpers/Collection/Bill.php

57 lines
876 B
PHP
Raw Normal View History

<?php
namespace FireflyIII\Helpers\Collection;
use Illuminate\Support\Collection;
/**
2015-05-21 07:30:38 +02:00
* @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()
{
$this->bills->sortBy(
function (BillLine $bill) {
$active = intval($bill->getBill()->active) == 0 ? 1 : 0;
2015-05-20 19:55:53 +02:00
$name = $bill->getBill()->name;
return $active . $name;
}
);
return $this->bills;
}
2015-05-20 19:56:14 +02:00
}