Skip to content

Instantly share code, notes, and snippets.

@bosunski
Last active June 11, 2019 22:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bosunski/029b7b280373bedd3495dd1e0eab9d73 to your computer and use it in GitHub Desktop.
Save bosunski/029b7b280373bedd3495dd1e0eab9d73 to your computer and use it in GitHub Desktop.
Describes a Promise
<?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