protected function defaultCacheDir()
    {
        $cacheDir = getenv('COMPOSER_CACHE_DIR');
        if ($cacheDir) {
            return $cacheDir;
        }

        $home = getenv('COMPOSER_HOME');
        $isWindows = defined('PHP_WINDOWS_VERSION_MAJOR');

        if (!$home) {
            if ($isWindows) {
                if ($envAppData = getenv('APPDATA')) {
                    $home = strtr($envAppData, '\\', '/') . '/Composer';
                }
            } elseif ($envHome = getenv('HOME')) {
                $home = rtrim($envHome, '/') . '/.composer';
            }
        }

        if ($home && !$cacheDir) {
            if ($isWindows) {
                if ($cacheDir = getenv('LOCALAPPDATA')) {
                    $cacheDir .= '/Composer';
                } else {
                    $cacheDir = $home . '/cache';
                }

                $cacheDir = strtr($cacheDir, '\\', '/');
            } else {
                $cacheDir = $home . '/cache';
            }
        }

        if (!$cacheDir) {
            return null;
        }

        return $cacheDir;
    }
protected function defaultCacheDir()
    {
        $cacheDir = getenv('COMPOSER_CACHE_DIR');
        if ($cacheDir) {
            return $cacheDir;
        }

        $home = getenv('COMPOSER_HOME');
        $isWindows = defined('PHP_WINDOWS_VERSION_MAJOR');

        if (!$home) {
            if ($isWindows) {
                if ($envAppData = getenv('APPDATA')) {
                    $home = strtr($envAppData, '\\', '/') . '/Composer';
                }
            } elseif ($envHome = getenv('HOME')) {
                $home = rtrim($envHome, '/') . '/.composer';
            }
        }

        if ($home && !$cacheDir) {
            if ($isWindows) {
                if ($cacheDir = getenv('LOCALAPPDATA')) {
                    $cacheDir .= '/Composer';
                } else {
                    $cacheDir = $home . '/cache';
                }

                $cacheDir = strtr($cacheDir, '\\', '/');
            } else {
                $cacheDir = $home . '/cache';
            }
        }

        if (!$cacheDir) {
            return null;
        }

        return $cacheDir;
    }
protected function defaultCacheDir ( ) { $ cacheDir = getenv ( 'COMPOSER_CACHE_DIR' ) ; if ( $ cacheDir ) { return $ cacheDir ; } $ home = getenv ( 'COMPOSER_HOME' ) ; $ isWindows = defined ( 'PHP_WINDOWS_VERSION_MAJOR' ) ; if ( ! $ home ) { if ( $ isWindows ) { if ( $ envAppData = getenv ( 'APPDATA' ) ) { $ home = strtr ( $ envAppData , '\\' , '/' ) . '/Composer' ; } } elseif ( $ envHome = getenv ( 'HOME' ) ) { $ home = rtrim ( $ envHome , '/' ) . '/.composer' ; } } if ( $ home && ! $ cacheDir ) { if ( $ isWindows ) { if ( $ cacheDir = getenv ( 'LOCALAPPDATA' ) ) { $ cacheDir .= '/Composer' ; } else { $ cacheDir = $ home . '/cache' ; } $ cacheDir = strtr ( $ cacheDir , '\\' , '/' ) ; } else { $ cacheDir = $ home . '/cache' ; } } if ( ! $ cacheDir ) { return null ; } return $ cacheDir ; }
Get the default cache directory for the current environment.

@return string|null The default cache directory, or null if the cache directory could not be determined.
Get the default cache directory for the current environment .