From e0955a203412cdac4c6db9b4d84c415fea972090 Mon Sep 17 00:00:00 2001 From: Arsen Mirzaev Tatyano-Muradovich Date: Sun, 19 Sep 2021 03:25:49 +1000 Subject: [PATCH] __isset() --- mirzaev/arangodb/system/connection.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/mirzaev/arangodb/system/connection.php b/mirzaev/arangodb/system/connection.php index d8f053b..a80193b 100644 --- a/mirzaev/arangodb/system/connection.php +++ b/mirzaev/arangodb/system/connection.php @@ -174,4 +174,28 @@ final class connection default => throw new exception("Свойство \"$name\" не найдено", 404) }; } + + /** + * Проверить свойство на инициализированность + * + * @param mixed $name Название + */ + public function __isset(string $name): bool + { + return match ($name) { + 'adress', 'endpoint' => isset($this->adress), + 'storage', 'database', 'db' => isset($this->storage), + 'auth' => isset($this->auth), + 'name' => isset($this->name), + 'password' => isset($this->password), + 'connection' => isset($this->connection), + 'timeout_connect' => isset($this->timeout_connect), + 'timeout_request' => isset($this->timeout_request), + 'reconnect' => isset($this->reconnect), + 'create' => isset($this->create), + 'update', 'policy' => isset($this->update), + 'session' => isset($this->session), + default => throw new exception("Свойство \"$name\" не найдено", 404) + }; + } }