Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
updatecontactdtofactory.php
1
<?php
2
3
namespace
Bitrix\Sender\Internals\Factory
;
4
5
use
Bitrix\Main\Type\DateTime
;
6
use
Bitrix\Sender\Internals\Dto\UpdateContactDTO
;
7
use
Bitrix\Sender\Recipient\Type
;
8
use
Bitrix\Sender\Recipient\Normalizer
;
9
10
class
UpdateContactDtoFactory
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
}
Bitrix\Main\Type\DateTime
Definition
datetime.php:9
Bitrix\Sender\Internals\Dto\UpdateContactDTO
Definition
updatecontactdto.php:8
Bitrix\Sender\Internals\Factory\UpdateContactDtoFactory
Definition
updatecontactdtofactory.php:11
Bitrix\Sender\Internals\Factory\UpdateContactDtoFactory\__construct
__construct(bool $blacklisted=false, ?DateTime $date=null)
Definition
updatecontactdtofactory.php:22
Bitrix\Sender\Internals\Factory\UpdateContactDtoFactory\make
make(string $code, ?string $name)
Definition
updatecontactdtofactory.php:36
Bitrix\Sender\Recipient\Normalizer
Definition
normalizer.php:20
Bitrix\Sender\Recipient\Normalizer\normalize
static normalize($code, $typeId=Type::EMAIL)
Definition
normalizer.php:28
Bitrix\Sender\Recipient\Type
Definition
type.php:20
Bitrix\Sender\Internals\Factory
Definition
updatecontactdtofactory.php:3
modules
sender
lib
internals
factory
updatecontactdtofactory.php
Создано системой
1.10.0