Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
abstractaudiencestatusnormalizer.php
1
<?php
2
3
namespace
Bitrix\Seo\Retargeting\Audience\Status
;
4
5
use
Bitrix\Main\Localization\Loc
;
6
7
abstract
class
AbstractAudienceStatusNormalizer
implements
AudienceStatusNormalizerInterface
8
{
9
protected
const
AUDIENCE_TYPE_CODE
=
''
;
10
11
public
const
NORMALIZED_STATUS_READY
=
'READY'
;
12
public
const
NORMALIZED_STATUS_PROCESSING
=
'PROCESSING'
;
13
public
const
NORMALIZED_STATUS_OTHER
=
'OTHER'
;
14
15
protected
array
$originalStatusToNormalizedMap
= [];
16
23
public
function
getNormalizedStatus
(?
string
$originalStatus): string
24
{
25
if
($originalStatus ===
null
)
26
{
27
return
self::NORMALIZED_STATUS_READY
;
28
}
29
30
return
$this->originalStatusToNormalizedMap[$originalStatus] ??
self::NORMALIZED_STATUS_PROCESSING
;
31
}
32
38
public
function
getNormalizedStatusTranslation
(?
string
$originalStatus): string
39
{
40
$normalizedStatus = $this->
getNormalizedStatus
($originalStatus);
41
42
if
(in_array($normalizedStatus, [self::NORMALIZED_STATUS_READY, self::NORMALIZED_STATUS_PROCESSING],
true
))
43
{
44
return
$this->
getDefaultNormalizedStatusesTranslation
($normalizedStatus);
45
}
46
47
return
Loc::getMessage
($this->
getNormalizedStatusTranslationKey
($originalStatus));
48
}
49
50
protected
function
getNormalizedStatusTranslationKey
(
string
$originalStatus): string
51
{
52
$translationKeyPrefix =
'SEO_RETARGETING_SERVICE_AUDIENCE_STATUS_'
;
53
$audienceTypeCodePrefix = strtoupper(static::AUDIENCE_TYPE_CODE) .
'_'
;
54
$originalStatusPostfix = strtoupper($originalStatus);
55
56
return
$translationKeyPrefix . $audienceTypeCodePrefix . $originalStatusPostfix;
57
}
58
63
protected
function
getDefaultNormalizedStatusesTranslation
(
string
$status): string
64
{
65
return
Loc::getMessage
(
'SEO_RETARGETING_SERVICE_AUDIENCE_STATUS_DEFAULT_'
. $status);
66
}
67
}
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\Main\Localization\Loc\getMessage
static getMessage($code, $replace=null, $language=null)
Definition
loc.php:29
Bitrix\Seo\Retargeting\Audience\Status\AbstractAudienceStatusNormalizer
Definition
abstractaudiencestatusnormalizer.php:8
Bitrix\Seo\Retargeting\Audience\Status\AbstractAudienceStatusNormalizer\NORMALIZED_STATUS_OTHER
const NORMALIZED_STATUS_OTHER
Definition
abstractaudiencestatusnormalizer.php:13
Bitrix\Seo\Retargeting\Audience\Status\AbstractAudienceStatusNormalizer\getDefaultNormalizedStatusesTranslation
getDefaultNormalizedStatusesTranslation(string $status)
Definition
abstractaudiencestatusnormalizer.php:63
Bitrix\Seo\Retargeting\Audience\Status\AbstractAudienceStatusNormalizer\getNormalizedStatusTranslationKey
getNormalizedStatusTranslationKey(string $originalStatus)
Definition
abstractaudiencestatusnormalizer.php:50
Bitrix\Seo\Retargeting\Audience\Status\AbstractAudienceStatusNormalizer\$originalStatusToNormalizedMap
array $originalStatusToNormalizedMap
Definition
abstractaudiencestatusnormalizer.php:15
Bitrix\Seo\Retargeting\Audience\Status\AbstractAudienceStatusNormalizer\getNormalizedStatus
getNormalizedStatus(?string $originalStatus)
Definition
abstractaudiencestatusnormalizer.php:23
Bitrix\Seo\Retargeting\Audience\Status\AbstractAudienceStatusNormalizer\AUDIENCE_TYPE_CODE
const AUDIENCE_TYPE_CODE
Definition
abstractaudiencestatusnormalizer.php:9
Bitrix\Seo\Retargeting\Audience\Status\AbstractAudienceStatusNormalizer\getNormalizedStatusTranslation
getNormalizedStatusTranslation(?string $originalStatus)
Definition
abstractaudiencestatusnormalizer.php:38
Bitrix\Seo\Retargeting\Audience\Status\AbstractAudienceStatusNormalizer\NORMALIZED_STATUS_PROCESSING
const NORMALIZED_STATUS_PROCESSING
Definition
abstractaudiencestatusnormalizer.php:12
Bitrix\Seo\Retargeting\Audience\Status\AbstractAudienceStatusNormalizer\NORMALIZED_STATUS_READY
const NORMALIZED_STATUS_READY
Definition
abstractaudiencestatusnormalizer.php:11
Bitrix\Seo\Retargeting\Audience\Status\AudienceStatusNormalizerInterface
Definition
audiencestatusnormalizerinterface.php:6
Bitrix\Seo\Retargeting\Audience\Status
Definition
abstractaudiencestatusnormalizer.php:3
modules
seo
lib
retargeting
audience
status
abstractaudiencestatusnormalizer.php
Создано системой
1.10.0