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

Query::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace Todo\Application\Task;
4
5
use Todo\Domain\Repository\TaskRepositoryInterface;
6
use Todo\Domain\Task;
7
8
/**
9
 * Class Query
10
 *
11
 * @category None
12
 * @package  Application\Task
13
 * @author   Martin Pham <[email protected]>
14
 * @license  None http://
15
 * @link     None
16
 */
17
class Query
18
{
19
    /**
20
     * Task Repository
21
     *
22
     * @var TaskRepositoryInterface
23
     */
24
    protected $taskRepository;
25
26
    /**
27
     * Query constructor
28
     *
29
     * @param TaskRepositoryInterface $taskRepository Task Repository
30
     */
31
    public function __construct(TaskRepositoryInterface $taskRepository)
32
    {
33
        $this->taskRepository = $taskRepository;
34
    }
35
36
    /**
37
     * Get All Remaining Tasks
38
     *
39
     * @return array
40
     */
41
    public function getAllRemainingTasks() : array
42
    {
43
        return $this->taskRepository->findAllByStatus(Task::STATUS_REMAINING);
44
    }
45
46
    /**
47
     * Get All Completed Tasks
48
     *
49
     * @return array
50
     */
51
    public function getAllCompletedTasks() : array
52
    {
53
        return $this->taskRepository->findAllByStatus(Task::STATUS_COMPLETED);
54
    }
55
56
57
}
58