1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
updatecontactdtofactory.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Sender\Internals\Factory
;
4
5
use
Bitrix\Main\Type\DateTime
;
6
use
Bitrix\Sender\Internals\Dto\UpdateBlacklistDTO
;
7
use
Bitrix\Sender\Internals\Dto\UpdateContact
;
8
use
Bitrix\Sender\Internals\Dto\UpdateContactDTO
;
9
use
Bitrix\Sender\Recipient\Type
;
10
use
Bitrix\Sender\Recipient\Normalizer
;
11
12
class
UpdateContactDtoFactory
13
{
14
private
DateTime
$date;
15
16
private
bool
$blacklisted;
17
24
public
function
__construct
(
bool
$blacklisted =
false
, ?
DateTime
$date =
null
)
25
{
26
$this->blacklisted = $blacklisted;
27
$this->date = $date ??
new
DateTime
();
28
}
29
38
public
function
make
(
string
$code
, ?
string
$name
): ?
UpdateContact
39
{
40
$typeId = Type::detect(
$code
);
41
if
(!$typeId)
42
{
43
return
null
;
44
}
45
46
$code
=
Normalizer::normalize
(
$code
, $typeId);
47
if
(!
$code
)
48
{
49
return
null
;
50
}
51
52
$item = $this->
createDto
();
53
$item->typeId = $typeId;
54
$item->code =
$code
;
55
$item->dateInsert = $this->date;
56
$item->dateUpdate = $this->date;
57
$item->name =
$name
;
58
59
return
$item;
60
}
61
65
public
function
createDto
():
UpdateContact
66
{
67
return
$this->blacklisted ?
new
UpdateBlacklistDTO
() :
new
UpdateContactDTO
();
68
}
69
}
Bitrix\Main\Type\DateTime
Определения
datetime.php:9
Bitrix\Sender\Internals\Dto\UpdateBlacklistDTO
Определения
updateblacklistdto.php:8
Bitrix\Sender\Internals\Dto\UpdateContactDTO
Определения
updatecontactdto.php:8
Bitrix\Sender\Internals\Factory\UpdateContactDtoFactory
Определения
updatecontactdtofactory.php:13
Bitrix\Sender\Internals\Factory\UpdateContactDtoFactory\createDto
createDto()
Определения
updatecontactdtofactory.php:65
Bitrix\Sender\Internals\Factory\UpdateContactDtoFactory\__construct
__construct(bool $blacklisted=false, ?DateTime $date=null)
Определения
updatecontactdtofactory.php:24
Bitrix\Sender\Internals\Factory\UpdateContactDtoFactory\make
make(string $code, ?string $name)
Определения
updatecontactdtofactory.php:38
Bitrix\Sender\Recipient\Normalizer
Определения
normalizer.php:20
Bitrix\Sender\Recipient\Normalizer\normalize
static normalize($code, $typeId=Type::EMAIL)
Определения
normalizer.php:28
Bitrix\Sender\Internals\Dto\UpdateContact
Определения
updatecontact.php:6
$code
if(!is_null($config))($config as $configItem)(! $configItem->isVisible()) $code
Определения
options.php:195
$name
$name
Определения
menu_edit.php:35
Bitrix\Main\Type
Определения
collection.php:2
Bitrix\Sender\Internals\Factory
Определения
updatecontactdtofactory.php:3
bitrix
modules
sender
lib
internals
factory
updatecontactdtofactory.php
Создано системой
1.14.0