Skip to content

Commit a1da04a

Browse files
committed
more params
1 parent 251c886 commit a1da04a

2 files changed

Lines changed: 181 additions & 9 deletions

File tree

entity/HeurekaProduct.php

Lines changed: 125 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*/
88

99
namespace Relisoft\XMLParser\Entity;
10+
use Tracy\Debugger;
1011

1112

1213
/**
@@ -52,22 +53,57 @@ class HeurekaProduct
5253
*/
5354
private $delivery_date;
5455

56+
/**
57+
* @var string
58+
*/
59+
private $ppchitname;
60+
61+
/**
62+
* @var array
63+
*/
64+
private $param;
65+
/**
66+
* @var string
67+
*/
68+
private $ean;
69+
/**
70+
* @var int
71+
*/
72+
private $itemgroup_id;
73+
/**
74+
* @var string
75+
*/
76+
private $manufacturer;
77+
5578
/**
5679
* HeurekaProduct constructor.
5780
* @param array $data
5881
*/
5982
public function __construct(array $data)
6083
{
6184
try{
62-
$this->setId($data['ITEM_ID']);
63-
$this->setProductname($data['PRODUCTNAME']);
64-
$this->setProduct($data['PRODUCT']);
65-
$this->setUrl($data['URL']);
66-
$this->setImg($data['IMGURL']);
67-
$this->setDescription($data['DESCRIPTION']);
68-
$this->setCategorytext($data['CATEGORYTEXT']);
69-
$this->setDeliveryDate($data['DELIVERY_DATE']);
70-
$this->setPriceVat($data['PRICE_VAT']);
85+
$this->setId(isset($data['ITEM_ID']) ? $data['ITEM_ID'] : null);
86+
$this->setProductname(isset($data['PRODUCTNAME']) ? $data['PRODUCTNAME'] : null);
87+
$this->setProduct(isset($data['PRODUCT']) ? $data['PRODUCT'] : null);
88+
$this->setUrl(isset($data['URL']) ? $data['URL'] : null);
89+
$this->setImg(isset($data['IMGURL']) ? $data['IMGURL'] : null);
90+
$this->setDescription(isset($data['DESCRIPTION']) ? $data['DESCRIPTION'] : null);
91+
$this->setCategorytext(isset($data['CATEGORYTEXT']) ? $data['CATEGORYTEXT'] : null);
92+
$this->setDeliveryDate(isset($data['DELIVERY_DATE']) ? $data['DELIVERY_DATE'] : null);
93+
$this->setPriceVat(isset($data['PRICE_VAT']) ? $data['PRICE_VAT'] : null);
94+
$this->setEan(isset($data['EAN']) ? $data['EAN'] : null);
95+
$this->setItemgroupId(isset($data['ITEMGROUP_ID']) ? $data['ITEMGROUP_ID'] : null);
96+
$this->setPpchitname(isset($data['PPCHITNAME']) ? $data['PPCHITNAME'] : null);
97+
$this->setManufacturer(isset($data['MANUFACTURER']) ? $data['MANUFACTURER'] : null);
98+
if(isset($data["PARAM"])){
99+
foreach ($data["PARAM"] as $param){
100+
if(is_array($param)){
101+
$this->param[] = new HeurekaProductParam($param);
102+
}else{
103+
$this->param[] = new HeurekaProductParam($data["PARAM"]);
104+
}
105+
}
106+
}
71107
}catch (\Exception $e){
72108
throw new \UnexpectedValueException('Wrong data schema!');
73109
}
@@ -97,6 +133,86 @@ public function getProductname()
97133
return $this->productname;
98134
}
99135

136+
/**
137+
* @return string
138+
*/
139+
public function getPpchitname(): string
140+
{
141+
return $this->ppchitname;
142+
}
143+
144+
/**
145+
* @param string $ppchitname
146+
*/
147+
public function setPpchitname(string $ppchitname): void
148+
{
149+
$this->ppchitname = $ppchitname;
150+
}
151+
152+
/**
153+
* @return array
154+
*/
155+
public function getParam(): array
156+
{
157+
return $this->param;
158+
}
159+
160+
/**
161+
* @param array $param
162+
*/
163+
public function setParam(array $param): void
164+
{
165+
$this->param = $param;
166+
}
167+
168+
/**
169+
* @return string
170+
*/
171+
public function getEan(): string
172+
{
173+
return $this->ean;
174+
}
175+
176+
/**
177+
* @param string $ean
178+
*/
179+
public function setEan(string $ean): void
180+
{
181+
$this->ean = $ean;
182+
}
183+
184+
/**
185+
* @return int
186+
*/
187+
public function getItemgroupId(): int
188+
{
189+
return $this->itemgroup_id;
190+
}
191+
192+
/**
193+
* @param int $itemgroup_id
194+
*/
195+
public function setItemgroupId(int $itemgroup_id): void
196+
{
197+
$this->itemgroup_id = $itemgroup_id;
198+
}
199+
200+
/**
201+
* @return string
202+
*/
203+
public function getManufacturer(): string
204+
{
205+
return $this->manufacturer;
206+
}
207+
208+
/**
209+
* @param string $manufacturer
210+
*/
211+
public function setManufacturer(string $manufacturer): void
212+
{
213+
$this->manufacturer = $manufacturer;
214+
}
215+
100216
/**
101217
* @param mixed $productname
102218
*/

entity/HeurekaProductParam.php

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?php
2+
/**
3+
* Created by PhpStorm.
4+
* User: Isigar
5+
* Date: 9/12/2018
6+
* Time: 9:10 AM
7+
*/
8+
9+
namespace Relisoft\XMLParser\Entity;
10+
11+
12+
class HeurekaProductParam
13+
{
14+
private $param_name;
15+
private $val;
16+
17+
public function __construct(array $data)
18+
{
19+
$this->setParamName(isset($data["PARAM_NAME"]) ? $data["PARAM_NAME"] : null);
20+
$this->setVal(isset($data["VAL"]) ? $data["VAL"] : null);
21+
}
22+
23+
/**
24+
* @return mixed
25+
*/
26+
public function getParamName()
27+
{
28+
return $this->param_name;
29+
}
30+
31+
/**
32+
* @param mixed $param_name
33+
*/
34+
public function setParamName($param_name): void
35+
{
36+
$this->param_name = $param_name;
37+
}
38+
39+
/**
40+
* @return mixed
41+
*/
42+
public function getVal()
43+
{
44+
return $this->val;
45+
}
46+
47+
/**
48+
* @param mixed $val
49+
*/
50+
public function setVal($val): void
51+
{
52+
$this->val = $val;
53+
}
54+
55+
56+
}

0 commit comments

Comments
 (0)