drop async-interop
[m6w6/seekat] / lib / API / Future.php
index 2b53ea1cf847c827be0838eb5320f54557f1694f..6032e028d42b55117661b3c6c42410965812231c 100644 (file)
@@ -2,8 +2,6 @@
 
 namespace seekat\API;
 
-use AsyncInterop\Promise;
-
 interface Future
 {
        /**
@@ -14,34 +12,48 @@ interface Future
 
        /**
         * @param object $context Promisor
-        * @return Promise
+        * @return mixed promise
+        */
+       function getPromise($context);
+
+       /**
+        * @param mixed $promise
+        * @return bool
         */
-       function getPromise($context) : Promise;
+       function isPromise($promise) : bool;
 
        /**
-        * @param Promise $promise
+        * @param mixed $promise
         * @return bool
         */
-       function cancelPromise(Promise $promise) : bool;
+       function cancelPromise($promise) : bool;
+
+       /**
+        * @param mixed $promise
+        * @param callable|null $onResult
+        * @param callable|null $onError
+        * @return mixed promise
+        */
+       function handlePromise($promise, callable $onResult = null, callable $onError = null);
 
        /**
         * @param object $context Promisor returned by createContext
         * @param mixed $value
         * @return void
         */
-       function onSuccess($context, $value);
+       function resolve($context, $value);
 
        /**
-        * @param object $context Proisor returned by createContext
+        * @param object $context Promisor returned by createContext
         * @param mixed $reason
         * @return void
         */
-       function onFailure($context, $reason);
+       function reject($context, $reason);
 
        /**
         * @param object $context Promisor returned by createContext
         * @param array $promises
-        * @return Promise
+        * @return mixed promise
         */
-       function onMultiple($context, array $promises) : Promise;
+       function all($context, array $promises);
 }