28 if(isset($params[
"TIMER"]) && $params[
"DATA_SOURCE"] instanceof
Timer)
29 $this->timer = $params[
"TIMER"];
31 if(!isset($params[
"DATA_SOURCE"]) || (!($params[
"DATA_SOURCE"] instanceof Data\Sources\DataSource)))
32 throw new ArgumentException(
"DATA_SOURCE must be instanceof DataSource!",
"DATA_SOURCE");
34 if(!isset($params[
"DATA_CONVERTER"]) || (!($params[
"DATA_CONVERTER"] instanceof Data\Converters\DataConverter)))
35 throw new ArgumentException(
"DATA_CONVERTER must be instanceof DataConverter!",
"DATA_CONVERTER");
37 if(!isset($params[
"DATA_PROCESSOR"]) || (!($params[
"DATA_PROCESSOR"] instanceof Data\Processors\DataProcessor)))
38 throw new ArgumentException(
"DATA_PROCESSOR must be instanceof DataProcessor!",
"DATA_PROCESSOR");
40 if(empty($params[
"SITE_ID"]))
43 $this->sourceDataIterator = $params[
"DATA_SOURCE"];
44 $this->dataConvertor = $params[
"DATA_CONVERTER"];
45 $this->dataProcessor = $params[
"DATA_PROCESSOR"];
46 $this->site = $params[
"SITE_ID"];
51 $this->sourceDataIterator->setStartPosition($startPosition);
54 foreach($this->sourceDataIterator as $position => $data)
58 $convertedData = $this->dataConvertor->convert($data);
59 $this->dataProcessor->process($convertedData);
63 $errorsMsgs .= $e->getMessage().
'\n';
66 if ($this->timer !==
null && !$this->timer->check())
68 if(!empty($errorsMsgs))
69 $_SESSION[
'SALE_EBAY_FEED_PROCESSDATA_ERRORS'] .= $errorsMsgs;
75 if(!empty($_SESSION[
'SALE_EBAY_FEED_PROCESSDATA_ERRORS']))
77 $errorsMsgs = $_SESSION[
'SALE_EBAY_FEED_PROCESSDATA_ERRORS'].$errorsMsgs;
78 unset($_SESSION[
'SALE_EBAY_FEED_PROCESSDATA_ERRORS']);
81 if(!empty($errorsMsgs))