Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
content.php
1
<?php
8
namespace
Bitrix\Sender\Internals\QueryController
;
9
10
use
Bitrix\Main\Localization\Loc
;
11
use
Bitrix\Main\Error
;
12
use
Bitrix\Main\ErrorCollection
;
13
14
Loc::loadMessages
(__FILE__);
15
20
abstract
class
Content
21
{
22
const
TYPE_JSON
=
'json'
;
23
const
TYPE_HTML
=
'html'
;
24
26
protected
$errors
;
27
29
protected
$response
;
30
31
public
static
function
create
(
Response
$response
, $type)
32
{
33
switch
($type)
34
{
35
case
Content::TYPE_HTML
:
36
return
new
ContentHtml
(
$response
);
37
38
case
Content::TYPE_JSON
:
39
default
:
40
return
new
ContentJson
(
$response
);
41
}
42
}
43
48
public
function
__construct
(
Response
$response
)
49
{
50
$this->errors =
new
ErrorCollection
;
51
$this->response =
$response
;
52
}
53
57
public
function
onFlush
()
58
{
59
60
}
61
65
abstract
public
function
toText
();
66
71
public
function
addError
($message, $code =
null
)
72
{
73
$this->errors->setError(
new
Error
($message, $code));
74
}
78
public
function
addPermissionError
($message =
null
)
79
{
80
if
(!$message)
81
{
82
$message =
'Access denied.'
;
83
}
84
85
$this->errors->setError(
new
Error
($message, 0));
86
}
87
91
public
function
getErrorCollection
()
92
{
93
return
$this->errors
;
94
}
95
96
protected
function
getErrorMessages()
97
{
98
$list = array();
99
foreach
($this->errors as $error)
100
{
102
$list[] = $error->getMessage();
103
}
104
return
$list;
105
}
106
}
Bitrix\Main\ErrorCollection
Definition
errorcollection.php:14
Bitrix\Main\Error
Definition
error.php:14
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\Main\Localization\Loc\loadMessages
static loadMessages($file)
Definition
loc.php:64
Bitrix\Main\Response
Definition
response.php:5
Bitrix\Sender\Internals\QueryController\Content
Definition
content.php:21
Bitrix\Sender\Internals\QueryController\Content\__construct
__construct(Response $response)
Definition
content.php:48
Bitrix\Sender\Internals\QueryController\Content\onFlush
onFlush()
Definition
content.php:57
Bitrix\Sender\Internals\QueryController\Content\addError
addError($message, $code=null)
Definition
content.php:71
Bitrix\Sender\Internals\QueryController\Content\toText
toText()
Bitrix\Sender\Internals\QueryController\Content\getErrorCollection
getErrorCollection()
Definition
content.php:91
Bitrix\Sender\Internals\QueryController\Content\addPermissionError
addPermissionError($message=null)
Definition
content.php:78
Bitrix\Sender\Internals\QueryController\Content\TYPE_JSON
const TYPE_JSON
Definition
content.php:22
Bitrix\Sender\Internals\QueryController\Content\TYPE_HTML
const TYPE_HTML
Definition
content.php:23
Bitrix\Sender\Internals\QueryController\Content\$errors
$errors
Definition
content.php:26
Bitrix\Sender\Internals\QueryController\Content\$response
$response
Definition
content.php:29
Bitrix\Sender\Internals\QueryController\Content\create
static create(Response $response, $type)
Definition
content.php:31
Bitrix\Sender\Internals\QueryController\ContentHtml
Definition
contenthtml.php:20
Bitrix\Sender\Internals\QueryController\ContentJson
Definition
contentjson.php:20
Bitrix\Sender\Internals\QueryController
Definition
action.php:8
modules
sender
lib
internals
querycontroller
content.php
Создано системой
1.10.0