JobInstance::urlBase()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
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\Model\LazyResource;
7
8
/**
9
 * A single JobInstance resource.
10
 */
11
class JobInstance extends LazyResource
12
{
13
    /** @var Job */
14
    public $job;
15
16
    /** @var string */
17
    public $job_instance_id;
18
19
    /**
20
     * JobInstance constructor.
21
     *
22
     * @param Client $client
23
     * @param Job $job
24
     * @param string $job_instance_id
25
     */
26
    public function __construct(Client $client, Job $job, string $job_instance_id)
27
    {
28
        $this->job = $job;
29
        $this->job_instance_id = $job_instance_id;
30
        parent::__construct($client);
31
    }
32
33
    /**
34
     * Check if we have the full representation of our data object.
35
     *
36
     * @param \stdClass $data
37
     *
38
     * @return bool
39
     */
40
    protected function isInitialized($data)
41
    {
42
        return isset($data->job_info);
43
    }
44
45
    /**
46
     * Generate the base URL for this resource.
47
     *
48
     * @return string
49
     */
50
    protected function urlBase()
51
    {
52
        return "/conf/jobs/{$this->job->job_id}/instances/{$this->job_instance_id}";
53
    }
54
}
55