Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
updatecontactdtofactory.php
1<?php
2
4
9
11{
12 private DateTime $date;
13
14 private bool $blacklisted;
15
22 public function __construct(bool $blacklisted = false, ?DateTime $date = null)
23 {
24 $this->blacklisted = $blacklisted;
25 $this->date = $date ?? new DateTime();
26 }
27
36 public function make(string $code, ?string $name): ?UpdateContactDTO
37 {
38 $typeId = Type::detect($code);
39 if (!$typeId)
40 {
41 return null;
42 }
43
44 $code = Normalizer::normalize($code, $typeId);
45 if (!$code)
46 {
47 return null;
48 }
49
50 $item = new UpdateContactDTO();
51 $item->typeId = $typeId;
52 $item->code = $code;
53 $item->dateInsert = $this->date;
54 $item->dateUpdate = $this->date;
55 $item->name = $name;
56 $item->blacklisted = $this->blacklisted;
57
58 return $item;
59 }
60}
__construct(bool $blacklisted=false, ?DateTime $date=null)
static normalize($code, $typeId=Type::EMAIL)