mirror of
https://github.com/danog/amp.git
synced 2024-11-27 12:35:02 +01:00
29 lines
496 B
PHP
29 lines
496 B
PHP
<?php
|
|
|
|
namespace Amp;
|
|
|
|
/**
|
|
* Represents a failed computation resolution
|
|
*/
|
|
class Failure implements Promise {
|
|
private $error;
|
|
|
|
public function __construct(\Exception $error) {
|
|
$this->error = $error;
|
|
}
|
|
|
|
/**
|
|
* {@inheritDoc}
|
|
*/
|
|
public function when(callable $func, $data = null) {
|
|
$func($this->error, $result = null, $data);
|
|
}
|
|
|
|
/**
|
|
* {@inheritDoc}
|
|
*/
|
|
public function watch(callable $func, $data = null) {
|
|
return;
|
|
}
|
|
}
|