]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Extended Phergie_Config to allow passing config array instead of loading from file
authorLuke Fitzgerald <lw.fitzgerald@googlemail.com>
Fri, 9 Jul 2010 09:43:40 +0000 (02:43 -0700)
committerLuke Fitzgerald <lw.fitzgerald@googlemail.com>
Fri, 9 Jul 2010 09:43:40 +0000 (02:43 -0700)
plugins/Irc/extlib/phergie/Phergie/ExtendedConfig.php [new file with mode: 0644]

diff --git a/plugins/Irc/extlib/phergie/Phergie/ExtendedConfig.php b/plugins/Irc/extlib/phergie/Phergie/ExtendedConfig.php
new file mode 100644 (file)
index 0000000..ea7368a
--- /dev/null
@@ -0,0 +1,26 @@
+<?php\r
+class Phergie_Extended_Config extends Phergie_Config {\r
+    /**\r
+     * Incorporates an associative array of settings into the current\r
+     * configuration settings.\r
+     *\r
+     * @param array $array Array of settings\r
+     *\r
+     * @return Phergie_Config Provides a fluent interface\r
+     * @throws Phergie_Config_Exception\r
+     */\r
+    public function readArray($array) {\r
+        $settings = $array;\r
+        if (!is_array($settings)) {\r
+            throw new Phergie_Config_Exception(\r
+                'Parameter is not an array',\r
+                Phergie_Config_Exception::ERR_ARRAY_NOT_RETURNED\r
+            );\r
+        }\r
+\r
+        $this->files[$file] = array_keys($settings);\r
+        $this->settings += $settings;\r
+\r
+        return $this;\r
+    }\r
+}\r