1
0
mirror of https://github.com/danog/amp.git synced 2025-01-22 13:21:16 +01:00

Implement Observable in Success and Failure

This commit is contained in:
Aaron Piotrowski 2016-08-22 16:21:47 -05:00
parent ef143534e3
commit ddefcf21f9
2 changed files with 15 additions and 5 deletions

View File

@ -2,12 +2,12 @@
namespace Amp;
use Interop\Async\{ Awaitable, Loop };
use Interop\Async\Loop;
/**
* Creates a failed awaitable using the given exception.
* Creates a failed observable using the given exception.
*/
final class Failure implements Awaitable {
final class Failure implements Observable {
/** @var \Throwable $exception */
private $exception;
@ -30,4 +30,9 @@ final class Failure implements Awaitable {
});
}
}
/**
* {@inheritdoc}
*/
public function subscribe(callable $onNext) {}
}

View File

@ -5,10 +5,10 @@ namespace Amp;
use Interop\Async\{ Awaitable, Loop };
/**
* Creates a successful awaitable using the given value (which can be any value except another object implementing
* Creates a successful observable using the given value (which can be any value except another object implementing
* \Interop\Async\Awaitable).
*/
final class Success implements Awaitable {
final class Success implements Observable {
/** @var mixed */
private $value;
@ -38,4 +38,9 @@ final class Success implements Awaitable {
});
}
}
/**
* {@inheritdoc}
*/
public function subscribe(callable $onNext) {}
}