Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
documentimportfactory.php
1<?php
3
6
7
9{
17 public static function create($documentTypeID)
18 {
19 if(!is_int($documentTypeID))
20 {
21 $documentTypeID = (int)$documentTypeID;
22 }
23
24 if(!DocumentType::IsDefined($documentTypeID))
25 {
27 }
28
29 if($documentTypeID === DocumentType::ORDER)
30 {
31 return new OrderDocument();
32 }
33 elseif($documentTypeID === DocumentType::SHIPMENT)
34 {
35 return new ShipmentDocument();
36 }
37 elseif($documentTypeID === DocumentType::PAYMENT_CASH)
38 {
39 return new PaymentCashDocument();
40 }
41 elseif($documentTypeID === DocumentType::PAYMENT_CASH_LESS)
42 {
43 return new PaymentCashLessDocument();
44 }
45 elseif($documentTypeID === DocumentType::PAYMENT_CARD_TRANSACTION)
46 {
47 return new PaymentCardDocument();
48 }
49 elseif($documentTypeID === DocumentType::PROFILE)
50 {
51 return new ProfileDocument();
52 }
53 elseif($documentTypeID === DocumentType::USER_PROFILE)
54 {
55 return new UserProfileDocument();
56 }
57 else
58 {
59 throw new Main\NotSupportedException("Document type: '".Exchange\EntityType::ResolveName($documentTypeID)."' is not supported in current context");
60 }
61 }
62}