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