Some code cleanup courtesy of PHPStorm.

This commit is contained in:
James Cole
2016-01-15 18:21:59 +01:00
parent f69be86c74
commit dcbfe90cf7
8 changed files with 43 additions and 21 deletions

View File

@@ -55,8 +55,6 @@ class CategoryController extends Controller
$start = Navigation::startOfPeriod($start, $range);
$end = new Carbon;
$entries = new Collection;
// chart properties for cache:
$cache = new CacheProperties();
$cache->addProperty($start);
@@ -71,26 +69,19 @@ class CategoryController extends Controller
while ($start <= $end) {
$currentEnd = Navigation::endOfPeriod($start, $range);
// get the sum from $spentArray and $earnedArray:
$spent = $this->getSumOfRange($start, $currentEnd, $spentArray);
$earned = $this->getSumOfRange($start, $currentEnd, $earnedArray);
$date = Navigation::periodShow($start, $range);
$spent = $this->getSumOfRange($start, $currentEnd, $spentArray);
$earned = $this->getSumOfRange($start, $currentEnd, $earnedArray);
$date = Navigation::periodShow($start, $range);
$entries->push([clone $start, $date, $spent, $earned]);
$start = Navigation::addPeriod($start, $range, 0);
}
// limit the set to the last 40:
$entries = $entries->reverse();
$entries = $entries->slice(0, 48);
$entries = $entries->reverse();
$data = $this->generator->all($entries);
$data = $this->generator->all($entries);
$cache->store($data);
return Response::json($data);
}