]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/arraywrapper.php
Last type-hint is an array, added.
[quix0rs-gnu-social.git] / lib / arraywrapper.php
index 47ae057dccdf96473df6bda7041cff71d15094e3..30cb6cfdc79da2647580d89aa32d20f6ff8a6c47 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
- * Laconica - a distributed open-source microblogging tool
- * Copyright (C) 2008, 2009, Control Yourself, Inc.
+ * StatusNet - the distributed open-source microblogging tool
+ * Copyright (C) 2008, 2009, StatusNet, Inc.
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as published by
@@ -17,7 +17,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-if (!defined('LACONICA')) {
+if (!defined('STATUSNET') && !defined('LACONICA')) {
     exit(1);
 }
 
@@ -48,6 +48,16 @@ class ArrayWrapper
         }
     }
 
+       function fetchAll($k= false, $v = false, $method = false)
+       {
+               if ($k !== false || $v !== false || $method !== false)
+               {
+                       $item =& $this->_items[$this->_i];
+                       return $item->fetchAll($k, $v, $method);
+               }
+               return $this->_items;
+       }
+       
     function __set($name, $value)
     {
         $item =& $this->_items[$this->_i];
@@ -76,6 +86,10 @@ class ArrayWrapper
     function __call($name, $args)
     {
         $item =& $this->_items[$this->_i];
+        if (!is_object($item)) {
+            common_log(LOG_ERR, "Invalid entry " . var_export($item, true) . " at index $this->_i of $this->N; calling $name()");
+            throw new ServerException("Internal error: bad entry in array wrapper list.");
+        }
         return call_user_func_array(array($item, $name), $args);
     }
 }