Closed anaelChardan closed 5 years ago
Could be nice to have a function like this
/** * Handle a result * * @param $key * @param callable $onSuccess * @param callable|null $onError * * @return mixed */ public function getOrElse($key, callable $onSuccess, callable $onError = null) { if ($this->containsKey($key)) { return $onSuccess($key, $this->get($key)); } return $onError($key); }
I think I am good for that one, @nozavroni might find a better name :)
Could be nice to have a function like this