public static function fromReturn($callback, array $arguments = array(), $noneValue = null)
    {
        return new LazyOption(function() use ($callback, $arguments, $noneValue) {
            $return = call_user_func_array($callback, $arguments);

            if ($return === $noneValue) {
                return None::create();
            }

            return new Some($return);
        });
    }
public static function fromReturn($callback, array $arguments = array(), $noneValue = null)
    {
        return new LazyOption(function() use ($callback, $arguments, $noneValue) {
            $return = call_user_func_array($callback, $arguments);

            if ($return === $noneValue) {
                return None::create();
            }

            return new Some($return);
        });
    }
public static function fromReturn ( $ callback , array $ arguments = array ( ) , $ noneValue = null ) { return new LazyOption ( function ( ) use ( $ callback , $ arguments , $ noneValue ) { $ return = call_user_func_array ( $ callback , $ arguments ) ; if ( $ return === $ noneValue ) { return None :: create ( ) ; } return new Some ( $ return ) ; } ) ; }
Creates a lazy-option with the given callback.

This is also a helper constructor for lazy-consuming existing APIs where
the return value is not yet an option. By default, we treat ``null`` as
None case, and everything else as Some.

@param callable $callback The callback to evaluate.
@param array $arguments
@param mixed $noneValue The value which should be considered "None"; null
by default.

@return Option
Creates a lazy - option with the given callback .