Test Failed
Push — master ( c6b6d3...528954 )
by Dan Michael O.
03:21
created

Loan::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 4
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Scriptotek\Alma\Users;
4
5
use Scriptotek\Alma\Bibs\Item;
6
use Scriptotek\Alma\Client;
7
use Scriptotek\Alma\GhostModel;
8
9
class Loan extends GhostModel
10
{
11
    /* @var User */
12
    protected $user;
13
14
    /* @var Item */
15
    protected $item;
16
17
    /* @var string */
18
    protected $loan_id;
19
20
    public function __construct(Client $client, User $user, Item $item, $loan_id)
21
    {
22
        parent::__construct($client);
23
        $this->user = $user;
24
        $this->item = $item;
25
        $this->loan_id = $loan_id;
26
    }
27
28
    /**
29
     * Generate the base URL for this resource.
30
     *
31
     * @return string
32
     */
33
    protected function urlBase()
34
    {
35
        return "/users/{$this->user->id}/loans/{$this->loan_id}";
36
    }
37
38
    /**
39
     * Check if we have the full representation of our data object.
40
     *
41
     * @param \stdClass $data
42
     * @return boolean
43
     */
44
    protected function isInitialized($data)
45
    {
46
        return isset($data->loan_id);
47
    }
48
}
49