public static function checkLocalStorage($dir, $data)
    {
        $fn = $dir . '/composer.json';
        $created = true;
        if (true === FileHelper::createDirectory($dir)) {
            if (false === file_exists($fn)) {
                $created = file_put_contents(
                    $fn,
                    Json::encode($data, JSON_FORCE_OBJECT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT)
                );
            }
            if (false === $created) {
                Yii::$app->session->setFlash(
                    'error',
                    Yii::t('extensions-manager', 'Unable to create local composer.json file')
                );
            }
        } else {
            Yii::$app->session->setFlash(
                'error',
                Yii::t('extensions-manager', 'Unable to create folder to store local composer.json file')
            );
            $created = false;
        }
        return $created;
    }