ScanInResponse   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 71
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
dl 0
loc 71
rs 10
c 0
b 0
f 0
wmc 5
lcom 1
cbo 4

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getMessage() 0 4 1
A getItem() 0 12 1
A getHolding() 0 10 1
A getBib() 0 7 1
1
<?php
2
3
namespace Scriptotek\Alma\Bibs;
4
5
use Scriptotek\Alma\Client;
6
use Scriptotek\Alma\Model\Model;
7
8
/**
9
 * Response from a scan-in operation of some Item resource.
10
 */
11
class ScanInResponse extends Model
12
{
13
    protected $data;
14
15
    /**
16
     * ScanInResponse constructor.
17
     *
18
     * @param Client $client
19
     */
20
    public function __construct(Client $client, $data)
21
    {
22
        parent::__construct($client, $data);
23
    }
24
25
    /**
26
     * Get the scan-in response message.
27
     *
28
     * @return string
29
     */
30
    public function getMessage()
31
    {
32
        return $this->data->additional_info;
33
    }
34
35
    /**
36
     * Get the scanned-in item.
37
     *
38
     * @return Item
39
     */
40
    public function getItem()
41
    {
42
        $bib = Bib::make($this->client, $this->data->bib_data->mms_id);
43
        $holding = Holding::make($this->client, $bib, $this->data->holding_data->holding_id);
44
45
        return Item::make(
46
            $this->client,
47
            $bib,
48
            $holding,
49
            $this->data->item_data->pid
50
        )->init($this->data->item_data);
51
    }
52
53
    /**
54
     * Get the Holding object for the scanned-in item.
55
     *
56
     * @return Holding
57
     */
58
    public function getHolding()
59
    {
60
        $bib = Bib::make($this->client, $this->data->bib_data->mms_id);
61
62
        return Holding::make(
63
            $this->client,
64
            $bib,
65
            $this->data->holding_data->holding_id
66
        )->init($this->data->holding_data);
67
    }
68
69
    /**
70
     * Get the Bib object for the scanned-in item.
71
     *
72
     * @return Bib
73
     */
74
    public function getBib()
75
    {
76
        return Bib::make(
77
            $this->client,
78
            $this->data->bib_data->mms_id
79
        )->init($this->data->bib_data);
80
    }
81
}
82