Last active
June 11, 2019 22:40
-
-
Save bosunski/029b7b280373bedd3495dd1e0eab9d73 to your computer and use it in GitHub Desktop.
Describes a Promise
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Promise { | |
private $resolvedStack = []; | |
private $catches = []; | |
public function then(callable $resolved): Promise | |
{ | |
array_push($this->resolvedStack, $resolved); | |
} | |
public function catch(callable $rejected): void | |
{ | |
array_push($this->catches, $rejected); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment