1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
BaseStep.php
См. документацию.
1
<?php
2
declare(strict_types=1);
3
4
namespace
Bitrix\Landing\Copilot\Generation\Step;
5
6
use Bitrix\Landing\Copilot\Data;
7
use Bitrix\Landing\Copilot\Generation;
8
use Bitrix\Landing\Copilot\Generation\GenerationException;
9
use Bitrix\Landing\Copilot\Generation\Type\GenerationErrors;
10
11
abstract
class
BaseStep
implements
IStep
12
{
13
protected
Generation
$generation
;
14
protected
Data\Site
$siteData
;
15
protected
?
int
$stepId
;
16
17
protected
bool
$initied
=
false
;
18
protected
bool
$changed
=
false
;
19
20
public
function
__construct
()
21
{
22
}
23
27
public
function
init
(
Generation
$generation
,
int
$stepId
): static
28
{
29
if
($this->initied)
30
{
31
return
$this;
32
}
33
34
if
(!Generation::checkExists(
$generation
->getId()))
35
{
36
throw
new
GenerationException
(
37
GenerationErrors::dataValidation,
38
"Generation {$generation->getId()} does not exist"
,
39
);
40
}
41
42
$this->generation =
$generation
;
43
$this->siteData =
$generation
->getSiteData();
44
$this->stepId =
$stepId
;
45
$this->initied =
true
;
46
47
$this->
initialize
();
48
49
return
$this;
50
}
51
56
abstract
protected
function
initialize
(): void;
57
61
public
function
execute
(): bool
62
{
63
if
(!isset($this->generation, $this->siteData))
64
{
65
return
false
;
66
}
67
68
return
true
;
69
}
70
74
public
function
isAsync
(): bool
75
{
76
return
false
;
77
}
78
82
public
function
isChanged
(): bool
83
{
84
return
$this->changed
;
85
}
86
90
public
function
clearErrors
(): void
91
{}
92
97
protected
function
getEvent
():
Generation
\
Event
98
{
99
return
$this->generation->getEvent();
100
}
101
}
Bitrix\Landing\Copilot\Generation\GenerationException
Определения
GenerationException.php:11
Bitrix\Landing\Copilot\Generation\Step\BaseStep
Определения
BaseStep.php:12
Bitrix\Landing\Copilot\Generation\Step\BaseStep\getEvent
getEvent()
Определения
BaseStep.php:97
Bitrix\Landing\Copilot\Generation\Step\BaseStep\$generation
Generation $generation
Определения
BaseStep.php:13
Bitrix\Landing\Copilot\Generation\Step\BaseStep\__construct
__construct()
Определения
BaseStep.php:20
Bitrix\Landing\Copilot\Generation\Step\BaseStep\execute
execute()
Определения
BaseStep.php:61
Bitrix\Landing\Copilot\Generation\Step\BaseStep\clearErrors
clearErrors()
Определения
BaseStep.php:90
Bitrix\Landing\Copilot\Generation\Step\BaseStep\$initied
bool $initied
Определения
BaseStep.php:17
Bitrix\Landing\Copilot\Generation\Step\BaseStep\isChanged
isChanged()
Определения
BaseStep.php:82
Bitrix\Landing\Copilot\Generation\Step\BaseStep\$changed
bool $changed
Определения
BaseStep.php:18
Bitrix\Landing\Copilot\Generation\Step\BaseStep\isAsync
isAsync()
Определения
BaseStep.php:74
Bitrix\Landing\Copilot\Generation\Step\BaseStep\initialize
initialize()
Bitrix\Landing\Copilot\Generation\Step\BaseStep\$siteData
Data Site $siteData
Определения
BaseStep.php:14
Bitrix\Landing\Copilot\Generation\Step\BaseStep\$stepId
int $stepId
Определения
BaseStep.php:15
Bitrix\Landing\Copilot\Generation\Step\BaseStep\init
init(Generation $generation, int $stepId)
Определения
BaseStep.php:27
Bitrix\Landing\Copilot\Generation\Step\IStep
Определения
IStep.php:12
Bitrix\Landing\Copilot\Generation
Определения
Error.php:4
Bitrix\Landing\Site
Определения
cookies.php:2
Bitrix\Rest\Event
Определения
buffer.php:3
bitrix
modules
landing
lib
Copilot
Generation
Step
BaseStep.php
Создано системой
1.14.0