Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
converterfactory.php
1<?php
2
4
5
9
11{
18 public static function create($typeId)
19 {
20 if(!is_int($typeId))
21 {
22 $typeId = (int)$typeId;
23 }
24
25 if(!EntityType::IsDefined($typeId))
26 {
28 }
29
30 if($typeId === EntityType::ORDER)
31 {
32 return new ConverterDocumentOrder();
33 }
34 elseif($typeId === EntityType::SHIPMENT)
35 {
36 return new ConverterDocumentShipment();
37 }
38 elseif($typeId === EntityType::PAYMENT_CASH ||
44 {
45 return new ConverterDocumentPayment();
46 }
47 elseif($typeId == EntityType::PROFILE ||
48 $typeId == EntityType::USER_PROFILE ||
50 {
51 return new ConverterDocumentProfile();
52 }
53 elseif ($typeId === EntityType::INVOICE)
54 {
55 return new ConverterDocumentInvoice();
56 }
57 elseif ($typeId === EntityType::INVOICE_SHIPMENT)
58 {
60 }
61 else
62 {
63 throw new NotSupportedException("Entity type: '".DocumentType::ResolveName($typeId)."' is not supported in current context");
64 }
65 }
66}