TasksRepository::findCompleted()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Guillermoandrae\Highrise\Repositories;
4
5
use Guillermoandrae\Common\CollectionInterface;
6
7
class TasksRepository extends AbstractRelationalRepository
8
{
9
    use UnsearchableRepositoryTrait;
10
11
    public function findAll(int $offset = 0, int $limit = null): CollectionInterface
12
    {
13
        $uri = sprintf('/%s/all.xml', $this->getName());
14
        $results = $this->getAdapter()->request('GET', $uri);
15
        return $this->hydrate($results);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->hydrate($results) also could return the type Guillermoandrae\Highrise...ls\ModelInterface|array which is incompatible with the return type mandated by Guillermoandrae\Highrise...ctRepository::findAll() of Guillermoandrae\Common\CollectionInterface.
Loading history...
16
    }
17
18
    /**
19
     * Returns all upcoming tasks assigned to the authenticated user.
20
     *
21
     * @return CollectionInterface
22
     */
23
    public function findUpcoming(): CollectionInterface
24
    {
25
        $uri = sprintf('/%s/upcoming.xml', $this->getName());
26
        $results = $this->getAdapter()->request('GET', $uri);
27
        return $this->hydrate($results);
28
    }
29
30
    /**
31
     * Returns all assigned tasks assigned to the authenticated user.
32
     *
33
     * @return CollectionInterface
34
     */
35
    public function findAssigned(): CollectionInterface
36
    {
37
        $uri = sprintf('/%s/assigned.xml', $this->getName());
38
        $results = $this->getAdapter()->request('GET', $uri);
39
        return $this->hydrate($results);
40
    }
41
42
    /**
43
     * Returns all completed tasks assigned to the authenticated user.
44
     *
45
     * @return CollectionInterface
46
     */
47
    public function findCompleted(): CollectionInterface
48
    {
49
        $uri = sprintf('/%s/completed.xml', $this->getName());
50
        $results = $this->getAdapter()->request('GET', $uri);
51
        return $this->hydrate($results);
52
    }
53
54
    /**
55
     * Returns all of today's tasks assigned to the authenticated user.
56
     *
57
     * @return CollectionInterface
58
     */
59
    public function findToday(): CollectionInterface
60
    {
61
        $uri = sprintf('/%s/today.xml', $this->getName());
62
        $results = $this->getAdapter()->request('GET', $uri);
63
        return $this->hydrate($results);
64
    }
65
}
66