SensioLabs\Insight\Cli\Configuration::getStoragePath PHP Method

getStoragePath() private method

private getStoragePath ( )
    private function getStoragePath()
    {
        $storagePath = getenv('INSIGHT_HOME');
        if (!$storagePath) {
            if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
                if (!getenv('APPDATA')) {
                    throw new \RuntimeException('The APPDATA or INSIGHT_HOME environment variable must be set for insight to run correctly');
                }
                $storagePath = strtr(getenv('APPDATA'), '\\', '/') . '/Sensiolabs';
            } else {
                if (!getenv('HOME')) {
                    throw new \RuntimeException('The HOME or INSIGHT_HOME environment variable must be set for insight to run correctly');
                }
                $storagePath = rtrim(getenv('HOME'), '/') . '/.sensiolabs';
            }
        }
        if (!is_dir($storagePath) && !@mkdir($storagePath, 0777, true)) {
            throw new \RuntimeException(sprintf('The directory "%s" does not exist and could not be created.', $storagePath));
        }
        if (!is_writable($storagePath)) {
            throw new \RuntimeException(sprintf('The directory "%s" is not writable.', $storagePath));
        }
        return $storagePath . '/insight.json';
    }