public static function loadClosest($context = '')
    {
        $length = strlen($context);
        for ($i = $length; $i > 0;) {
            try {
                /* Trying to load the new context */
                static::load($context);
                return $context;
            } catch (LoaderException $e) {
                /* Replace last two non zero digits by zeroes */
                do {
                    $i -= 2;
                    $part = substr($context, $i, 2);
                    /* No more numeric parts to strip */
                    if (! is_numeric($part)) {
                        break 2;
                    }
                } while (intval($part) === 0 && $i > 0);
                $context = substr($context, 0, $i) . '00' . substr($context, $i + 2);
            }
        }
        /* Fallback to loading at least matching engine */
        if (strncmp($context, 'MariaDb', 7) === 0) {
            return static::loadClosest('MariaDb100300');
        } elseif (strncmp($context, 'MySql', 5) === 0) {
            return static::loadClosest('MySql50700');
        }
        return null;
    }
public static function loadClosest($context = '')
    {
        $length = strlen($context);
        for ($i = $length; $i > 0;) {
            try {
                /* Trying to load the new context */
                static::load($context);
                return $context;
            } catch (LoaderException $e) {
                /* Replace last two non zero digits by zeroes */
                do {
                    $i -= 2;
                    $part = substr($context, $i, 2);
                    /* No more numeric parts to strip */
                    if (! is_numeric($part)) {
                        break 2;
                    }
                } while (intval($part) === 0 && $i > 0);
                $context = substr($context, 0, $i) . '00' . substr($context, $i + 2);
            }
        }
        /* Fallback to loading at least matching engine */
        if (strncmp($context, 'MariaDb', 7) === 0) {
            return static::loadClosest('MariaDb100300');
        } elseif (strncmp($context, 'MySql', 5) === 0) {
            return static::loadClosest('MySql50700');
        }
        return null;
    }
public static function loadClosest ( $ context = '' ) { $ length = strlen ( $ context ) ; for ( $ i = $ length ; $ i > 0 ; ) { try { /* Trying to load the new context */ static :: load ( $ context ) ; return $ context ; } catch ( LoaderException $ e ) { /* Replace last two non zero digits by zeroes */ do { $ i -= 2 ; $ part = substr ( $ context , $ i , 2 ) ; /* No more numeric parts to strip */ if ( ! is_numeric ( $ part ) ) { break 2 ; } } while ( intval ( $ part ) === 0 && $ i > 0 ) ; $ context = substr ( $ context , 0 , $ i ) . '00' . substr ( $ context , $ i + 2 ) ; } } /* Fallback to loading at least matching engine */ if ( strncmp ( $ context , 'MariaDb' , 7 ) === 0 ) { return static :: loadClosest ( 'MariaDb100300' ) ; } elseif ( strncmp ( $ context , 'MySql' , 5 ) === 0 ) { return static :: loadClosest ( 'MySql50700' ) ; } return null ; }
Loads the context with the closest version to the one specified.

The closest context is found by replacing last digits with zero until one
is loaded successfully.

@see Context::load()

@param string $context name of the context or full class name that
defines the context

@return string The loaded context. `null` if no context was loaded.
Loads the context with the closest version to the one specified .