From c01b6e43fd5236ab8fe504bf355184bf6dd4734b Mon Sep 17 00:00:00 2001
From: Andrew Dolgov <noreply@fakecake.org>
Date: Fri, 26 Feb 2021 15:33:59 +0300
Subject: [PATCH] add pluginhost->get_array() shorthand

---
 classes/pluginhost.php | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/classes/pluginhost.php b/classes/pluginhost.php
index b6f645a9c..348c67bab 100755
--- a/classes/pluginhost.php
+++ b/classes/pluginhost.php
@@ -514,6 +514,14 @@ class PluginHost {
 		}
 	}
 
+	function get_array(Plugin $sender, string $name, array $default_value = []) {
+		$tmp = $this->get($sender, $name);
+
+		if (!is_array($tmp)) $tmp = $default_value;
+
+		return $tmp;
+	}
+
 	function get_all($sender) {
 		$idx = get_class($sender);
 
-- 
GitLab