yet another github api refactoring
[pharext/pharext.org] / app / Github / API / Call.php
index d4afd19eeb3c375408162728293622a2f2e2b12c..22a69516e3f7fb60d466e3eac46b1522e6e13122 100644 (file)
@@ -35,6 +35,11 @@ abstract class Call
         */
        protected $query;
        
+       /**
+        * @var array
+        */
+       protected $result;
+       
        /**
         * Queue this call to the API client
         */
@@ -58,8 +63,8 @@ abstract class Call
        }
        
        function __invoke(callable $callback) {
-               if ($this->readFromCache($cached)) {
-                       call_user_func_array($callback, $cached);
+               if ($this->readFromCache($this->result)) {
+                       call_user_func_array($callback, $this->result);
                } else {
                        $this->enqueue($callback);
                }
@@ -79,7 +84,8 @@ abstract class Call
         * Call Client::send()
         */
        function send() {
-               return $this->api->getClient()->send();
+               $this->api->getClient()->send();
+               return $this->result;
        }
        
        /**