2014-12-27 10:21:15 -06:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace FireflyIII\Report;
|
|
|
|
|
|
|
|
use Illuminate\Support\Collection;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Interface ReportHelperInterface
|
|
|
|
*
|
|
|
|
* @package FireflyIII\Report
|
|
|
|
*/
|
|
|
|
interface ReportHelperInterface
|
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Only return the top X entries, group the rest by amount
|
|
|
|
* and described as 'Others'. id = 0 as well
|
|
|
|
*
|
|
|
|
* @param array $array
|
|
|
|
* @param int $limit
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function limitArray(array $array, $limit = 10);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Turns a collection into an array. Needs the field 'id' for the key,
|
2014-12-31 10:15:59 -06:00
|
|
|
* and saves 'name', 'amount','spent' (if present) as a sub array.
|
2014-12-27 10:21:15 -06:00
|
|
|
*
|
|
|
|
* @param Collection $collection
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function makeArray(Collection $collection);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Merges two of the arrays as defined above. Can't handle more (yet)
|
|
|
|
*
|
|
|
|
* @param array $one
|
|
|
|
* @param array $two
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function mergeArrays(array $one, array $two);
|
|
|
|
|
|
|
|
/**
|
2014-12-30 11:44:58 -06:00
|
|
|
* Sort an array where all 'amount' keys are positive floats.
|
2014-12-27 10:21:15 -06:00
|
|
|
*
|
|
|
|
* @param array $array
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
2014-12-30 11:44:58 -06:00
|
|
|
public function sortArray(array $array);
|
2014-12-27 10:21:15 -06:00
|
|
|
|
2014-12-28 01:54:53 -06:00
|
|
|
/**
|
2014-12-30 11:44:58 -06:00
|
|
|
* Sort an array where all 'amount' keys are negative floats.
|
2014-12-28 01:54:53 -06:00
|
|
|
*
|
|
|
|
* @param array $array
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
2014-12-30 11:44:58 -06:00
|
|
|
public function sortNegativeArray(array $array);
|
2014-12-28 01:54:53 -06:00
|
|
|
|
2014-12-27 10:21:15 -06:00
|
|
|
}
|