/** * Remaining grouping rows * * @param Row $last * @return array */ protected function remaining(Row $last = null) { $newRows = []; if (!is_null($last)) { foreach (array_merge(array_reverse($this->groups), [':total']) as $field) { //New row $newRow = new Row(); foreach ($this->columns as $k => $c) { //Create new cell $exists = array_key_exists($k, $this->sums[$field]); $value = $last->field($k)->getInterValue(); $newCell = new Cell($k, $exists ? $this->sums[$field][$k] : ($k == $field ? $value : '')); //Apply numeric conversions $newCell->setTotalizer(true); $this->numericConversions($k, $newCell, $last->getData()); //Add cell to new row $newRow->addCell($newCell); } //Add new row $newRows[] = $newRow; } } return $newRows; }
/** * Change background * @param $color * @param Row $row */ public static function background($color, Row $row) { $row->appendClass($color); }