Location::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 6
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 3
dl 6
loc 6
rs 10
c 0
b 0
f 0
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 Location resource.
10
 */
11 View Code Duplication
class Location extends LazyResource
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
12
{
13
    /** @var Library */
14
    public $library;
15
16
    /** @var string */
17
    public $code;
18
19
    public function __construct(Client $client, Library $library, $code)
20
    {
21
        parent::__construct($client);
22
        $this->library = $library;
23
        $this->code = $code;
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->location);
36
    }
37
38
    /**
39
     * Generate the base URL for this resource.
40
     *
41
     * @return string
42
     */
43
    protected function urlBase()
44
    {
45
        return "/conf/libraries/{$this->library->code}/locations/{$this->code}";
46
    }
47
}
48