Test Failed
Push — master ( faf208...51c6fd )
by Martin
14:25
created

TaskController::listAction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 1
1
<?php
2
3
namespace Todo\Web\ApiBundle\Controller;
4
5
use Todo\Application\Task\Query;
6
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
7
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
8
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
9
10
/**
11
 * Class TaskController
12
 *
13
 * @category None
14
 * @package  Web\ApiBundle\Controller
15
 * @author   Martin Pham <[email protected]>
16
 * @license  None http://
17
 * @link     None
18
 *
19
 * @Route("/task")
20
 */
21
class TaskController extends Controller
22
{
23
    /**
24
     * ListAction
25
     *
26
     * @param Query $taskQuery Task Query
27
     *
28
     * @Route("/list")
29
     * @Method({"GET"})
30
     *
31
     * @return \Symfony\Component\HttpFoundation\JsonResponse
32
     */
33
    public function listAction(
34
        Query $taskQuery
35
    ) {
36
        return $this->json(
37
            [
38
            'remaining_tasks' => $taskQuery->getAllRemainingTasks(),
39
            'completed_tasks' => $taskQuery->getAllCompletedTasks()
40
            ]
41
        );
42
    }
43
44
}
45