Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
CheckDisappearingDuration.php
1
<?php
2
3
namespace
Bitrix\Im\V2\Controller\Filter
;
4
5
use
Bitrix\Im\V2\Chat\ChatError
;
6
use
Bitrix\Im\V2\Message\Delete\DisappearService
;
7
use
Bitrix\Main\Engine\ActionFilter\Base
;
8
use
Bitrix\Main\Event
;
9
use
Bitrix\Main\EventResult
;
10
11
class
CheckDisappearingDuration
extends
Base
12
{
13
public
function
onBeforeAction
(
Event
$event)
14
{
15
$arguments = $this->
getAction
()->getArguments();
16
$hours = $arguments[
'hours'
];
17
if
(is_numeric($hours) && (
int
)$hours > -1 && in_array($hours,
DisappearService::TIME_WHITELIST
))
18
{
19
return
null
;
20
}
21
22
$this->
addError
(
new
ChatError
(
ChatError::WRONG_DISAPPEARING_DURATION
,
'Wrong disappearing duration'
));
23
return
new
EventResult
(EventResult::ERROR,
null
,
null
, $this);
24
}
25
}
Bitrix\Im\V2\Chat\ChatError
Definition
ChatError.php:9
Bitrix\Im\V2\Chat\ChatError\WRONG_DISAPPEARING_DURATION
const WRONG_DISAPPEARING_DURATION
Definition
ChatError.php:19
Bitrix\Im\V2\Controller\Filter\CheckDisappearingDuration
Definition
CheckDisappearingDuration.php:12
Bitrix\Im\V2\Controller\Filter\CheckDisappearingDuration\onBeforeAction
onBeforeAction(Event $event)
Definition
CheckDisappearingDuration.php:13
Bitrix\Im\V2\Message\Delete\DisappearService
Definition
DisappearService.php:13
Bitrix\Im\V2\Message\Delete\DisappearService\TIME_WHITELIST
const TIME_WHITELIST
Definition
DisappearService.php:14
Bitrix\Im\V2\Sync\Event
Definition
Event.php:9
Bitrix\Main\Engine\ActionFilter\Base
Definition
base.php:15
Bitrix\Main\Engine\ActionFilter\Base\addError
addError(Error $error)
Definition
base.php:80
Bitrix\Main\Engine\ActionFilter\Base\getAction
getAction()
Definition
base.php:48
Bitrix\Main\Event
Definition
event.php:5
Bitrix\Main\EventResult
Definition
eventresult.php:5
Bitrix\Im\V2\Controller\Filter
Definition
ActionUuidHandler.php:3
modules
im
lib
V2
Controller
Filter
CheckDisappearingDuration.php
Создано системой
1.10.0