Initial xentral_oss_20.3.c9ffacf
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Xentral\Modules\Datanorm\Handler;
|
||||
|
||||
use Xentral\Modules\Datanorm\Exception\WrongDiscountFormatException;
|
||||
use Xentral\Modules\Datanorm\Exception\WrongPriceFormatException;
|
||||
|
||||
class AbstractDatanormReaderHandler
|
||||
{
|
||||
|
||||
/**
|
||||
* @param string $price
|
||||
*
|
||||
* @throws WrongPriceFormatException
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
protected function convertPrice(string $price): float
|
||||
{
|
||||
if (empty($price)) {
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
if (preg_match('/[^0-9]/', $price)) {
|
||||
throw new WrongPriceFormatException('price has a wrong format: ' . $price);
|
||||
}
|
||||
|
||||
return (float)$price / 100;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $discountKey
|
||||
* @param string $discount
|
||||
*
|
||||
* @throws WrongDiscountFormatException
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
protected function convertDiscount(string $discountKey, string $discount): float
|
||||
{
|
||||
if (preg_match('/[^0-9]/', $discount)) {
|
||||
throw new WrongDiscountFormatException('discount has a wrong format: ' . $discount);
|
||||
}
|
||||
|
||||
// Discount
|
||||
if ($discountKey === '1') {
|
||||
$formatted = (float)$discount / 100;
|
||||
} // Factor
|
||||
elseif ($discountKey === '2') {
|
||||
$formatted = (float)$discount / 1000;
|
||||
} // Surcharge
|
||||
elseif ($discountKey === '3') {
|
||||
$formatted = (float)$discount / 100;
|
||||
} else {
|
||||
throw new WrongDiscountFormatException(
|
||||
'DiscountKey has wrong format. Only 1,2,3 are allowed. ' . $discountKey . ' given'
|
||||
);
|
||||
}
|
||||
|
||||
return (float)$formatted;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Xentral\Modules\Datanorm\Handler;
|
||||
|
||||
use Xentral\Modules\Datanorm\Data\DatanormATypeData;
|
||||
use Xentral\Modules\Datanorm\Data\DatanormBTypeData;
|
||||
use Xentral\Modules\Datanorm\Data\DatanormDTypeData;
|
||||
use Xentral\Modules\Datanorm\Data\DatanormPTypeData;
|
||||
use Xentral\Modules\Datanorm\Data\DatanormTTypeData;
|
||||
use Xentral\Modules\Datanorm\Data\DatanormVTypeData;
|
||||
use Xentral\Modules\Datanorm\Exception\WrongPriceFormatException;
|
||||
|
||||
interface DatanormReaderHandlerInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @param string $line
|
||||
*
|
||||
* @throws WrongPriceFormatException
|
||||
*
|
||||
* @return DatanormATypeData
|
||||
*/
|
||||
public function transformToTypeA(string $line): DatanormATypeData;
|
||||
|
||||
/**
|
||||
* @param string $line
|
||||
*
|
||||
* @throws WrongPriceFormatException
|
||||
*
|
||||
* @return DatanormPTypeData
|
||||
*/
|
||||
public function transformToTypeP(string $line): DatanormPTypeData;
|
||||
|
||||
/**
|
||||
* @param string $line
|
||||
*
|
||||
* @return DatanormVTypeData
|
||||
*/
|
||||
public function transformToTypeV(string $line): DatanormVTypeData;
|
||||
|
||||
/**
|
||||
* @param string $line
|
||||
*
|
||||
* @return DatanormBTypeData
|
||||
*/
|
||||
public function transformToTypeB(string $line): DatanormBTypeData;
|
||||
|
||||
/**
|
||||
* @param string $line
|
||||
*
|
||||
* @return DatanormTTypeData
|
||||
*/
|
||||
public function transformToTypeT(string $line): DatanormTTypeData;
|
||||
|
||||
/**
|
||||
* @param string $line
|
||||
*
|
||||
* @return DatanormDTypeData
|
||||
*/
|
||||
public function transformToTypeD(string $line): DatanormDTypeData;
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getVersion(): int;
|
||||
}
|
||||
@@ -0,0 +1,264 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Xentral\Modules\Datanorm\Handler;
|
||||
|
||||
use Xentral\Modules\Datanorm\Data\DatanormATypeData;
|
||||
use Xentral\Modules\Datanorm\Data\DatanormBTypeData;
|
||||
use Xentral\Modules\Datanorm\Data\DatanormDTypeData;
|
||||
use Xentral\Modules\Datanorm\Data\DatanormPTypeData;
|
||||
use Xentral\Modules\Datanorm\Data\DatanormTTypeData;
|
||||
use Xentral\Modules\Datanorm\Data\DatanormVTypeData;
|
||||
use Xentral\Modules\Datanorm\Exception\InvalidLineException;
|
||||
use Xentral\Modules\Datanorm\Exception\WrongDiscountFormatException;
|
||||
use Xentral\Modules\Datanorm\Exception\WrongPriceFormatException;
|
||||
|
||||
final class DatanormReaderVersionFiveHandler extends AbstractDatanormReaderHandler
|
||||
implements DatanormReaderHandlerInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @param string $line
|
||||
*
|
||||
* @throws WrongPriceFormatException
|
||||
* @throws InvalidLineException
|
||||
*
|
||||
* @return DatanormATypeData
|
||||
*/
|
||||
public function transformToTypeA(string $line): DatanormATypeData
|
||||
{
|
||||
$split = explode(';', $line);
|
||||
|
||||
if (count($split) < 29) {
|
||||
throw new InvalidLineException('The A-record has not the right amount of columns.');
|
||||
}
|
||||
|
||||
/** @var DatanormATypeData */
|
||||
$atype = new DatanormATypeData();
|
||||
|
||||
$atype->setWorkflowState($split[1]);
|
||||
$atype->setArticleNumber($split[2]);
|
||||
$atype->setShortdescription1($split[3]);
|
||||
$atype->setShortDescription2($split[4]);
|
||||
$atype->setPackingUnit($split[5]);
|
||||
$atype->setPriceMark($split[6]);
|
||||
$atype->setPriceAmount((int)$split[7]);
|
||||
$atype->setPrice($this->convertPrice($split[8]) / (int)$split[7]);
|
||||
$atype->setDiscountGroup($split[9]);
|
||||
$atype->setMainProductGroup($split[10]);
|
||||
$atype->setProductGroup($split[11]);
|
||||
$atype->setMatchcode($split[12]);
|
||||
$atype->setProducerToken1($split[13]);
|
||||
$atype->setAltArticleNumber($split[14]);
|
||||
$atype->setProducerToken2($split[15]);
|
||||
$atype->setProducerNumber($split[16]);
|
||||
$atype->setProducerModel($split[17]);
|
||||
$atype->setEan($split[18]);
|
||||
$atype->setConnectionNumber($split[19]);
|
||||
$atype->setMinimumPackageAmount($split[20]);
|
||||
$atype->setCataloguePage($split[21]);
|
||||
$atype->setTextkey($split[22]);
|
||||
$atype->setLongDecriptionKey($split[23]);
|
||||
$atype->setCostType($split[24]);
|
||||
$atype->setArticleType($split[25]);
|
||||
$atype->setProducerToken3($split[26]);
|
||||
$atype->setReferenceNumber($split[27]);
|
||||
$atype->setMwstType((int)$split[28]);
|
||||
|
||||
return $atype;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $line
|
||||
*
|
||||
* @throws WrongPriceFormatException
|
||||
* @throws InvalidLineException
|
||||
* @throws WrongDiscountFormatException
|
||||
*
|
||||
* @return DatanormPTypeData
|
||||
*/
|
||||
public function transformToTypeP(string $line): DatanormPTypeData
|
||||
{
|
||||
$split = explode(';', $line);
|
||||
|
||||
if (count($split) < 6) {
|
||||
throw new InvalidLineException('The P-record has not the right amount of columns.');
|
||||
}
|
||||
|
||||
/** @var DatanormPTypeData */
|
||||
$pType = new DatanormPTypeData();
|
||||
|
||||
$pType->setArticleNumber1($split[1]);
|
||||
$pType->setPriceMark1($split[2]);
|
||||
$pType->setPriceAmount1((int)$split[3]);
|
||||
$pType->setPrice1($this->convertPrice($split[4]) / (int)$split[3]);
|
||||
|
||||
$pType->setDiscountGroup($split[5]);
|
||||
|
||||
if (isset($split[6])) {
|
||||
$pType->setDiscountKey1a($split[6]);
|
||||
}
|
||||
|
||||
if (isset($split[7])) {
|
||||
$pType->setDiscount1a($this->convertDiscount($split[6], $split[7]));
|
||||
}
|
||||
|
||||
if (isset($split[8])) {
|
||||
$pType->setDiscountKey1b($split[8]);
|
||||
}
|
||||
|
||||
if (isset($split[9])) {
|
||||
$pType->setDiscount1b($this->convertDiscount($split[8], $split[9]));
|
||||
}
|
||||
|
||||
if (isset($split[10])) {
|
||||
$pType->setDiscountKey1c($split[10]);
|
||||
}
|
||||
|
||||
if (isset($split[11])) {
|
||||
$pType->setDiscount1c($this->convertDiscount($split[10], $split[11]));
|
||||
}
|
||||
|
||||
if (isset($split[12])) {
|
||||
$pType->setValidFromDate($split[12]);
|
||||
}
|
||||
|
||||
return $pType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $line
|
||||
*
|
||||
* @throws InvalidLineException
|
||||
*
|
||||
* @return DatanormVTypeData
|
||||
*/
|
||||
public function transformToTypeV(string $line): DatanormVTypeData
|
||||
{
|
||||
$split = explode(';', $line);
|
||||
|
||||
if (count($split) < 15) {
|
||||
throw new InvalidLineException('The V-record has not the right amount of columns.');
|
||||
}
|
||||
|
||||
/** @var DatanormVTypeData */
|
||||
$vType = new DatanormVTypeData();
|
||||
|
||||
$vType->setDataMark($split[2]);
|
||||
$vType->setDate($split[3]);
|
||||
$vType->setCurrency($split[4]);
|
||||
$vType->setDescription($split[5]);
|
||||
$vType->setProducerToken($split[7]);
|
||||
$vType->setAdress1($split[8]);
|
||||
$vType->setAdress2($split[9]);
|
||||
$vType->setAdress3($split[10]);
|
||||
$vType->setStreet($split[11]);
|
||||
$vType->setCountryId($split[12]);
|
||||
$vType->setZip($split[13]);
|
||||
$vType->setCity($split[14]);
|
||||
|
||||
return $vType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $line
|
||||
*
|
||||
* @throws InvalidLineException
|
||||
*
|
||||
* @return DatanormBTypeData
|
||||
*/
|
||||
public function transformToTypeB(string $line): DatanormBTypeData
|
||||
{
|
||||
$split = explode(';', $line);
|
||||
|
||||
if (count($split) < 3) {
|
||||
throw new InvalidLineException('The B-record has not the right amount of columns.');
|
||||
}
|
||||
|
||||
$bType = new DatanormBTypeData();
|
||||
|
||||
$bType->setProcessingFlag($split[1]);
|
||||
$bType->setArticleNumber($split[2]);
|
||||
|
||||
if (isset($split[3])) {
|
||||
$bType->setArticleNumberNew($split[3]);
|
||||
}
|
||||
|
||||
if (isset($split[4])) {
|
||||
$bType->setExpirationDate($split[4]);
|
||||
}
|
||||
|
||||
return $bType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getVersion(): int
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $line
|
||||
*
|
||||
* @return DatanormTTypeData
|
||||
*/
|
||||
public function transformToTypeT(string $line): DatanormTTypeData
|
||||
{
|
||||
$split = explode(';', $line);
|
||||
|
||||
$tType = new DatanormTTypeData();
|
||||
if (isset($split[1])) {
|
||||
$tType->setProcessingFlag($split[1]);
|
||||
}
|
||||
if (isset($split[2])) {
|
||||
$tType->setTextnumber($split[2]);
|
||||
}
|
||||
if (isset($split[3])) {
|
||||
$tType->setIndicator($split[3]);
|
||||
}
|
||||
if (isset($split[4])) {
|
||||
$tType->setLinenumber1($split[4]);
|
||||
}
|
||||
if (isset($split[5])) {
|
||||
$tType->setText1($split[5]);
|
||||
}
|
||||
|
||||
return $tType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $line
|
||||
*
|
||||
* @return DatanormDTypeData
|
||||
*/
|
||||
public function transformToTypeD(string $line): DatanormDTypeData
|
||||
{
|
||||
$split = explode(';', $line);
|
||||
|
||||
$dType = new DatanormDTypeData();
|
||||
|
||||
if (isset($split[1])) {
|
||||
$dType->setProcessingFlag($split[1]);
|
||||
}
|
||||
if (isset($split[2])) {
|
||||
$dType->setArticleNumber($split[2]);
|
||||
}
|
||||
if (isset($split[3])) {
|
||||
$dType->setLineNumber1($split[3]);
|
||||
}
|
||||
if (isset($split[4])) {
|
||||
$dType->setTextIndicator1($split[4]);
|
||||
}
|
||||
if (isset($split[5])) {
|
||||
$dType->setText1($split[5]);
|
||||
}
|
||||
if (isset($split[6])) {
|
||||
$dType->setTextblockNumber1($split[6]);
|
||||
}
|
||||
|
||||
return $dType;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,309 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Xentral\Modules\Datanorm\Handler;
|
||||
|
||||
use Xentral\Modules\Datanorm\Data\DatanormATypeData;
|
||||
use Xentral\Modules\Datanorm\Data\DatanormBTypeData;
|
||||
use Xentral\Modules\Datanorm\Data\DatanormDTypeData;
|
||||
use Xentral\Modules\Datanorm\Data\DatanormPTypeData;
|
||||
use Xentral\Modules\Datanorm\Data\DatanormTTypeData;
|
||||
use Xentral\Modules\Datanorm\Data\DatanormVTypeData;
|
||||
use Xentral\Modules\Datanorm\Exception\InvalidLineException;
|
||||
use Xentral\Modules\Datanorm\Exception\WrongDiscountFormatException;
|
||||
use Xentral\Modules\Datanorm\Exception\WrongPriceFormatException;
|
||||
|
||||
final class DatanormReaderVersionFourHandler extends AbstractDatanormReaderHandler
|
||||
implements DatanormReaderHandlerInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @param string $line
|
||||
*
|
||||
* @throws WrongPriceFormatException
|
||||
*
|
||||
* @return DatanormATypeData
|
||||
*/
|
||||
public function transformToTypeA(string $line): DatanormATypeData
|
||||
{
|
||||
$split = explode(';', $line);
|
||||
|
||||
if (count($split) < 12) {
|
||||
throw new InvalidLineException('The A-record has not the right amount of columns.');
|
||||
}
|
||||
|
||||
$atype = new DatanormATypeData();
|
||||
|
||||
$atype->setWorkflowState($split[1]);
|
||||
$atype->setArticleNumber($split[2]);
|
||||
$atype->setTextkey($split[3]);
|
||||
$atype->setShortdescription1($split[4]);
|
||||
$atype->setShortDescription2($split[5]);
|
||||
$atype->setPriceMark($split[6]);
|
||||
$atype->setPriceAmount($this->transformPriceAmountCode($split[7]));
|
||||
$atype->setPackingUnit($split[8]);
|
||||
$atype->setPrice($this->convertPrice($split[9]) / $this->transformPriceAmountCode($split[7]));
|
||||
$atype->setDiscountGroup($split[10]);
|
||||
$atype->setMainProductGroup($split[11]);
|
||||
$atype->setLongDecriptionKey($split[12]);
|
||||
|
||||
return $atype;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $line
|
||||
*
|
||||
* @throws WrongPriceFormatException
|
||||
* @throws WrongDiscountFormatException
|
||||
*
|
||||
* @return DatanormPTypeData
|
||||
*/
|
||||
public function transformToTypeP(string $line): DatanormPTypeData
|
||||
{
|
||||
$split = explode(';', $line);
|
||||
|
||||
if (count($split) < 29) {
|
||||
throw new InvalidLineException('The P-record has not the right amount of columns.');
|
||||
}
|
||||
|
||||
$pType = new DatanormPTypeData();
|
||||
|
||||
$pType->setArticleNumber1($split[2]);
|
||||
$pType->setPriceMark1($split[3]);
|
||||
$pType->setPriceAmount1(1);
|
||||
$pType->setPrice1($this->convertPrice($split[4]));
|
||||
|
||||
$pType->setDiscountKey1a($split[5]);
|
||||
if (!empty($split[5]) && $split[5] !== '0') {
|
||||
$pType->setDiscount1a($this->convertDiscount($split[5], $split[6]));
|
||||
}
|
||||
|
||||
$pType->setDiscountKey1b($split[7]);
|
||||
if (!empty($split[7]) && $split[7] !== '0') {
|
||||
$pType->setDiscount1b($this->convertDiscount($split[7], $split[8]));
|
||||
}
|
||||
|
||||
$pType->setDiscountKey1c($split[9]);
|
||||
if (!empty($split[9]) && $split[9] !== '0') {
|
||||
$pType->setDiscount1c($this->convertDiscount($split[9], $split[10]));
|
||||
}
|
||||
|
||||
$pType->setArticleNumber2($split[11]);
|
||||
$pType->setPriceMark2($split[12]);
|
||||
$pType->setPriceAmount2(1);
|
||||
$pType->setPrice2($this->convertPrice($split[13]));
|
||||
|
||||
$pType->setDiscountKey2a($split[14]);
|
||||
if (!empty($split[14]) && $split[14] !== '0') {
|
||||
$pType->setDiscount2a($this->convertDiscount($split[14], $split[15]));
|
||||
}
|
||||
|
||||
$pType->setDiscountKey2b($split[16]);
|
||||
if (!empty($split[16]) && $split[16] !== '0') {
|
||||
$pType->setDiscount2b($this->convertDiscount($split[16], $split[17]));
|
||||
}
|
||||
|
||||
$pType->setDiscountKey2c($split[18]);
|
||||
if (!empty($split[18]) && $split[18] !== '0') {
|
||||
$pType->setDiscount2c($this->convertDiscount($split[18], $split[19]));
|
||||
}
|
||||
|
||||
$pType->setArticleNumber3($split[20]);
|
||||
$pType->setPriceMark3($split[21]);
|
||||
$pType->setPriceAmount3(1);
|
||||
$pType->setPrice3($this->convertPrice($split[22]));
|
||||
|
||||
$pType->setDiscountKey3a($split[23]);
|
||||
if (!empty($split[23]) && $split[23] !== '0') {
|
||||
$pType->setDiscount3a($this->convertDiscount($split[23], $split[24]));
|
||||
}
|
||||
|
||||
$pType->setDiscountKey3b($split[25]);
|
||||
if (!empty($split[25]) && $split[25] !== '0') {
|
||||
$pType->setDiscount3b($this->convertDiscount($split[25], $split[26]));
|
||||
}
|
||||
|
||||
$pType->setDiscountKey3c($split[27]);
|
||||
if (!empty($split[27]) && $split[27] !== '0') {
|
||||
$pType->setDiscount3c($this->convertDiscount($split[27], $split[28]));
|
||||
}
|
||||
|
||||
return $pType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $line
|
||||
*
|
||||
* @param InvalidLineException
|
||||
*
|
||||
* @return DatanormVTypeData
|
||||
*/
|
||||
public function transformToTypeV(string $line): DatanormVTypeData
|
||||
{
|
||||
if (strlen($line) > 130) {
|
||||
throw new InvalidLineException('The V-record has the wrong length.');
|
||||
}
|
||||
|
||||
$creationDate = trim(substr($line, 2, 6));
|
||||
$info1 = trim(substr($line, 8, 40));
|
||||
$info2 = trim(substr($line, 48, 40));
|
||||
$info3 = trim(substr($line, 88, 35));
|
||||
$currency = trim(substr($line, 125, 3));
|
||||
|
||||
$creationDateFormat = '';
|
||||
if (!empty($creationDate)) {
|
||||
$creationDateFormat =
|
||||
'20' . substr($creationDate, 4, 2) .
|
||||
substr($creationDate, 2, 2) .
|
||||
substr($creationDate, 0, 2);
|
||||
}
|
||||
|
||||
$vType = new DatanormVTypeData();
|
||||
|
||||
$vType->setAdress2($info2);
|
||||
$vType->setDate($creationDateFormat);
|
||||
$vType->setCurrency($currency);
|
||||
$vType->setDescription(trim($info1 . ' ' . $info2 . ' ' . $info3));
|
||||
|
||||
return $vType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $line
|
||||
*
|
||||
* @throws InvalidLineException
|
||||
*
|
||||
* @return DatanormBTypeData
|
||||
*/
|
||||
public function transformToTypeB(string $line): DatanormBTypeData
|
||||
{
|
||||
$split = explode(';', $line);
|
||||
|
||||
if (count($split) < 16) {
|
||||
throw new InvalidLineException('The B-record has not the right amount of columns.');
|
||||
}
|
||||
|
||||
$bType = new DatanormBTypeData();
|
||||
|
||||
$bType->setProcessingFlag($split[1]);
|
||||
$bType->setArticleNumber($split[2]);
|
||||
$bType->setMatchcode($split[3]);
|
||||
$bType->setAltArticleNumber($split[4]);
|
||||
$bType->setCopperWeightIndicator($split[6]);
|
||||
$bType->setCopperRawPrice($split[7]);
|
||||
$bType->setCopperWeight($split[8]);
|
||||
$bType->setEan($split[9]);
|
||||
$bType->setGraphicNumber($split[10]);
|
||||
$bType->setProductGroup($split[11]);
|
||||
$bType->setCostIndicator($split[12]);
|
||||
$bType->setOrderAmount($split[13]);
|
||||
$bType->setCreatorReferenceNumber($split[14]);
|
||||
$bType->setReferenceNumber($split[15]);
|
||||
|
||||
return $bType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $priceAmountCode
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
private function transformPriceAmountCode(string $priceAmountCode): int
|
||||
{
|
||||
$priceAmount = 1;
|
||||
|
||||
if ($priceAmountCode === '1') {
|
||||
$priceAmount = 10;
|
||||
} elseif ($priceAmountCode === '2') {
|
||||
$priceAmount = 100;
|
||||
} elseif ($priceAmountCode === '3') {
|
||||
$priceAmount = 1000;
|
||||
}
|
||||
|
||||
return $priceAmount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getVersion(): int
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $line
|
||||
*
|
||||
* @return DatanormTTypeData
|
||||
*/
|
||||
public function transformToTypeT(string $line): DatanormTTypeData
|
||||
{
|
||||
$split = explode(';', $line);
|
||||
|
||||
$tType = new DatanormTTypeData();
|
||||
|
||||
if (isset($split[1])) {
|
||||
$tType->setProcessingFlag($split[1]);
|
||||
}
|
||||
if (isset($split[2])) {
|
||||
$tType->setTextnumber($split[2]);
|
||||
}
|
||||
if (isset($split[4])) {
|
||||
$tType->setLinenumber1($split[4]);
|
||||
}
|
||||
if (isset($split[6])) {
|
||||
$tType->setText1($split[6]);
|
||||
}
|
||||
if (isset($split[7])) {
|
||||
$tType->setLinenumber2($split[7]);
|
||||
}
|
||||
if (isset($split[9])) {
|
||||
$tType->setText2($split[9]);
|
||||
}
|
||||
|
||||
return $tType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $line
|
||||
*
|
||||
* @return DatanormDTypeData
|
||||
*/
|
||||
public function transformToTypeD(string $line): DatanormDTypeData
|
||||
{
|
||||
$split = explode(';', $line);
|
||||
|
||||
$dType = new DatanormDTypeData();
|
||||
|
||||
if (isset($split[1])) {
|
||||
$dType->setProcessingFlag($split[1]);
|
||||
}
|
||||
if (isset($split[2])) {
|
||||
$dType->setArticleNumber($split[2]);
|
||||
}
|
||||
if (isset($split[3])) {
|
||||
$dType->setLineNumber1($split[3]);
|
||||
}
|
||||
if (isset($split[4])) {
|
||||
$dType->setTextIndicator1($split[4]);
|
||||
}
|
||||
if (isset($split[5])) {
|
||||
$dType->setTextblockNumber1($split[5]);
|
||||
}
|
||||
if (isset($split[6])) {
|
||||
$dType->setText1($split[6]);
|
||||
}
|
||||
if (isset($split[8])) {
|
||||
$dType->setTextIndicator2($split[8]);
|
||||
}
|
||||
if (isset($split[9])) {
|
||||
$dType->setTextblockNumber2($split[9]);
|
||||
}
|
||||
if (isset($split[10])) {
|
||||
$dType->setText2($split[10]);
|
||||
}
|
||||
|
||||
return $dType;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user