示例#1
0
 /**
  * Converts Success to a Some, Converts Failure to None
  * @return Maybe
  */
 public function toMaybe()
 {
     return $this->isSuccess() ? Some($this->get()) : None();
 }
示例#2
0
文件: Pot.php 项目: rkgladson/PHPixme
 /**
  * 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();
 }
示例#3
0
 /**
  * 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();
 }
示例#4
0
 /**
  * @param callable $hof
  * @return Some|None
  */
 public function find(callable $hof)
 {
     return call_user_func($hof, $this->x, 0, $this) ? $this : None();
 }