public static function alias($file, array $paths = array()) {
        if (empty($file)) {
            return '[internal]';
        }

        $file = static::ds($file);

        // Inherit titon constants
        foreach (array('vendor', 'app', 'modules', 'resources', 'temp', 'views', 'web') as $type) {
            $constant = strtoupper($type) . '_DIR';

            if (empty($paths[$type]) && defined($constant)) {
                $paths[$type] = constant($constant);
            }
        }

        // Define source locations
        foreach (array('src', 'lib') as $source) {
            if (empty($paths[$source]) && strpos($file, $source) !== false) {
                $parts = explode($source, $file);
                $paths[$source] = $parts[0] . $source;
            }
        }

        foreach ($paths as $key => $path) {
            $path = trim(static::ds($path), static::SEPARATOR) . static::SEPARATOR;

            if (mb_strpos($file, $path) !== false) {
                $file = trim(str_replace($path, '[' . $key . ']', $file), static::SEPARATOR);
                break;
            }
        }

        return $file;
    }
public static function alias($file, array $paths = array()) {
        if (empty($file)) {
            return '[internal]';
        }

        $file = static::ds($file);

        // Inherit titon constants
        foreach (array('vendor', 'app', 'modules', 'resources', 'temp', 'views', 'web') as $type) {
            $constant = strtoupper($type) . '_DIR';

            if (empty($paths[$type]) && defined($constant)) {
                $paths[$type] = constant($constant);
            }
        }

        // Define source locations
        foreach (array('src', 'lib') as $source) {
            if (empty($paths[$source]) && strpos($file, $source) !== false) {
                $parts = explode($source, $file);
                $paths[$source] = $parts[0] . $source;
            }
        }

        foreach ($paths as $key => $path) {
            $path = trim(static::ds($path), static::SEPARATOR) . static::SEPARATOR;

            if (mb_strpos($file, $path) !== false) {
                $file = trim(str_replace($path, '[' . $key . ']', $file), static::SEPARATOR);
                break;
            }
        }

        return $file;
    }
public static function alias ( $ file , array $ paths = array ( ) ) { if ( empty ( $ file ) ) { return '[internal]' ; } $ file = static :: ds ( $ file ) ; // Inherit titon constants foreach ( array ( 'vendor' , 'app' , 'modules' , 'resources' , 'temp' , 'views' , 'web' ) as $ type ) { $ constant = strtoupper ( $ type ) . '_DIR' ; if ( empty ( $ paths [ $ type ] ) && defined ( $ constant ) ) { $ paths [ $ type ] = constant ( $ constant ) ; } } // Define source locations foreach ( array ( 'src' , 'lib' ) as $ source ) { if ( empty ( $ paths [ $ source ] ) && strpos ( $ file , $ source ) !== false ) { $ parts = explode ( $ source , $ file ) ; $ paths [ $ source ] = $ parts [ 0 ] . $ source ; } } foreach ( $ paths as $ key => $ path ) { $ path = trim ( static :: ds ( $ path ) , static :: SEPARATOR ) . static :: SEPARATOR ; if ( mb_strpos ( $ file , $ path ) !== false ) { $ file = trim ( str_replace ( $ path , '[' . $ key . ']' , $ file ) , static :: SEPARATOR ) ; break ; } } return $ file ; }
Parse the file path to remove absolute paths and replace with a constant name.

@param string $file
@param array $paths
@return string
Parse the file path to remove absolute paths and replace with a constant name .