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

Library::urlBase()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 4
loc 4
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\GhostModel;
7
8 View Code Duplication
class Library extends GhostModel
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...
9
{
10
    /** @var string */
11
    public $code;
12
13
    /** @var Locations */
14
    public $locations;
15
16
    /**
17
     * Library 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
        $this->locations = Locations::make($this->client, $this);
27
    }
28
29
    /**
30
     * Check if we have the full representation of our data object.
31
     * For libraries, it seems like we get the same data in the list
32
     * response as in the single-item response, so we just check some
33
     * random element.
34
     *
35
     * @param \stdClass $data
36
     * @return boolean
37
     */
38
    protected function isInitialized($data)
39
    {
40
        return isset($data->path);
41
    }
42
43
    /**
44
     * Generate the base URL for this resource.
45
     *
46
     * @return string
47
     */
48
    protected function urlBase()
49
    {
50
        return "/conf/libraries/{$this->code}";
51
    }
52
}
53