Test Setup Failed
Pull Request — master (#24)
by
unknown
05:52
created

CodeTable   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

3 Methods

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