AbstractRelationalRepository::findBy()   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 3
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
abstract class AbstractRelationalRepository extends AbstractRepository
8
{
9
    /**
10
     * Returns all upcoming tasks assigned to the authenticated user related to
11
     * a person, company, case, or deal.
12
     *
13
     * @param string $name The name of the resource for which tasks should be
14
     *                     returned.
15
     * @param mixed $id The resource ID.
16
     * @param array $filters  The request filters.
17
     * @return CollectionInterface
18
     */
19
    public function findBy(string $name, $id, array $filters = []): CollectionInterface
20
    {
21
        $uri = sprintf('/%s/%s/%s.xml', $name, $id, $this->getName());
22
        $results = $this->getAdapter()->request('GET', $uri, ['query' => $filters]);
23
        return $this->hydrate($results);
24
    }
25
}
26