class ReturnPromise in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/phpspec/prophecy/src/Prophecy/Promise/ReturnPromise.php \Prophecy\Promise\ReturnPromise
Return promise.
@author Konstantin Kudryashov <ever.zet@gmail.com>
Hierarchy
- class \Prophecy\Promise\ReturnPromise implements PromiseInterface
Expanded class hierarchy of ReturnPromise
File
- vendor/
phpspec/ prophecy/ src/ Prophecy/ Promise/ ReturnPromise.php, line 22
Namespace
Prophecy\PromiseView source
class ReturnPromise implements PromiseInterface {
private $returnValues = array();
/**
* Initializes promise.
*
* @param array $returnValues Array of values
*/
public function __construct(array $returnValues) {
$this->returnValues = $returnValues;
}
/**
* Returns saved values one by one until last one, then continuously returns last value.
*
* @param array $args
* @param ObjectProphecy $object
* @param MethodProphecy $method
*
* @return mixed
*/
public function execute(array $args, ObjectProphecy $object, MethodProphecy $method) {
$value = array_shift($this->returnValues);
if (!count($this->returnValues)) {
$this->returnValues[] = $value;
}
return $value;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ReturnPromise:: |
private | property | ||
ReturnPromise:: |
public | function |
Returns saved values one by one until last one, then continuously returns last value. Overrides PromiseInterface:: |
|
ReturnPromise:: |
public | function | Initializes promise. |