/** * The fromMaybe function takes a default value and and Maybe value. * If the Maybe is Nothing, it returns the default values; otherwise, * it returns the value contained in the Maybe. * * @param mixed $default * @param Maybe $maybe * * @return mixed */ public static function fromMaybe($default, Maybe $maybe) { if ($maybe->isNothing()) { return $default; } return $maybe->value; }