diff --git a/bin/app.php b/bin/app.php deleted file mode 100755 index 82b35ff..0000000 --- a/bin/app.php +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/php - $promise) { - if ($promise->isResolved()) { - unset($promises[$index]); - - if (!$promise->isEmpty() && !$promise->isError()) - print($promise->getValue() . PHP_EOL); - } - } -} - - -/* - * Example of asynchronous processing in PHP - */ - -$process = function ($i) { - $delayMicroseconds = (5 - $i) * 1000000; - usleep($delayMicroseconds); - - return sprintf( - 'PID %-5d slept for %.1f seconds', - getmypid(), $delayMicroseconds / 1000000 - ); -}; - -$promises = []; -foreach (range(0, 5) as $i) - $promises[] = async($process, $i); - -while (count($promises) > 0) - awaitPromises($promises); diff --git a/bin/example/arrays.php b/bin/example/arrays.php deleted file mode 100755 index efb393a..0000000 --- a/bin/example/arrays.php +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/php -resolve()->getValue(); -var_dump($array); diff --git a/bin/example/objects.php b/bin/example/objects.php deleted file mode 100755 index 0833d0d..0000000 --- a/bin/example/objects.php +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/php -data = [1, 2, 3]; - } - - public function getData() - { - return $this->data; - } -} - -// Create the process -$promise = async(function () { - sleep(2); - - return new Sample(); -}); - -// We can do some other stuff here while the process is running - -// Resolve the promise -/** @var Sample $sample */ -$sample = $promise->resolve()->getValue(); -var_dump($sample->getData()); diff --git a/bin/example/sample.php b/bin/example/sample.php deleted file mode 100755 index ab35bf8..0000000 --- a/bin/example/sample.php +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/php -