public static function shortenPath($file)
    {
        $file = \array_values(\array_filter(\explode('/', \str_replace('\\', '/', $file)), 'strlen'));

        $longest_match = 0;
        $match = '/';

        foreach (self::$app_root_dirs as $path => $alias) {
            if (empty($path)) {
                continue;
            }

            $path = \array_values(\array_filter(\explode('/', \str_replace('\\', '/', $path)), 'strlen'));

            if (\array_slice($file, 0, \count($path)) === $path && \count($path) > $longest_match) {
                $longest_match = \count($path);
                $match = $alias;
            }
        }

        if ($longest_match) {
            $file = \array_merge(array($match), \array_slice($file, $longest_match));

            return \implode('/', $file);
        }

        // fallback to find common path with Kint dir
        $kint = \array_values(\array_filter(\explode('/', \str_replace('\\', '/', KINT_DIR)), 'strlen'));

        foreach ($file as $i => $part) {
            if (!isset($kint[$i]) || $kint[$i] !== $part) {
                return ($i ? '.../' : '/').\implode('/', \array_slice($file, $i));
            }
        }

        return '/'.\implode('/', $file);
    }
public static function shortenPath($file)
    {
        $file = \array_values(\array_filter(\explode('/', \str_replace('\\', '/', $file)), 'strlen'));

        $longest_match = 0;
        $match = '/';

        foreach (self::$app_root_dirs as $path => $alias) {
            if (empty($path)) {
                continue;
            }

            $path = \array_values(\array_filter(\explode('/', \str_replace('\\', '/', $path)), 'strlen'));

            if (\array_slice($file, 0, \count($path)) === $path && \count($path) > $longest_match) {
                $longest_match = \count($path);
                $match = $alias;
            }
        }

        if ($longest_match) {
            $file = \array_merge(array($match), \array_slice($file, $longest_match));

            return \implode('/', $file);
        }

        // fallback to find common path with Kint dir
        $kint = \array_values(\array_filter(\explode('/', \str_replace('\\', '/', KINT_DIR)), 'strlen'));

        foreach ($file as $i => $part) {
            if (!isset($kint[$i]) || $kint[$i] !== $part) {
                return ($i ? '.../' : '/').\implode('/', \array_slice($file, $i));
            }
        }

        return '/'.\implode('/', $file);
    }
public static function shortenPath ( $ file ) { $ file = \ array_values ( \ array_filter ( \ explode ( '/' , \ str_replace ( '\\' , '/' , $ file ) ) , 'strlen' ) ) ; $ longest_match = 0 ; $ match = '/' ; foreach ( self :: $ app_root_dirs as $ path => $ alias ) { if ( empty ( $ path ) ) { continue ; } $ path = \ array_values ( \ array_filter ( \ explode ( '/' , \ str_replace ( '\\' , '/' , $ path ) ) , 'strlen' ) ) ; if ( \ array_slice ( $ file , 0 , \ count ( $ path ) ) === $ path && \ count ( $ path ) > $ longest_match ) { $ longest_match = \ count ( $ path ) ; $ match = $ alias ; } } if ( $ longest_match ) { $ file = \ array_merge ( array ( $ match ) , \ array_slice ( $ file , $ longest_match ) ) ; return \ implode ( '/' , $ file ) ; } // fallback to find common path with Kint dir $ kint = \ array_values ( \ array_filter ( \ explode ( '/' , \ str_replace ( '\\' , '/' , KINT_DIR ) ) , 'strlen' ) ) ; foreach ( $ file as $ i => $ part ) { if ( ! isset ( $ kint [ $ i ] ) || $ kint [ $ i ] !== $ part ) { return ( $ i ? '.../' : '/' ) . \ implode ( '/' , \ array_slice ( $ file , $ i ) ) ; } } return '/' . \ implode ( '/' , $ file ) ; }
generic path display callback, can be configured in app_root_dirs; purpose is
to show relevant path info and hide as much of the path as possible.

@param string $file

@return string
generic path display callback can be configured in app_root_dirs ; purpose is to show relevant path info and hide as much of the path as possible .