public static function once($function)
    {
        $called = false;
        $value = null;

        return function () use ($function, &$called, &$value) {
            if (!$called) {
                $args = func_get_args();
                $value = call_user_func_array($function, $args);
                $called = true;
            }

            return $value;
        };
    }