@@ -57,43 +57,115 @@ public function setIsbn(?string $isbn): void
5757 $ this ->setData ('isbn ' , $ isbn );
5858 }
5959
60- public function getWidth (): ?float
60+ public function getWidthMm (): ?float
6161 {
62- return $ this ->getData ('width ' );
62+ return $ this ->getData ('widthMm ' );
6363 }
6464
65- public function setWidth (?float $ width ): void
65+ public function setWidthMm (?float $ widthMm , bool $ convert = false ): void
6666 {
67- $ this ->setData ('width ' , $ width );
67+ $ this ->setData ('widthMm ' , $ widthMm );
68+
69+ if ($ convert ) {
70+ $ this ->setData ('widthIn ' , $ widthMm ? round ($ widthMm / 25.4 , 2 ) : null );
71+ }
72+ }
73+
74+ public function getWidthIn (): ?float
75+ {
76+ return $ this ->getData ('widthIn ' );
77+ }
78+
79+ public function setWidthIn (?float $ widthIn , bool $ convert = false ): void
80+ {
81+ $ this ->setData ('widthIn ' , $ widthIn );
82+
83+ if ($ convert ) {
84+ $ this ->setData ('widthMm ' , $ widthIn ? round ($ widthIn * 25.4 , 2 ) : null );
85+ }
86+ }
87+
88+ public function getHeightMm (): ?float
89+ {
90+ return $ this ->getData ('heightMm ' );
91+ }
92+
93+ public function setHeightMm (?float $ heightMm , bool $ convert = false ): void
94+ {
95+ $ this ->setData ('heightMm ' , $ heightMm );
96+
97+ if ($ convert ) {
98+ $ this ->setData ('heightIn ' , $ heightMm ? round ($ heightMm / 25.4 , 2 ) : null );
99+ }
100+ }
101+
102+ public function getHeightIn (): ?float
103+ {
104+ return $ this ->getData ('heightIn ' );
105+ }
106+
107+ public function setHeightIn (?float $ heightIn , bool $ convert = false ): void
108+ {
109+ $ this ->setData ('heightIn ' , $ heightIn );
110+
111+ if ($ convert ) {
112+ $ this ->setData ('heightMm ' , $ heightIn ? round ($ heightIn * 25.4 , 2 ) : null );
113+ }
114+ }
115+
116+ public function getDepthMm (): ?float
117+ {
118+ return $ this ->getData ('depthMm ' );
119+ }
120+
121+ public function setDepthMm (?float $ depthMm , bool $ convert = false ): void
122+ {
123+ $ this ->setData ('depthMm ' , $ depthMm );
124+
125+ if ($ convert ) {
126+ $ this ->setData ('depthIn ' , $ depthMm ? round ($ depthMm / 25.4 , 2 ) : null );
127+ }
68128 }
69129
70- public function getHeight (): ?float
130+ public function getDepthIn (): ?float
71131 {
72- return $ this ->getData ('height ' );
132+ return $ this ->getData ('depthIn ' );
73133 }
74134
75- public function setHeight (?float $ height ): void
135+ public function setDepthIn (?float $ depthIn , bool $ convert = false ): void
76136 {
77- $ this ->setData ('height ' , $ height );
137+ $ this ->setData ('depthIn ' , $ depthIn );
138+
139+ if ($ convert ) {
140+ $ this ->setData ('depthMm ' , $ depthIn ? round ($ depthIn * 25.4 , 2 ) : null );
141+ }
78142 }
79143
80- public function getDepth (): ?float
144+ public function getWeightG (): ?float
81145 {
82- return $ this ->getData ('depth ' );
146+ return $ this ->getData ('weightG ' );
83147 }
84148
85- public function setDepth (?float $ depth ): void
149+ public function setWeightG (?float $ weightG , bool $ convert = false ): void
86150 {
87- $ this ->setData ('depth ' , $ depth );
151+ $ this ->setData ('weightG ' , $ weightG );
152+
153+ if ($ convert ) {
154+ $ this ->setData ('weightOz ' , $ weightG ? round ($ weightG / 28.349523125 , 4 ) : null );
155+ }
88156 }
89157
90- public function getWeight (): ?float
158+ public function getWeightOz (): ?float
91159 {
92- return $ this ->getData ('weight ' );
160+ return $ this ->getData ('weightOz ' );
93161 }
94162
95- public function setWeight (?float $ weight ): void
163+ public function setWeightOz (?float $ weightOz , bool $ convert = false ): void
96164 {
97- $ this ->setData ('weight ' , $ weight );
165+ $ this ->setData ('weightOz ' , $ weightOz );
166+
167+ if ($ convert ) {
168+ $ this ->setData ('weightG ' , $ weightOz ? round ($ weightOz * 28.349523125 , 4 ) : null );
169+ }
98170 }
99171}
0 commit comments