protected static function regenSwagger(\SwaggerValidator\Common\Context $context)
    {
        $fileObj = \SwaggerValidator\Common\CollectionFile::getInstance()->get($context, self::$swaggerFile);

        if (!is_object($fileObj) && ($fileObj instanceof \SwaggerValidator\Common\ReferenceFile)) {
            $context->throwException('Cannot load the given file "' . self::$swaggerFile . '"', __METHOD__, __LINE__);
        }

        $swagger = \SwaggerValidator\Common\Factory::getInstance()->get(\SwaggerValidator\Common\CollectionType::Swagger);

        if (!is_object($swagger) && ($swagger instanceof \SwaggerValidator\Object\Swagger)) {
            $context->throwException('Cannot create the swagger object !!', __METHOD__, __LINE__);
        }

        $swagger->jsonUnSerialize($context, $fileObj->fileObj);

        if (self::$cacheEnable !== true) {
            return $swagger;
        }

        return self::storeCache($swagger, $context);
    }