Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
numbergenerator.php
1
<?php
2
namespace
Bitrix\Main\Numerator\Generator
;
3
4
use
Bitrix\Main\EventResult
;
5
use
Bitrix\Main\NotImplementedException
;
6
11
abstract
class
NumberGenerator
12
{
13
const
USER_DEFINED_SYMBOL_START
=
'{USER_DEFINED:'
;
14
const
USER_DEFINED_SYMBOL_END
=
'}'
;
15
const
SYMBOL_START
=
'{'
;
16
const
SYMBOL_END
=
'}'
;
17
23
public
abstract
function
parseTemplate
($template);
24
30
public
function
parseTemplateForPreview
($template)
31
{
32
return
$this->
parseTemplate
($template);
33
}
34
39
public
static
function
getAvailableForType
()
40
{
41
throw
new
NotImplementedException
(static::class .
':'
. __FUNCTION__ .
' is not implemented'
);
42
}
43
48
public
static
function
getTemplateWordsForParse
()
49
{
50
throw
new
NotImplementedException
(static::class .
':'
. __FUNCTION__ .
' is not implemented'
);
51
}
52
59
public
static
function
getTemplateWordsSettings
()
60
{
61
throw
new
NotImplementedException
(static::class .
':'
. __FUNCTION__ .
' is not implemented'
);
62
}
63
71
public
static
function
onGeneratorClassesCollect
()
72
{
73
return
new
EventResult
(EventResult::SUCCESS, static::class);
74
}
75
79
public
static
function
getType
()
80
{
81
return
str_replace(
'\\'
,
'_'
, static::class);
82
}
83
90
protected
function
setFromArrayOrDefault
($value, $config, $default =
null
, $type =
null
)
91
{
92
if
(property_exists(static::class, $value))
93
{
94
if
($config !==
null
&& array_key_exists($value, $config))
95
{
96
if
($type ===
'int'
)
97
{
98
$this->$value = intval($config[$value]);
99
}
100
elseif ($type ===
'string'
)
101
{
102
$this->$value = (string)$config[$value];
103
}
104
elseif ($type ===
'bool'
)
105
{
106
$this->$value = (bool)$config[$value];
107
}
108
else
109
{
110
$this->$value = $config[$value];
111
}
112
}
113
else
114
{
115
$this->$value = $default;
116
}
117
}
118
}
119
124
protected
static
function
getPatternFor
($word)
125
{
126
return
self::SYMBOL_START . $word .
self::SYMBOL_END
;
127
}
128
}
Bitrix\Main\EventResult
Definition
eventresult.php:5
Bitrix\Main\NotImplementedException
Definition
exception.php:147
Bitrix\Main\Numerator\Generator\NumberGenerator
Definition
numbergenerator.php:12
Bitrix\Main\Numerator\Generator\NumberGenerator\SYMBOL_END
const SYMBOL_END
Definition
numbergenerator.php:16
Bitrix\Main\Numerator\Generator\NumberGenerator\getType
static getType()
Definition
numbergenerator.php:79
Bitrix\Main\Numerator\Generator\NumberGenerator\getPatternFor
static getPatternFor($word)
Definition
numbergenerator.php:124
Bitrix\Main\Numerator\Generator\NumberGenerator\getAvailableForType
static getAvailableForType()
Definition
numbergenerator.php:39
Bitrix\Main\Numerator\Generator\NumberGenerator\getTemplateWordsForParse
static getTemplateWordsForParse()
Definition
numbergenerator.php:48
Bitrix\Main\Numerator\Generator\NumberGenerator\setFromArrayOrDefault
setFromArrayOrDefault($value, $config, $default=null, $type=null)
Definition
numbergenerator.php:90
Bitrix\Main\Numerator\Generator\NumberGenerator\parseTemplateForPreview
parseTemplateForPreview($template)
Definition
numbergenerator.php:30
Bitrix\Main\Numerator\Generator\NumberGenerator\USER_DEFINED_SYMBOL_END
const USER_DEFINED_SYMBOL_END
Definition
numbergenerator.php:14
Bitrix\Main\Numerator\Generator\NumberGenerator\onGeneratorClassesCollect
static onGeneratorClassesCollect()
Definition
numbergenerator.php:71
Bitrix\Main\Numerator\Generator\NumberGenerator\parseTemplate
parseTemplate($template)
Bitrix\Main\Numerator\Generator\NumberGenerator\USER_DEFINED_SYMBOL_START
const USER_DEFINED_SYMBOL_START
Definition
numbergenerator.php:13
Bitrix\Main\Numerator\Generator\NumberGenerator\SYMBOL_START
const SYMBOL_START
Definition
numbergenerator.php:15
Bitrix\Main\Numerator\Generator\NumberGenerator\getTemplateWordsSettings
static getTemplateWordsSettings()
Definition
numbergenerator.php:59
Bitrix\Main\Numerator\Generator
modules
main
lib
numerator
generator
numbergenerator.php
Создано системой
1.10.0