2 Commits
4.1.0 ... 4.3.0

7 changed files with 521 additions and 156 deletions

View File

@@ -22,15 +22,18 @@
"issues": "https://git.mirzaev.sexy/mirzaev/vk/issues" "issues": "https://git.mirzaev.sexy/mirzaev/vk/issues"
}, },
"require": { "require": {
"php": "~8.1", "php": "^8.1",
"psr/log": "~1.0", "psr/log": "^1.0",
"mirzaev/accounts": "~1.2.0", "mirzaev/accounts": "^1.2.0",
"monolog/monolog": "~1.6", "monolog/monolog": "^1.6",
"jasny/error-handler": "~0.2", "jasny/error-handler": "^0.2",
"guzzlehttp/guzzle": "~7.5" "guzzlehttp/guzzle": "^7.5"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "~9.5" "phpunit/phpunit": "^9.5"
},
"suggest": {
"ext-sodium": "Can be selected in some conditions to increase security"
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {

View File

@@ -0,0 +1,115 @@
<?php
declare(strict_types=1);
namespace mirzaev\vk\api\methods;
// Файлы проекта
use mirzaev\vk\robots\user;
// Встроенные библиотеки
use Exception;
/**
* Аккаунт
*
* @method public getInfo(?array $fields = null) Запросить информацию об аккаунте
* @method public getProfileInfo(?array $fields = null) Запросить информацию о профиле
*
* @see https://dev.vk.com/method/account
*
* @package mirzaev\vk\api
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
*/
final class account extends method
{
/**
* Конструктор
*
* @param user $user Робот
*/
public function __construct(
protected user $robot
) {
}
/**
* Запросить информацию об аккаунте
*
* @see https://dev.vk.com/method/account.getInfo
*
* @param array $fields Выбор полей с запрашиваемой информацией (оставить пустым, если нужны все)
*
* @return ?array Информация об аккаунте, если получена
*
* @todo
* 1. Доделать
* 2. Написать обработчик ошибок возвращаемых ВКонтакте
*/
public function getInfo(array $fields = []): array
{
// Реиницилазиция
$this->robot->api->reinit();
foreach ($fields as $key => $field) {
// Перебор запрашиваемых полей с информацией
// Запись запрашиваемого поля
$this->robot->api['fields'] .= $field;
// Запись разделителя
if ($key === array_key_last($fields)) break;
else $this->robot->api['fields'] .= ', ';
}
// Запрос
$request = json_decode($this->robot->browser->request('POST', 'account.getInfo', ['form_params' => $this->robot->api->settings])->getBody()->getContents());
// Если в ответе ошибка
if (isset($request->error)) {
throw new Exception('ВКонтакте: ' . $request->error->error_msg, $request->error->error_code);
}
return $request->response;
}
/**
* Запросить информацию о профиле
*
* @see https://dev.vk.com/method/account.getProfileInfo
*
* @param array $fields Выбор полей с запрашиваемой информацией (оставить пустым, если нужны все)
*
* @return ?array Информация об аккаунте, если получена
*
* @todo
* 1. Доделать
* 2. Написать обработчик ошибок возвращаемых ВКонтакте
*/
public function getProfileInfo(array $fields = []): array
{
// Реиницилазиция
$this->robot->api->reinit();
foreach ($fields as $key => $field) {
// Перебор запрашиваемых полей с информацией
// Запись запрашиваемого поля
$this->robot->api['fields'] .= $field;
// Запись разделителя
if ($key === array_key_last($fields)) break;
else $this->robot->api['fields'] .= ', ';
}
// Запрос
$request = json_decode($this->robot->browser->request('POST', 'account.getProfileInfo', ['form_params' => $this->robot->api->settings])->getBody()->getContents());
// Если в ответе ошибка
if (isset($request->error)) {
throw new Exception('ВКонтакте: ' . $request->error->error_msg, $request->error->error_code);
}
return $request->response;
}
}

View File

@@ -4,23 +4,42 @@ declare(strict_types=1);
namespace mirzaev\vk\api\methods; namespace mirzaev\vk\api\methods;
use Exception; // Файлы проекта
use mirzaev\vk\robots\robot,
mirzaev\vk\robots\group;
use mirzaev\accounts\vk; // Встроенные библиотеки
use mirzaev\vk\robots\robot; use stdClass,
use mirzaev\vk\api\data; Exception;
use mirzaev\vk\robots\group;
/** /**
* Режимы отправки сообщений * Режимы отправки сообщений
*/ */
enum mode enum send
{ {
/** Быстро - случайный идентификатор (умножение на rand()) */ /** Обычная отправка */
case simple;
/** Проверка отправки */
case check;
}
/**
* Режимы генерации идентификатора сессии доставки сообщения
*/
enum generate
{
/** Генерация: time() */
case date;
/** Генерация: rand() */
case random; case random;
/** Надёжно - проверка отправки (поиск сообщения через messages.getById) */ /** Генерация: random_bytes(10) */
case search; case crypto;
/** Генерация: sodium_crypto_generichash() */
case hash;
} }
/** /**
@@ -39,36 +58,81 @@ enum mode
final class messages extends method final class messages extends method
{ {
/** /**
* @var mode $mode Режим отправки сообщений * @var send $send_mode Режим отправки сообщений
*/ */
protected mode $mode = mode::random; protected send $send_mode = send::simple;
/** /**
* @var array[int] Сообщения для пересылки * @var generate $generate_mode Режим генерации идентификатора сессии доставки сообщения
*/ */
protected array $forward; protected generate $generate_mode = generate::date;
/** /**
* @var int Сообщение для ответа * @var ?int $lat Географическая ширина
*/ */
protected int $reply; protected ?int $lat = null;
/**
* @var ?int $long Географическая долгота
*/
protected ?int $long = null;
/**
* @var ?int $reply_to Идентификатор сообщения, на которое требуется ответить
*/
protected ?int $reply_to = null;
/**
* @var ?array $forward_messages Идентификаторы пересылаемых сообщений
*/
protected ?array $forward_messages = null;
/**
* @var ?string $sticker_id Идентификатор стикера
*/
protected ?string $sticker_id = null;
/**
* @var ?string $payload Полезная нагрузка
*/
protected ?string $payload = null;
/**
* @var bool $dont_parse_links Не создавать представление ссылки в сообщении?
*/
protected bool $dont_parse_links = false;
/**
* @var bool $disable_mentions Отключить уведомление об упоминании в сообщении?
*/
protected bool $disable_mentions = false;
/**
* @var ?string $intent Интент
*/
protected ?string $intent = null;
/**
* @var ?string $subscribe_id Число, которое будет использоваться для работы с интентами
*/
protected ?int $subscribe_id = null;
/** /**
* Конструктор * Конструктор
* *
* @param robot $robot Робот * @param robot $robot Робот
* @param int|string|array|null $destination Получатель * @param int|string|array|null $receiver Получатель
* @param string|null $text Текст * @param string|null $text Текст
*/ */
public function __construct( public function __construct(
protected robot $robot, protected robot $robot,
int|string|array|null $destination = null, int|string|array|null $receiver = null,
protected string|null $text = null protected string|null $text = null
) { ) {
if (isset($this->text, $destination)) { if (isset($this->text, $receiver)) {
// Быстрая отправка // Быстрая отправка
$this->send($destination); $this->send($receiver);
} }
} }
@@ -120,65 +184,132 @@ final class messages extends method
* *
* @see https://vk.com/dev/messages.send * @see https://vk.com/dev/messages.send
* *
* @param int|string|array|null $destination Получатель * @param int|string|null $receiver Получатель
* @param ?string $message Сообщение
* @param ?int $lat Географическая ширина
* @param ?int $long Географическая долгота
* @param ?array $attachments Вложения
* @param ?int $reply_to Идентификатор сообщения, на которое требуется ответить
* @param ?array $forward_messages Идентификаторы пересылаемых сообщений
* @param ?forward $forward Пересылаемые сообщения (в другой чат)
* @param ?string $sticker_id Идентификатор стикера
* @param ?keyboard $keyboard Инстанция клавиатуры
* @param ?template $template Инстанция шаблона сообщения
* @param ?string $payload Полезная нагрузка
* @param bool $dont_parse_links Не создавать представление ссылки в сообщении?
* @param bool $disable_mentions Отключить уведомление об упоминании в сообщении?
* @param ?string $intent Интент
* @param ?int $subscribe_id Число, которое будет использоваться для работы с интентами
* @param int|string|null $random_id Идентификатор сессии доставки сообщения (защита от повторных отправок)
* *
* @return int|array Идентификатор успешно отправленного сообщения или ответ сервера (подразумевается ошибка) * @return int|array Идентификатор успешно отправленного сообщения или ответ сервера (подразумевается ошибка)
* *
* @todo Написать обработчик ошибок возвращаемых ВКонтакте * @todo
* 1. Написать обработчик ошибок возвращаемых ВКонтакте
* 2. Добавить параметр forward (не путать с forward_messages)
* 3. Добавить клавиатуру
* 4. Добавить шаблоны сообщений
* 5. Добавить content_source
*/ */
public function send(int|string|array|null $destination): int|array public function send(
{ int|string|null $receiver,
// Идентификатор ?string $message = null,
$random_id = time(); ?int $lat = null,
?int $long = null,
if ($this->mode === mode::random) { ?array $attachments = null,
// Быстрая отправка сообщения ?int $reply_to = null,
?array $forward_messages = null,
$random_id *= rand(); // ?forward $forward = null,
} ?string $sticker_id = null,
// ?keyboard $keyboard = null,
// Реиницилазиция // ?template $template = null,
?string $payload = null,
bool $dont_parse_links = false,
bool $disable_mentions = false,
?string $intent = null,
?int $subscribe_id = null,
int|string|null $random_id = null,
): int|array {
// Реинициализация настроек
$this->robot->api->reinit(); $this->robot->api->reinit();
// Цель отправки // Инициализация получателя
$this->robot->api->destination($destination); if (is_int($receiver)) ($id = $receiver - 2000000000) > 0 ? $this->robot->api['peer_id'] = $receiver : $this->robot->api['chat_id'] = $id;
else if (is_array($receiver)) $this->robot->api['peer_ids'] = implode(',', $receiver);
else if (is_string($receiver)) $this->robot->api['domain'] = $receiver;
// Инициализация идентификатора сообщения (защита от повторных отправок) в настройках API // Инициализация идентификатора сессии доставки сообщения (защита от повторных отправок)
$this->robot->api['random_id'] = $random_id; $this->robot->api['random_id'] = $random_id ?? match ($this->generate_mode) {
generate::date => time(),
generate::random => rand(),
generate::crypto => random_bytes(10),
generate::hash => sodium_crypto_generichash(random_bytes(10)),
default => time()
};
// Инициализация текста в настройках API // Инициализация текста в настройках API
$this->robot->api['message'] = $this->text; if (isset($message)) $this->robot->api['message'] = $message;
else if (isset($this->text)) $this->robot->api['message'] = $this->text;
// Пересылаемые сообщения // Инициализация широты
if (!empty($this->forwardMessages)) { if (isset($lat)) $this->robot->api['lat'] = $lat;
else if (isset($this->lat)) $this->robot->api['lat'] = $this->lat;
// Инициализация пересылаемых сообщений в настройках API // Инициализация долготы
$this->robot->api['forward_messages'] = implode(',', $this->forwardMessages); if (isset($long)) $this->robot->api['long'] = $long;
} else if (isset($this->long)) $this->robot->api['long'] = $this->tlongext;
// Ответные сообщения // Инициализация вложений
if (isset($this->ReplyMessage)) { if (isset($attachments)) $this->robot->api['attachment'] = implode(',', $attachments);
else if (isset($this->robot->api->data) && $this->robot->api->__get('data') !== []) $this->robot->api['attachment'] = implode(',', $this->robot->api->__get('data'));
// Инициализация идентификатора сообщения на которое обрабатывается ответ в настройках API // Инициализация сообщения, на которое требуется ответить
$this->robot->api['reply_to'] = $this->ReplyMessage; if (isset($reply_to)) $this->robot->api['reply_to'] = $reply_to;
} else if (isset($this->reply)) $this->robot->api['reply_to'] = $this->reply;
// Вложения // Инициализация пересылаемых сообщений
if (isset($this->data) && $this->__get('data') !== []) { // !empty($this->data->data) почемуто не работает if (isset($forward_messages)) $this->robot->api['forward_messages'] = implode(',', $forward_messages);
else if (isset($this->forward_messages)) $this->robot->api['forward_messages'] = implode(',', $this->forward_messages);
// Инициализация вложений в настройках API // Инициализация стикера
$this->robot->api['attachment'] = implode(',', $this->__get('data')); if (isset($sticker_id)) $this->robot->api['sticker_id'] = $sticker_id;
} else if (isset($this->sticker_id)) $this->robot->api['sticker_id'] = $this->sticker_id;
// Инициализация полезной нагрузки
if (isset($payload)) $this->robot->api['payload'] = $payload;
else if (isset($this->payload)) $this->robot->api['payload'] = $this->payload;
// Инициализация пользовательского соглашения
// $this->robot->api['content_source'] = $this->robot->content_source;
// Инициализация "не создавать представление ссылки в сообщении?"
if ($dont_parse_links) $this->robot->api['dont_parse_links'] = 1;
else if ($this->dont_parse_links) $this->robot->api['dont_parse_links'] = 1;
// Инициализация "отключить уведомление об упоминании в сообщении?"
if ($disable_mentions) $this->robot->api['disable_mentions'] = 1;
else if ($this->disable_mentions) $this->robot->api['disable_mentions'] = 1;
// Инициализация интентов
if (isset($intent)) $this->robot->api['intent'] = $intent;
else if (isset($this->intent)) $this->robot->api['intent'] = $this->intent;
// Инициализация числа, которое будет использоваться для работы с интентами
if (isset($subscribe_id)) $this->robot->api['subscribe_id'] = $subscribe_id;
else if (isset($this->subscribe_id)) $this->robot->api['subscribe_id'] = $this->subscribe_id;
// Проверка сформированного сообщения
if (!$this->robot->api->offsetExists('message') && !$this->robot->api->offsetExists('attachment')) throw new Exception('Сообщение должно содержать текст, либо вложение');
// Запрос // Запрос
$request = json_decode($this->robot->browser->request('POST', 'messages.send', ['form_params' => $this->robot->api->settings])->getBody()->getContents()); $request = json_decode($this->robot->browser->request('POST', 'messages.send', ['form_params' => $this->robot->api->settings])->getBody()->getContents());
// Если в ответе ошибка // Если в ответе ошибка
if (isset($request->error)) { if (isset($request->error)) {
throw new Exception('Вконтакте: ' . $request->error->error_msg, $request->error->error_code); throw new Exception('ВКонтакте: ' . $request->error->error_msg, $request->error->error_code);
} }
if ($this->mode === mode::search) { if ($this->send_mode === send::check) {
// Надёжная доставка сообщения // Надёжная доставка сообщения
if (!empty($request["response"])) { if (!empty($request["response"])) {
@@ -197,7 +328,7 @@ final class messages extends method
//!!!!!!!!!!!!!!!!!!!!!!!!! //!!!!!!!!!!!!!!!!!!!!!!!!!
// Повторная отправка // Повторная отправка
$this->send($destination); $this->send($receiver);
} }
} else { } else {
} }
@@ -206,6 +337,59 @@ final class messages extends method
return $request->response; return $request->response;
} }
/**
* Удалить сообщение
*
* @see https://vk.com/dev/messages.delete
*
* @param int|string|array|null $messages Получатель (message_ids + cmids)
* @param int|string|null $peer_id Идентификатор беседы
* @param bool $spam Пометить как спам?
* @param bool $delete_for_all Удалить для всех?
*
* @return int|array Идентификатор успешно отправленного сообщения или ответ сервера (подразумевается ошибка)
*
* @todo Написать обработчик ошибок возвращаемых ВКонтакте
*/
public function delete(string|int|array|null $messages = null, int|string|null $peer_id = null, bool $spam = false, bool $delete_for_all = false): stdClass
{
// Реиницилазиция настроек
$this->robot->api->reinit();
if (isset($peer_id)) {
// Получен идентификатор беседы
// Инициализация идентификатора беседы
$this->robot->api['peer_id'] = $peer_id;
// Инициализация идентификаторов сообщений
$this->robot->api['cmids'] = $messages;
// Инициализация: "удалить для всех?"
$this->robot->api['delete_for_all'] = 1;
} else {
// Не получен идентификатор беседы
// Инициализация идентификаторов сообщений
$this->robot->api['message_ids'] = $messages;
// Инициализация: "удалить для всех?"
if ($delete_for_all) $this->robot->api['delete_for_all'] = 1;
}
// Инициализация: "сообщить о спаме?"
if ($spam) $this->robot->api['spam'] = $spam;
// Запрос
$request = json_decode($this->robot->browser->request('POST', 'messages.delete', ['form_params' => $this->robot->api->settings])->getBody()->getContents());
// Проверка на наличие ошибок в ответе от ВКонтакте
if (isset($request->error)) throw new Exception('ВКонтакте: ' . $request->error->error_msg, $request->error->error_code);
return $request->response;
}
/** /**
* Записать свойство * Записать свойство
* *

View File

@@ -4,58 +4,12 @@ declare(strict_types=1);
namespace mirzaev\vk\api\methods; namespace mirzaev\vk\api\methods;
use mirzaev\vk\robots\robot;
/** /**
* Абстракция метода API * Абстракция метода API ВКонтакте
*
* @method protected static put(string $url, ...$params) Создать
* @method protected static post(string $url, ...$params) Изменить
* @method protected static get(string $url, ...$params) Получить
* @method protected static delete(string $url, ...$params) Удалить
* *
* @package mirzaev\vk\api\methods * @package mirzaev\vk\api\methods
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy> * @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
*/ */
abstract class method abstract class method
{ {
/**
* Создать
*
* @return array Ответ сервера
*/
public static function put(): array
{
return ['error' => 'Метод не поддерживается'];
}
/**
* Изменить
*
* @return array Ответ сервера
*/
public static function post(): array
{
return ['error' => 'Метод не поддерживается'];
}
/**
* Получить
*
* @return array Ответ сервера
*/
public static function get(): array
{
return ['error' => 'Метод не поддерживается'];
}
/**
* Удалить
*
* @return array Ответ сервера
*/
public static function delete(): array
{
return ['error' => 'Метод не поддерживается'];
}
} }

View File

@@ -27,7 +27,7 @@ use mirzaev\accounts\vk as account;
final class photos extends method final class photos extends method
{ {
/** /**
* Создать сообщение * Конструктор
* *
* @param robot $robot Робот * @param robot $robot Робот
*/ */

View File

@@ -0,0 +1,114 @@
<?php
declare(strict_types=1);
namespace mirzaev\vk\api\methods;
// Файлы проекта
use mirzaev\vk\robots\robot;
// Встроенные библиотеки
use Exception,
stdClass;
/**
* Пользователь
*
*
* @see https://dev.vk.com/method/users
*
* @package mirzaev\vk\api
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
*/
final class users extends method
{
/**
* Конструктор
*
* @param robot $user Робот
*/
public function __construct(
protected robot $robot
) {
}
/**
* Запросить информацию о пользователе
*
* @see https://dev.vk.com/method/users.get
*
* @param array $receiver Выбор пользователей для запроса информации (user_ids)
* @param array $fields Выбор дополнительных запрашиваемых полей
* @param string $name_case Падеж
*
* @return stdClass|array|null Информация об аккаунте или массив с информацией об аккаунтах, если найдена
*
* @todo
* 1. Доделать
* 2. Написать обработчик ошибок возвращаемых ВКонтакте
*/
public function get(int|string|array $receiver = [], array $fields = [], ?string $name_case = null): stdClass|array|null
{
// Реиницилазиция
$this->robot->api->reinit();
if (is_int($receiver)) {
// Идентификатор
// Инициализация пользователя
$this->robot->api['user_ids'] = $receiver;
} else if (is_array($receiver)) {
// Идентификаторы
// Инициализация пользователей
$this->robot->api['user_ids'] = '';
foreach ($receiver as $key => $user_id) {
// Перебор пользователей для получения информации
// Запись пользователя
$this->robot->api['user_ids'] .= $user_id;
// Запись разделителя
if ($key === array_key_last($receiver)) break;
else $this->robot->api['user_ids'] .= ', ';
}
} else if (is_string($receiver)) {
// Домен
// Инициализация пользователя
$this->robot->api['user_ids'] = $receiver;
}
if (isset($fields)) {
// Запрошены дополнительные запрашиваемые поля
// Инициализация дополнительных запрашиваемых полей
$this->robot->api['fields'] = '';
foreach ($fields as $key => $field) {
// Перебор дополнительных запрашиваемых полей
// Запись запрашиваемого дополнительного поля
$this->robot->api['fields'] .= $field;
// Запись разделителя
if ($key === array_key_last($fields)) break;
else $this->robot->api['fields'] .= ', ';
}
}
// Инициализация падежа
if (isset($name_case)) $this->robot->api['name_case'] = $name_case;
// Запрос
$request = json_decode($this->robot->browser->request('POST', 'users.get', ['form_params' => $this->robot->api->settings])->getBody()->getContents());
// Если в ответе ошибка
if (isset($request->error)) {
throw new Exception('ВКонтакте: ' . $request->error->error_msg, $request->error->error_code);
}
return is_array($receiver) ? $request->response : (isset($request->response[0]) ? $request->response[0] : null);
}
}

View File

@@ -17,9 +17,6 @@ use mirzaev\vk\robots\robot;
* @var array $settings Настройки * @var array $settings Настройки
* @var float $version Версия API * @var float $version Версия API
* *
* @todo
* 1. Создать __isset(), __unset()
*
* @package mirzaev\vk\api * @package mirzaev\vk\api
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy> * @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
*/ */
@@ -30,7 +27,7 @@ class settings implements ArrayAccess
* *
* Должна иметь тип string потому, что PHP при стандартных настройках удаляет нули у float * Должна иметь тип string потому, что PHP при стандартных настройках удаляет нули у float
*/ */
protected const VK_API_VERSION_DEFAULT = '5.130'; protected const VK_API_VERSION_DEFAULT = '5.131';
/** /**
* Конструктор * Конструктор
@@ -145,36 +142,6 @@ class settings implements ArrayAccess
return $this; return $this;
} }
/**
* Инициализация получателя
*
* @see mirzaev\vk\api\methods\messages Сообщения
*/
public function destination(string|array|int $target): self
{
if (is_int($target)) {
// Идентификатор
$this->settings['peer_id'] = $target;
return $this;
} else if (is_array($target)) {
// Идентификаторы
$this->settings['user_ids'] = $target;
return $this;
} else if (is_string($target)) {
// Домен
$this->settings['domain'] = $target;
return $this;
}
throw new Exception('Не удалось определить получателя', 500);
}
/** /**
* Записать свойство * Записать свойство
* *
@@ -206,15 +173,39 @@ class settings implements ArrayAccess
}; };
} }
// public function __unset(string $name): void /**
// { * Проверить инициализированность свойства
// match ($name) { *
// 'settings' => throw new Exception('Запрещено удалять настройки', 500), * @param string $name Название
// 'robot' => throw new Exception('Запрещено удалять робота', 500), *
// 'data', 'attachments' => $this->offsetUnset('attachments'), * @return bool Свойство инициализировано?
// default => $this->offsetUnset($name) */
// }; public function __isset(string $name): bool
// } {
return match ($name) {
'settings' => isset($this->settings),
'robot' => isset($this->robot),
'data', 'attachments' => $this->offsetExists('attachments'),
default => $this->offsetExists($name)
};
}
/**
* Деинициализированность свойство
*
* @param string $name Название
*
* @return void
*/
public function __unset(string $name): void
{
match ($name) {
'settings' => throw new Exception('Запрещено деинициализировать настройки', 500),
'robot' => throw new Exception('Запрещено деинициализировать робота', 500),
'data', 'attachments' => $this->offsetUnset('attachments'),
default => $this->offsetUnset($name)
};
}
/** /**
* Записать по смещению * Записать по смещению
@@ -266,7 +257,7 @@ class settings implements ArrayAccess
/** /**
* Прочитать по смещению * Прочитать по смещению
*/ */
public function &offsetGet(mixed $offset): mixed public function offsetGet(mixed $offset): mixed
{ {
if (isset($this->settings)) { if (isset($this->settings)) {
if (strcasecmp($offset, 'settings') === 0) { if (strcasecmp($offset, 'settings') === 0) {
@@ -290,7 +281,11 @@ class settings implements ArrayAccess
} }
/** /**
* Проверка существования смещения * Проверить существование смещения
*
* @param mixed $offset Сдвиг
*
* @return bool Смещение существует?
*/ */
public function offsetExists(mixed $offset): bool public function offsetExists(mixed $offset): bool
{ {