CasesRepository   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 33
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A findOpen() 0 5 1
A findClosed() 0 5 1
A findAll() 0 3 1
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