private static function explodeKeys($keyPath)
    {
        $keys = explode('.', $keyPath);
        if (strpos($keyPath, '\\.') === false) {
            return array_filter($keys, function($elem) { return $elem !== ''; });
        }

        //
        // This is the slow path, where the keys contain escaped dots:
        //
        $joinNext = false;
        $result = array();
        $next = 0;
        foreach ($keys as $index => $key) {
            $len = strlen($key);
            if ($len === 0) {
                continue;
            }
            $endsWithBackslash = $key[$len - 1] === '\\';
            if ($joinNext) {
                $result[$next - 1] = sprintf("%s.%s", substr($result[$next - 1], 0, -1), $key);
                $joinNext = $endsWithBackslash;
                continue;
            }
            elseif ($endsWithBackslash) {
                $joinNext = true;
            }
            $result[$next] = $key;
            $next += 1;
        }

        return $result;
    }
private static function explodeKeys($keyPath)
    {
        $keys = explode('.', $keyPath);
        if (strpos($keyPath, '\\.') === false) {
            return array_filter($keys, function($elem) { return $elem !== ''; });
        }

        //
        // This is the slow path, where the keys contain escaped dots:
        //
        $joinNext = false;
        $result = array();
        $next = 0;
        foreach ($keys as $index => $key) {
            $len = strlen($key);
            if ($len === 0) {
                continue;
            }
            $endsWithBackslash = $key[$len - 1] === '\\';
            if ($joinNext) {
                $result[$next - 1] = sprintf("%s.%s", substr($result[$next - 1], 0, -1), $key);
                $joinNext = $endsWithBackslash;
                continue;
            }
            elseif ($endsWithBackslash) {
                $joinNext = true;
            }
            $result[$next] = $key;
            $next += 1;
        }

        return $result;
    }
private static function explodeKeys ( $ keyPath ) { $ keys = explode ( '.' , $ keyPath ) ; if ( strpos ( $ keyPath , '\\.' ) === false ) { return array_filter ( $ keys , function ( $ elem ) { return $ elem !== '' ; } ) ; } // // This is the slow path, where the keys contain escaped dots: // $ joinNext = false ; $ result = array ( ) ; $ next = 0 ; foreach ( $ keys as $ index => $ key ) { $ len = strlen ( $ key ) ; if ( $ len === 0 ) { continue ; } $ endsWithBackslash = $ key [ $ len - 1 ] === '\\' ; if ( $ joinNext ) { $ result [ $ next - 1 ] = sprintf ( "%s.%s" , substr ( $ result [ $ next - 1 ] , 0 , - 1 ) , $ key ) ; $ joinNext = $ endsWithBackslash ; continue ; } elseif ( $ endsWithBackslash ) { $ joinNext = true ; } $ result [ $ next ] = $ key ; $ next += 1 ; } return $ result ; }
Explode the keys.

If a key contains backslashes before any dots, then don't explode based on that dot.

@param string $keyPath
@return array
@throws BadKeyPath
Explode the keys .