1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* @package Packer |
5
|
|
|
* @author Iurii Makukh <[email protected]> |
6
|
|
|
* @copyright Copyright (c) 2018, Iurii Makukh <[email protected]> |
7
|
|
|
* @license https://www.gnu.org/licenses/gpl-3.0.en.html GPL-3.0-or-later |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
namespace gplcart\modules\packer\helpers; |
11
|
|
|
|
12
|
|
|
use DVDoug\BoxPacker\Box as BoxInterface; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* Box object used by Packer library |
16
|
|
|
*/ |
17
|
|
|
class Box implements BoxInterface |
18
|
|
|
{ |
19
|
|
|
/** |
20
|
|
|
* Box data array |
21
|
|
|
* @var array |
22
|
|
|
*/ |
23
|
|
|
private $box; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Box constructor. |
27
|
|
|
* @param array $box |
28
|
|
|
*/ |
29
|
|
|
public function __construct(array $box) |
30
|
|
|
{ |
31
|
|
|
$this->box = $box; |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @return array |
36
|
|
|
*/ |
37
|
|
|
public function getBoxData() |
38
|
|
|
{ |
39
|
|
|
return $this->box; |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @return string |
44
|
|
|
*/ |
45
|
|
|
public function getReference() |
46
|
|
|
{ |
47
|
|
|
return $this->box['name']; |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @return int |
52
|
|
|
*/ |
53
|
|
|
public function getOuterWidth() |
54
|
|
|
{ |
55
|
|
|
return $this->box['outer_width']; |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @return int |
60
|
|
|
*/ |
61
|
|
|
public function getOuterLength() |
62
|
|
|
{ |
63
|
|
|
return $this->box['outer_length']; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* @return int |
68
|
|
|
*/ |
69
|
|
|
public function getOuterDepth() |
70
|
|
|
{ |
71
|
|
|
return $this->box['outer_depth']; |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* @return int |
76
|
|
|
*/ |
77
|
|
|
public function getEmptyWeight() |
78
|
|
|
{ |
79
|
|
|
return $this->box['empty_weight']; |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* @return int |
84
|
|
|
*/ |
85
|
|
|
public function getInnerWidth() |
86
|
|
|
{ |
87
|
|
|
return $this->box['inner_width']; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* @return int |
92
|
|
|
*/ |
93
|
|
|
public function getInnerLength() |
94
|
|
|
{ |
95
|
|
|
return $this->box['inner_length']; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* @return int |
100
|
|
|
*/ |
101
|
|
|
public function getInnerDepth() |
102
|
|
|
{ |
103
|
|
|
return $this->box['inner_depth']; |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* @return int |
108
|
|
|
*/ |
109
|
|
|
public function getInnerVolume() |
110
|
|
|
{ |
111
|
|
|
return $this->box['inner_volume']; |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* @return int |
116
|
|
|
*/ |
117
|
|
|
public function getMaxWeight() |
118
|
|
|
{ |
119
|
|
|
return $this->box['max_weight']; |
120
|
|
|
} |
121
|
|
|
} |