Request   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 37
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 2

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A isInitialized() 0 4 1
A urlBase() 0 4 1
1
<?php
2
3
namespace Scriptotek\Alma\Users;
4
5
use Scriptotek\Alma\Client;
6
use Scriptotek\Alma\Model\LazyResource;
7
8
/**
9
 * A single Request resource.
10
 */
11
class Request extends LazyResource
12
{
13
    /* @var User */
14
    public $user;
15
16
    /* @var string */
17
    public $request_id;
18
19
    public function __construct(Client $client, User $user, $request_id)
20
    {
21
        parent::__construct($client);
22
        $this->user = $user;
23
        $this->request_id = $request_id;
24
    }
25
26
    /**
27
     * Check if we have the full representation of our data object.
28
     *
29
     * @param \stdClass $data
30
     *
31
     * @return bool
32
     */
33
    protected function isInitialized($data)
34
    {
35
        return isset($data->request_type);
36
    }
37
38
    /**
39
     * Generate the base URL for this resource.
40
     *
41
     * @return string
42
     */
43
    protected function urlBase()
44
    {
45
        return sprintf('/users/%s/requests/%s', rawurlencode($this->user->id), $this->request_id);
46
    }
47
}
48