- Модуль: security
- Путь к файлу: ~/bitrix/modules/security/lib/hostrestriction.php
- Класс: BitrixSecurityHostRestriction
- Вызов: HostRestriction::setAction
public function setAction($action, array $options = array())
{
if (!$action)
throw new ArgumentNullException('action');
if (!is_string($action))
throw new ArgumentTypeException('action', 'string');
if (!in_array($action, $this->validActions))
throw new ArgumentOutOfRangeException('action', $this->validActions);
if ($action === self::ACTION_REDIRECT)
{
if (!isset($options['host']) || !$options['host'])
throw new LogicException('options[host] not present', 'SECURITY_HOSTS_EMPTY_HOST_ACTION');
if (!preg_match('#^https?://#', $options['host']))
throw new LogicException('invalid redirecting host present in options[host]', 'SECURITY_HOSTS_INVALID_HOST_ACTION');
}
$this->action = $action;
$this->actionOptions = $options;
return $this;
}