Guest User

Untitled

a guest
Oct 20th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. <?php
  2.  
  3. class CollectionMonad extends Monad {
  4. public function __construct(array $value) {
  5. $this->value = $value;
  6. }
  7. public function bind($callback) {
  8. $newValues = array();
  9. foreach ($this->value as $value) {
  10. $newValues[] = $this->callCallback($callback, $value);
  11. }
  12. return new CollectionMonad($newValues);
  13. }
  14. }
Add Comment
Please, Sign In to add comment