CasesRepository::findClosed()   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\Collection;
6
use Guillermoandrae\Common\CollectionInterface;
7
8
final class CasesRepository extends AbstractRepository
9
{
10
    use UnsearchableRepositoryTrait;
11
12
    protected $name = 'kases';
13
14
    public function findAll(int $offset = 0, int $limit = null): CollectionInterface
15
    {
16
        return $this->findOpen();
17
    }
18
19
    /**
20
     * Returns all open cases.
21
     *
22
     * @return CollectionInterface
23
     */
24
    public function findOpen(): CollectionInterface
25
    {
26
        $uri = sprintf('/%s/open.xml', $this->getName());
27
        $results = $this->getAdapter()->request('GET', $uri);
28
        return $this->hydrate($results);
29
    }
30
31
    /**
32
     * Returns all closed cases.
33
     *
34
     * @return CollectionInterface
35
     */
36
    public function findClosed(): CollectionInterface
37
    {
38
        $uri = sprintf('/%s/closed.xml', $this->getName());
39
        $results = $this->getAdapter()->request('GET', $uri);
40
        return $this->hydrate($results);
41
    }
42
}
43