Completed
Push — master ( 59bbf4...e1ffc2 )
by Guillermo A.
01:39
created

Tasks::findAll()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Guillermoandrae\Highrise\Resources;
4
5
use Guillermoandrae\Common\CollectionInterface;
6
7
class Tasks extends AbstractRelationalResource
8
{
9
    use UnsearchableResourceTrait;
10
11 1
    public function findAll(array $filters = []): CollectionInterface
12
    {
13 1
        $uri = sprintf('/%s/all.xml', $this->getName());
14 1
        return $this->getAdapter()->request('GET', $uri);
15
    }
16
17
    /**
18
     * Returns all upcoming tasks assigned to the authenticated user.
19
     *
20
     * @return CollectionInterface
21
     */
22 1
    public function findUpcoming(): CollectionInterface
23
    {
24 1
        $uri = sprintf('/%s/upcoming.xml', $this->getName());
25 1
        return $this->getAdapter()->request('GET', $uri);
26
    }
27
28
    /**
29
     * Returns all assigned tasks assigned to the authenticated user.
30
     *
31
     * @return CollectionInterface
32
     */
33 1
    public function findAssigned(): CollectionInterface
34
    {
35 1
        $uri = sprintf('/%s/assigned.xml', $this->getName());
36 1
        return $this->getAdapter()->request('GET', $uri);
37
    }
38
39
    /**
40
     * Returns all completed tasks assigned to the authenticated user.
41
     *
42
     * @return CollectionInterface
43
     */
44 1
    public function findCompleted(): CollectionInterface
45
    {
46 1
        $uri = sprintf('/%s/completed.xml', $this->getName());
47 1
        return $this->getAdapter()->request('GET', $uri);
48
    }
49
50
    /**
51
     * Returns all of today's tasks assigned to the authenticated user.
52
     *
53
     * @return CollectionInterface
54
     */
55 1
    public function findToday(): CollectionInterface
56
    {
57 1
        $uri = sprintf('/%s/today.xml', $this->getName());
58 1
        return $this->getAdapter()->request('GET', $uri);
59
    }
60
}
61