aboutsummaryrefslogtreecommitdiffhomepage
path: root/assets/php/vendor/react/promise/src
diff options
context:
space:
mode:
authormarvin-borner@live.com2018-04-16 21:09:05 +0200
committermarvin-borner@live.com2018-04-16 21:09:05 +0200
commitcf14306c2b3f82a81f8d56669a71633b4d4b5fce (patch)
tree86700651aa180026e89a66064b0364b1e4346f3f /assets/php/vendor/react/promise/src
parent619b01b3615458c4ed78bfaeabb6b1a47cc8ad8b (diff)
Main merge to user management system - files are now at /main/public/
Diffstat (limited to 'assets/php/vendor/react/promise/src')
-rwxr-xr-xassets/php/vendor/react/promise/src/CancellablePromiseInterface.php11
-rwxr-xr-xassets/php/vendor/react/promise/src/CancellationQueue.php55
-rwxr-xr-xassets/php/vendor/react/promise/src/Deferred.php60
-rwxr-xr-xassets/php/vendor/react/promise/src/Exception/LengthException.php7
-rwxr-xr-xassets/php/vendor/react/promise/src/ExtendedPromiseInterface.php26
-rwxr-xr-xassets/php/vendor/react/promise/src/FulfilledPromise.php68
-rwxr-xr-xassets/php/vendor/react/promise/src/LazyPromise.php63
-rwxr-xr-xassets/php/vendor/react/promise/src/Promise.php216
-rwxr-xr-xassets/php/vendor/react/promise/src/PromiseInterface.php11
-rwxr-xr-xassets/php/vendor/react/promise/src/PromisorInterface.php11
-rwxr-xr-xassets/php/vendor/react/promise/src/RejectedPromise.php76
-rwxr-xr-xassets/php/vendor/react/promise/src/UnhandledRejectionException.php31
-rwxr-xr-xassets/php/vendor/react/promise/src/functions.php244
-rwxr-xr-xassets/php/vendor/react/promise/src/functions_include.php5
14 files changed, 0 insertions, 884 deletions
diff --git a/assets/php/vendor/react/promise/src/CancellablePromiseInterface.php b/assets/php/vendor/react/promise/src/CancellablePromiseInterface.php
deleted file mode 100755
index 896db2d..0000000
--- a/assets/php/vendor/react/promise/src/CancellablePromiseInterface.php
+++ /dev/null
@@ -1,11 +0,0 @@
-<?php
-
-namespace React\Promise;
-
-interface CancellablePromiseInterface extends PromiseInterface
-{
- /**
- * @return void
- */
- public function cancel();
-}
diff --git a/assets/php/vendor/react/promise/src/CancellationQueue.php b/assets/php/vendor/react/promise/src/CancellationQueue.php
deleted file mode 100755
index a366994..0000000
--- a/assets/php/vendor/react/promise/src/CancellationQueue.php
+++ /dev/null
@@ -1,55 +0,0 @@
-<?php
-
-namespace React\Promise;
-
-class CancellationQueue
-{
- private $started = false;
- private $queue = [];
-
- public function __invoke()
- {
- if ($this->started) {
- return;
- }
-
- $this->started = true;
- $this->drain();
- }
-
- public function enqueue($cancellable)
- {
- if (!method_exists($cancellable, 'then') || !method_exists($cancellable, 'cancel')) {
- return;
- }
-
- $length = array_push($this->queue, $cancellable);
-
- if ($this->started && 1 === $length) {
- $this->drain();
- }
- }
-
- private function drain()
- {
- for ($i = key($this->queue); isset($this->queue[$i]); $i++) {
- $cancellable = $this->queue[$i];
-
- $exception = null;
-
- try {
- $cancellable->cancel();
- } catch (\Throwable $exception) {
- } catch (\Exception $exception) {
- }
-
- unset($this->queue[$i]);
-
- if ($exception) {
- throw $exception;
- }
- }
-
- $this->queue = [];
- }
-}
diff --git a/assets/php/vendor/react/promise/src/Deferred.php b/assets/php/vendor/react/promise/src/Deferred.php
deleted file mode 100755
index f23980c..0000000
--- a/assets/php/vendor/react/promise/src/Deferred.php
+++ /dev/null
@@ -1,60 +0,0 @@
-<?php
-
-namespace React\Promise;
-
-class Deferred implements PromisorInterface
-{
- private $promise;
- private $resolveCallback;
- private $rejectCallback;
- private $notifyCallback;
- private $canceller;
-
- public function __construct(callable $canceller = null)
- {
- $this->canceller = $canceller;
- }
-
- public function promise()
- {
- if (null === $this->promise) {
- $this->promise = new Promise(function ($resolve, $reject, $notify) {
- $this->resolveCallback = $resolve;
- $this->rejectCallback = $reject;
- $this->notifyCallback = $notify;
- }, $this->canceller);
- }
-
- return $this->promise;
- }
-
- public function resolve($value = null)
- {
- $this->promise();
-
- call_user_func($this->resolveCallback, $value);
- }
-
- public function reject($reason = null)
- {
- $this->promise();
-
- call_user_func($this->rejectCallback, $reason);
- }
-
- public function notify($update = null)
- {
- $this->promise();
-
- call_user_func($this->notifyCallback, $update);
- }
-
- /**
- * @deprecated 2.2.0
- * @see Deferred::notify()
- */
- public function progress($update = null)
- {
- $this->notify($update);
- }
-}
diff --git a/assets/php/vendor/react/promise/src/Exception/LengthException.php b/assets/php/vendor/react/promise/src/Exception/LengthException.php
deleted file mode 100755
index 775c48d..0000000
--- a/assets/php/vendor/react/promise/src/Exception/LengthException.php
+++ /dev/null
@@ -1,7 +0,0 @@
-<?php
-
-namespace React\Promise\Exception;
-
-class LengthException extends \LengthException
-{
-}
diff --git a/assets/php/vendor/react/promise/src/ExtendedPromiseInterface.php b/assets/php/vendor/react/promise/src/ExtendedPromiseInterface.php
deleted file mode 100755
index 9cb6435..0000000
--- a/assets/php/vendor/react/promise/src/ExtendedPromiseInterface.php
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-
-namespace React\Promise;
-
-interface ExtendedPromiseInterface extends PromiseInterface
-{
- /**
- * @return void
- */
- public function done(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null);
-
- /**
- * @return ExtendedPromiseInterface
- */
- public function otherwise(callable $onRejected);
-
- /**
- * @return ExtendedPromiseInterface
- */
- public function always(callable $onFulfilledOrRejected);
-
- /**
- * @return ExtendedPromiseInterface
- */
- public function progress(callable $onProgress);
-}
diff --git a/assets/php/vendor/react/promise/src/FulfilledPromise.php b/assets/php/vendor/react/promise/src/FulfilledPromise.php
deleted file mode 100755
index 914bb5c..0000000
--- a/assets/php/vendor/react/promise/src/FulfilledPromise.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?php
-
-namespace React\Promise;
-
-class FulfilledPromise implements ExtendedPromiseInterface, CancellablePromiseInterface
-{
- private $value;
-
- public function __construct($value = null)
- {
- if ($value instanceof PromiseInterface) {
- throw new \InvalidArgumentException('You cannot create React\Promise\FulfilledPromise with a promise. Use React\Promise\resolve($promiseOrValue) instead.');
- }
-
- $this->value = $value;
- }
-
- public function then(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null)
- {
- if (null === $onFulfilled) {
- return $this;
- }
-
- try {
- return resolve($onFulfilled($this->value));
- } catch (\Throwable $exception) {
- return new RejectedPromise($exception);
- } catch (\Exception $exception) {
- return new RejectedPromise($exception);
- }
- }
-
- public function done(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null)
- {
- if (null === $onFulfilled) {
- return;
- }
-
- $result = $onFulfilled($this->value);
-
- if ($result instanceof ExtendedPromiseInterface) {
- $result->done();
- }
- }
-
- public function otherwise(callable $onRejected)
- {
- return $this;
- }
-
- public function always(callable $onFulfilledOrRejected)
- {
- return $this->then(function ($value) use ($onFulfilledOrRejected) {
- return resolve($onFulfilledOrRejected())->then(function () use ($value) {
- return $value;
- });
- });
- }
-
- public function progress(callable $onProgress)
- {
- return $this;
- }
-
- public function cancel()
- {
- }
-}
diff --git a/assets/php/vendor/react/promise/src/LazyPromise.php b/assets/php/vendor/react/promise/src/LazyPromise.php
deleted file mode 100755
index 7e3a3d3..0000000
--- a/assets/php/vendor/react/promise/src/LazyPromise.php
+++ /dev/null
@@ -1,63 +0,0 @@
-<?php
-
-namespace React\Promise;
-
-class LazyPromise implements ExtendedPromiseInterface, CancellablePromiseInterface
-{
- private $factory;
- private $promise;
-
- public function __construct(callable $factory)
- {
- $this->factory = $factory;
- }
-
- public function then(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null)
- {
- return $this->promise()->then($onFulfilled, $onRejected, $onProgress);
- }
-
- public function done(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null)
- {
- return $this->promise()->done($onFulfilled, $onRejected, $onProgress);
- }
-
- public function otherwise(callable $onRejected)
- {
- return $this->promise()->otherwise($onRejected);
- }
-
- public function always(callable $onFulfilledOrRejected)
- {
- return $this->promise()->always($onFulfilledOrRejected);
- }
-
- public function progress(callable $onProgress)
- {
- return $this->promise()->progress($onProgress);
- }
-
- public function cancel()
- {
- return $this->promise()->cancel();
- }
-
- /**
- * @internal
- * @see Promise::settle()
- */
- public function promise()
- {
- if (null === $this->promise) {
- try {
- $this->promise = resolve(call_user_func($this->factory));
- } catch (\Throwable $exception) {
- $this->promise = new RejectedPromise($exception);
- } catch (\Exception $exception) {
- $this->promise = new RejectedPromise($exception);
- }
- }
-
- return $this->promise;
- }
-}
diff --git a/assets/php/vendor/react/promise/src/Promise.php b/assets/php/vendor/react/promise/src/Promise.php
deleted file mode 100755
index 0261eb3..0000000
--- a/assets/php/vendor/react/promise/src/Promise.php
+++ /dev/null
@@ -1,216 +0,0 @@
-<?php
-
-namespace React\Promise;
-
-class Promise implements ExtendedPromiseInterface, CancellablePromiseInterface
-{
- private $canceller;
- private $result;
-
- private $handlers = [];
- private $progressHandlers = [];
-
- private $requiredCancelRequests = 0;
- private $cancelRequests = 0;
-
- public function __construct(callable $resolver, callable $canceller = null)
- {
- $this->canceller = $canceller;
- $this->call($resolver);
- }
-
- public function then(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null)
- {
- if (null !== $this->result) {
- return $this->result->then($onFulfilled, $onRejected, $onProgress);
- }
-
- if (null === $this->canceller) {
- return new static($this->resolver($onFulfilled, $onRejected, $onProgress));
- }
-
- $this->requiredCancelRequests++;
-
- return new static($this->resolver($onFulfilled, $onRejected, $onProgress), function () {
- if (++$this->cancelRequests < $this->requiredCancelRequests) {
- return;
- }
-
- $this->cancel();
- });
- }
-
- public function done(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null)
- {
- if (null !== $this->result) {
- return $this->result->done($onFulfilled, $onRejected, $onProgress);
- }
-
- $this->handlers[] = function (ExtendedPromiseInterface $promise) use ($onFulfilled, $onRejected) {
- $promise
- ->done($onFulfilled, $onRejected);
- };
-
- if ($onProgress) {
- $this->progressHandlers[] = $onProgress;
- }
- }
-
- public function otherwise(callable $onRejected)
- {
- return $this->then(null, function ($reason) use ($onRejected) {
- if (!_checkTypehint($onRejected, $reason)) {
- return new RejectedPromise($reason);
- }
-
- return $onRejected($reason);
- });
- }
-
- public function always(callable $onFulfilledOrRejected)
- {
- return $this->then(function ($value) use ($onFulfilledOrRejected) {
- return resolve($onFulfilledOrRejected())->then(function () use ($value) {
- return $value;
- });
- }, function ($reason) use ($onFulfilledOrRejected) {
- return resolve($onFulfilledOrRejected())->then(function () use ($reason) {
- return new RejectedPromise($reason);
- });
- });
- }
-
- public function progress(callable $onProgress)
- {
- return $this->then(null, null, $onProgress);
- }
-
- public function cancel()
- {
- if (null === $this->canceller || null !== $this->result) {
- return;
- }
-
- $canceller = $this->canceller;
- $this->canceller = null;
-
- $this->call($canceller);
- }
-
- private function resolver(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null)
- {
- return function ($resolve, $reject, $notify) use ($onFulfilled, $onRejected, $onProgress) {
- if ($onProgress) {
- $progressHandler = function ($update) use ($notify, $onProgress) {
- try {
- $notify($onProgress($update));
- } catch (\Throwable $e) {
- $notify($e);
- } catch (\Exception $e) {
- $notify($e);
- }
- };
- } else {
- $progressHandler = $notify;
- }
-
- $this->handlers[] = function (ExtendedPromiseInterface $promise) use ($onFulfilled, $onRejected, $resolve, $reject, $progressHandler) {
- $promise
- ->then($onFulfilled, $onRejected)
- ->done($resolve, $reject, $progressHandler);
- };
-
- $this->progressHandlers[] = $progressHandler;
- };
- }
-
- private function resolve($value = null)
- {
- if (null !== $this->result) {
- return;
- }
-
- $this->settle(resolve($value));
- }
-
- private function reject($reason = null)
- {
- if (null !== $this->result) {
- return;
- }
-
- $this->settle(reject($reason));
- }
-
- private function notify($update = null)
- {
- if (null !== $this->result) {
- return;
- }
-
- foreach ($this->progressHandlers as $handler) {
- $handler($update);
- }
- }
-
- private function settle(ExtendedPromiseInterface $promise)
- {
- $promise = $this->unwrap($promise);
-
- $handlers = $this->handlers;
-
- $this->progressHandlers = $this->handlers = [];
- $this->result = $promise;
-
- foreach ($handlers as $handler) {
- $handler($promise);
- }
- }
-
- private function unwrap($promise)
- {
- $promise = $this->extract($promise);
-
- while ($promise instanceof self && null !== $promise->result) {
- $promise = $this->extract($promise->result);
- }
-
- return $promise;
- }
-
- private function extract($promise)
- {
- if ($promise instanceof LazyPromise) {
- $promise = $promise->promise();
- }
-
- if ($promise === $this) {
- return new RejectedPromise(
- new \LogicException('Cannot resolve a promise with itself.')
- );
- }
-
- return $promise;
- }
-
- private function call(callable $callback)
- {
- try {
- $callback(
- function ($value = null) {
- $this->resolve($value);
- },
- function ($reason = null) {
- $this->reject($reason);
- },
- function ($update = null) {
- $this->notify($update);
- }
- );
- } catch (\Throwable $e) {
- $this->reject($e);
- } catch (\Exception $e) {
- $this->reject($e);
- }
- }
-}
diff --git a/assets/php/vendor/react/promise/src/PromiseInterface.php b/assets/php/vendor/react/promise/src/PromiseInterface.php
deleted file mode 100755
index d80d114..0000000
--- a/assets/php/vendor/react/promise/src/PromiseInterface.php
+++ /dev/null
@@ -1,11 +0,0 @@
-<?php
-
-namespace React\Promise;
-
-interface PromiseInterface
-{
- /**
- * @return PromiseInterface
- */
- public function then(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null);
-}
diff --git a/assets/php/vendor/react/promise/src/PromisorInterface.php b/assets/php/vendor/react/promise/src/PromisorInterface.php
deleted file mode 100755
index 9341a4f..0000000
--- a/assets/php/vendor/react/promise/src/PromisorInterface.php
+++ /dev/null
@@ -1,11 +0,0 @@
-<?php
-
-namespace React\Promise;
-
-interface PromisorInterface
-{
- /**
- * @return PromiseInterface
- */
- public function promise();
-}
diff --git a/assets/php/vendor/react/promise/src/RejectedPromise.php b/assets/php/vendor/react/promise/src/RejectedPromise.php
deleted file mode 100755
index 479a746..0000000
--- a/assets/php/vendor/react/promise/src/RejectedPromise.php
+++ /dev/null
@@ -1,76 +0,0 @@
-<?php
-
-namespace React\Promise;
-
-class RejectedPromise implements ExtendedPromiseInterface, CancellablePromiseInterface
-{
- private $reason;
-
- public function __construct($reason = null)
- {
- if ($reason instanceof PromiseInterface) {
- throw new \InvalidArgumentException('You cannot create React\Promise\RejectedPromise with a promise. Use React\Promise\reject($promiseOrValue) instead.');
- }
-
- $this->reason = $reason;
- }
-
- public function then(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null)
- {
- if (null === $onRejected) {
- return $this;
- }
-
- try {
- return resolve($onRejected($this->reason));
- } catch (\Throwable $exception) {
- return new RejectedPromise($exception);
- } catch (\Exception $exception) {
- return new RejectedPromise($exception);
- }
- }
-
- public function done(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null)
- {
- if (null === $onRejected) {
- throw UnhandledRejectionException::resolve($this->reason);
- }
-
- $result = $onRejected($this->reason);
-
- if ($result instanceof self) {
- throw UnhandledRejectionException::resolve($result->reason);
- }
-
- if ($result instanceof ExtendedPromiseInterface) {
- $result->done();
- }
- }
-
- public function otherwise(callable $onRejected)
- {
- if (!_checkTypehint($onRejected, $this->reason)) {
- return $this;
- }
-
- return $this->then(null, $onRejected);
- }
-
- public function always(callable $onFulfilledOrRejected)
- {
- return $this->then(null, function ($reason) use ($onFulfilledOrRejected) {
- return resolve($onFulfilledOrRejected())->then(function () use ($reason) {
- return new RejectedPromise($reason);
- });
- });
- }
-
- public function progress(callable $onProgress)
- {
- return $this;
- }
-
- public function cancel()
- {
- }
-}
diff --git a/assets/php/vendor/react/promise/src/UnhandledRejectionException.php b/assets/php/vendor/react/promise/src/UnhandledRejectionException.php
deleted file mode 100755
index a44b7a1..0000000
--- a/assets/php/vendor/react/promise/src/UnhandledRejectionException.php
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-
-namespace React\Promise;
-
-class UnhandledRejectionException extends \RuntimeException
-{
- private $reason;
-
- public static function resolve($reason)
- {
- if ($reason instanceof \Exception || $reason instanceof \Throwable) {
- return $reason;
- }
-
- return new static($reason);
- }
-
- public function __construct($reason)
- {
- $this->reason = $reason;
-
- $message = sprintf('Unhandled Rejection: %s', json_encode($reason));
-
- parent::__construct($message, 0);
- }
-
- public function getReason()
- {
- return $this->reason;
- }
-}
diff --git a/assets/php/vendor/react/promise/src/functions.php b/assets/php/vendor/react/promise/src/functions.php
deleted file mode 100755
index 70c0eb7..0000000
--- a/assets/php/vendor/react/promise/src/functions.php
+++ /dev/null
@@ -1,244 +0,0 @@
-<?php
-
-namespace React\Promise;
-
-function resolve($promiseOrValue = null)
-{
- if ($promiseOrValue instanceof ExtendedPromiseInterface) {
- return $promiseOrValue;
- }
-
- if (method_exists($promiseOrValue, 'then')) {
- $canceller = null;
-
- if (method_exists($promiseOrValue, 'cancel')) {
- $canceller = [$promiseOrValue, 'cancel'];
- }
-
- return new Promise(function ($resolve, $reject, $notify) use ($promiseOrValue) {
- $promiseOrValue->then($resolve, $reject, $notify);
- }, $canceller);
- }
-
- return new FulfilledPromise($promiseOrValue);
-}
-
-function reject($promiseOrValue = null)
-{
- if ($promiseOrValue instanceof PromiseInterface) {
- return resolve($promiseOrValue)->then(function ($value) {
- return new RejectedPromise($value);
- });
- }
-
- return new RejectedPromise($promiseOrValue);
-}
-
-function all($promisesOrValues)
-{
- return map($promisesOrValues, function ($val) {
- return $val;
- });
-}
-
-function race($promisesOrValues)
-{
- $cancellationQueue = new CancellationQueue();
- $cancellationQueue->enqueue($promisesOrValues);
-
- return new Promise(function ($resolve, $reject, $notify) use ($promisesOrValues, $cancellationQueue) {
- resolve($promisesOrValues)
- ->done(function ($array) use ($cancellationQueue, $resolve, $reject, $notify) {
- if (!is_array($array) || !$array) {
- $resolve();
- return;
- }
-
- foreach ($array as $promiseOrValue) {
- $cancellationQueue->enqueue($promiseOrValue);
-
- resolve($promiseOrValue)
- ->done($resolve, $reject, $notify);
- }
- }, $reject, $notify);
- }, $cancellationQueue);
-}
-
-function any($promisesOrValues)
-{
- return some($promisesOrValues, 1)
- ->then(function ($val) {
- return array_shift($val);
- });
-}
-
-function some($promisesOrValues, $howMany)
-{
- $cancellationQueue = new CancellationQueue();
- $cancellationQueue->enqueue($promisesOrValues);
-
- return new Promise(function ($resolve, $reject, $notify) use ($promisesOrValues, $howMany, $cancellationQueue) {
- resolve($promisesOrValues)
- ->done(function ($array) use ($howMany, $cancellationQueue, $resolve, $reject, $notify) {
- if (!is_array($array) || $howMany < 1) {
- $resolve([]);
- return;
- }
-
- $len = count($array);
-
- if ($len < $howMany) {
- throw new Exception\LengthException(
- sprintf(
- 'Input array must contain at least %d item%s but contains only %s item%s.',
- $howMany,
- 1 === $howMany ? '' : 's',
- $len,
- 1 === $len ? '' : 's'
- )
- );
- }
-
- $toResolve = $howMany;
- $toReject = ($len - $toResolve) + 1;
- $values = [];
- $reasons = [];
-
- foreach ($array as $i => $promiseOrValue) {
- $fulfiller = function ($val) use ($i, &$values, &$toResolve, $toReject, $resolve) {
- if ($toResolve < 1 || $toReject < 1) {
- return;
- }
-
- $values[$i] = $val;
-
- if (0 === --$toResolve) {
- $resolve($values);
- }
- };
-
- $rejecter = function ($reason) use ($i, &$reasons, &$toReject, $toResolve, $reject) {
- if ($toResolve < 1 || $toReject < 1) {
- return;
- }
-
- $reasons[$i] = $reason;
-
- if (0 === --$toReject) {
- $reject($reasons);
- }
- };
-
- $cancellationQueue->enqueue($promiseOrValue);
-
- resolve($promiseOrValue)
- ->done($fulfiller, $rejecter, $notify);
- }
- }, $reject, $notify);
- }, $cancellationQueue);
-}
-
-function map($promisesOrValues, callable $mapFunc)
-{
- $cancellationQueue = new CancellationQueue();
- $cancellationQueue->enqueue($promisesOrValues);
-
- return new Promise(function ($resolve, $reject, $notify) use ($promisesOrValues, $mapFunc, $cancellationQueue) {
- resolve($promisesOrValues)
- ->done(function ($array) use ($mapFunc, $cancellationQueue, $resolve, $reject, $notify) {
- if (!is_array($array) || !$array) {
- $resolve([]);
- return;
- }
-
- $toResolve = count($array);
- $values = [];
-
- foreach ($array as $i => $promiseOrValue) {
- $cancellationQueue->enqueue($promiseOrValue);
- $values[$i] = null;
-
- resolve($promiseOrValue)
- ->then($mapFunc)
- ->done(
- function ($mapped) use ($i, &$values, &$toResolve, $resolve) {
- $values[$i] = $mapped;
-
- if (0 === --$toResolve) {
- $resolve($values);
- }
- },
- $reject,
- $notify
- );
- }
- }, $reject, $notify);
- }, $cancellationQueue);
-}
-
-function reduce($promisesOrValues, callable $reduceFunc, $initialValue = null)
-{
- $cancellationQueue = new CancellationQueue();
- $cancellationQueue->enqueue($promisesOrValues);
-
- return new Promise(function ($resolve, $reject, $notify) use ($promisesOrValues, $reduceFunc, $initialValue, $cancellationQueue) {
- resolve($promisesOrValues)
- ->done(function ($array) use ($reduceFunc, $initialValue, $cancellationQueue, $resolve, $reject, $notify) {
- if (!is_array($array)) {
- $array = [];
- }
-
- $total = count($array);
- $i = 0;
-
- // Wrap the supplied $reduceFunc with one that handles promises and then
- // delegates to the supplied.
- $wrappedReduceFunc = function ($current, $val) use ($reduceFunc, $cancellationQueue, $total, &$i) {
- $cancellationQueue->enqueue($val);
-
- return $current
- ->then(function ($c) use ($reduceFunc, $total, &$i, $val) {
- return resolve($val)
- ->then(function ($value) use ($reduceFunc, $total, &$i, $c) {
- return $reduceFunc($c, $value, $i++, $total);
- });
- });
- };
-
- $cancellationQueue->enqueue($initialValue);
-
- array_reduce($array, $wrappedReduceFunc, resolve($initialValue))
- ->done($resolve, $reject, $notify);
- }, $reject, $notify);
- }, $cancellationQueue);
-}
-
-// Internal functions
-function _checkTypehint(callable $callback, $object)
-{
- if (!is_object($object)) {
- return true;
- }
-
- if (is_array($callback)) {
- $callbackReflection = new \ReflectionMethod($callback[0], $callback[1]);
- } elseif (is_object($callback) && !$callback instanceof \Closure) {
- $callbackReflection = new \ReflectionMethod($callback, '__invoke');
- } else {
- $callbackReflection = new \ReflectionFunction($callback);
- }
-
- $parameters = $callbackReflection->getParameters();
-
- if (!isset($parameters[0])) {
- return true;
- }
-
- $expectedException = $parameters[0];
-
- if (!$expectedException->getClass()) {
- return true;
- }
-
- return $expectedException->getClass()->isInstance($object);
-}
diff --git a/assets/php/vendor/react/promise/src/functions_include.php b/assets/php/vendor/react/promise/src/functions_include.php
deleted file mode 100755
index c71decb..0000000
--- a/assets/php/vendor/react/promise/src/functions_include.php
+++ /dev/null
@@ -1,5 +0,0 @@
-<?php
-
-if (!function_exists('React\Promise\resolve')) {
- require __DIR__.'/functions.php';
-}