Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
converterfactory.php
1
<?php
2
namespace
Bitrix\Sale\Exchange\OneC\CRM
;
3
4
use
Bitrix\Main\ArgumentOutOfRangeException
;
5
use
Bitrix\Main\NotSupportedException
;
6
use
Bitrix\Sale\Exchange\EntityType
;
7
use
Bitrix\Sale\Exchange\OneC\ConverterDocumentInvoice
;
8
use
Bitrix\Sale\Exchange\OneC\ConverterDocumentPaymentInvoice
;
9
use
Bitrix\Sale\Exchange\OneC\ConverterDocumentProfile
;
10
use
Bitrix\Sale\Exchange\OneC\ConverterDocumentShipmentInvoice
;
11
use
Bitrix\Sale\Exchange\OneC\DocumentType
;
12
13
class
ConverterFactory
14
{
21
public
static
function
create
($typeId)
22
{
23
if
(!is_int($typeId))
24
{
25
$typeId = (int)$typeId;
26
}
27
28
if
(!EntityType::IsDefined($typeId))
29
{
30
throw
new
ArgumentOutOfRangeException
(
'documentTypeID'
,
EntityType::FIRST
,
EntityType::LAST
);
31
}
32
33
if
($typeId ===
EntityType::ORDER
)
34
{
35
return
new
ConverterDocumentInvoice
();
36
}
37
elseif ($typeId ===
EntityType::SHIPMENT
)
38
{
39
return
new
ConverterDocumentShipmentInvoice
();
40
}
41
elseif(
42
$typeId ===
EntityType::PAYMENT_CASH
||
43
$typeId ===
EntityType::PAYMENT_CASH_LESS
||
44
$typeId ===
EntityType::PAYMENT_CARD_TRANSACTION
)
45
{
46
return
new
ConverterDocumentPaymentInvoice
();
47
}
48
elseif($typeId ==
EntityType::PROFILE
||
49
$typeId ==
EntityType::USER_PROFILE
)
50
{
51
return
new
ConverterDocumentProfile
();
52
}
53
else
54
{
55
throw
new
NotSupportedException
(
"Entity type: '"
.DocumentType::ResolveName($typeId).
"' is not supported in current context"
);
56
}
57
}
58
}
Bitrix\Main\ArgumentOutOfRangeException
Definition
exception.php:67
Bitrix\Main\NotSupportedException
Definition
exception.php:159
Bitrix\Sale\Exchange\EntityType
Definition
entitytype.php:6
Bitrix\Sale\Exchange\EntityType\ORDER
const ORDER
Definition
entitytype.php:8
Bitrix\Sale\Exchange\EntityType\LAST
const LAST
Definition
entitytype.php:23
Bitrix\Sale\Exchange\EntityType\PAYMENT_CASH_LESS
const PAYMENT_CASH_LESS
Definition
entitytype.php:11
Bitrix\Sale\Exchange\EntityType\PAYMENT_CASH
const PAYMENT_CASH
Definition
entitytype.php:10
Bitrix\Sale\Exchange\EntityType\USER_PROFILE
const USER_PROFILE
Definition
entitytype.php:14
Bitrix\Sale\Exchange\EntityType\PROFILE
const PROFILE
Definition
entitytype.php:13
Bitrix\Sale\Exchange\EntityType\FIRST
const FIRST
Definition
entitytype.php:22
Bitrix\Sale\Exchange\EntityType\SHIPMENT
const SHIPMENT
Definition
entitytype.php:9
Bitrix\Sale\Exchange\EntityType\PAYMENT_CARD_TRANSACTION
const PAYMENT_CARD_TRANSACTION
Definition
entitytype.php:12
Bitrix\Sale\Exchange\OneC\CRM\ConverterFactory
Definition
converterfactory.php:14
Bitrix\Sale\Exchange\OneC\CRM\ConverterFactory\create
static create($typeId)
Definition
converterfactory.php:21
Bitrix\Sale\Exchange\OneC\ConverterDocumentInvoice
Definition
converterdocumentinvoice.php:7
Bitrix\Sale\Exchange\OneC\ConverterDocumentPaymentInvoice
Definition
converterdocumentpaymentinvoice.php:8
Bitrix\Sale\Exchange\OneC\ConverterDocumentProfile
Definition
converterdocumentprofile.php:13
Bitrix\Sale\Exchange\OneC\ConverterDocumentShipmentInvoice
Definition
converterdocumentshipmentinvoice.php:8
Bitrix\Sale\Exchange\OneC\DocumentType
Definition
documenttype.php:10
Bitrix\Sale\Exchange\OneC\CRM
Definition
converterfactory.php:2
modules
sale
lib
exchange
onec
crm
converterfactory.php
Создано системой
1.10.0