Exemplo n.º 1
0
 /**
  * Converts Success to a Some, Converts Failure to None
  * @return Maybe
  */
 public function toMaybe()
 {
     return $this->isSuccess() ? Some($this->get()) : None();
 }
Exemplo n.º 2
0
 /**
  * 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();
 }
Exemplo n.º 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();
 }
Exemplo n.º 4
0
 /**
  * @param callable $hof
  * @return Some|None
  */
 public function find(callable $hof)
 {
     return call_user_func($hof, $this->x, 0, $this) ? $this : None();
 }