add pluginhost->get_array() shorthand

This commit is contained in:
Andrew Dolgov 2021-02-26 15:33:59 +03:00
parent bf9033beb6
commit c01b6e43fd
1 changed files with 8 additions and 0 deletions

View File

@ -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);