summaryrefslogtreecommitdiff
path: root/app/Formatter/TaskListProjectFormatter.php
blob: 109e9a2dc07cb433798ea6b8efca31c75c22ee77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php

namespace Kanboard\Formatter;

use Kanboard\Formatter\TaskListFormatter;

/**
 * Class TaskListProjectFormatter
 *
 * @package Kanboard\Formatter
 */
class TaskListProjectFormatter extends TaskListFormatter
{
    /**
     * Apply formatter
     *
     * @access public
     * @return array
     */
    public function format()
    {
        $tasks = parent::format();
        $prev = NULL;
        foreach ($tasks as &$task) {
            $task['render_project_name'] = (!$prev || $prev['project_name'] != $task['project_name']);
            $prev = $task;
        }
        return $tasks;
    }
}