/** * Converts Success to a Some, Converts Failure to None * @return Maybe */ public function toMaybe() { return $this->isSuccess() ? Some($this->get()) : None(); }
/** * Search the container * @param callable $hof ($value, $key, $container):boolean * @return \PHPixme\Some|\PHPixme\None */ public function find(callable $hof) { return call_user_func($hof, $this->contents, 0, $this) ? Some($this->contents) : None(); }
/** * Search the container * @param callable $hof ($value, $key, $container):boolean * @return Maybe */ public function find(callable $hof) { return call_user_func($hof, $this->value, 0, $this) ? Some($this->value) : None(); }
/** * @param callable $hof * @return Some|None */ public function find(callable $hof) { return call_user_func($hof, $this->x, 0, $this) ? $this : None(); }