public function actionJson()
    {
        /** @var \yii\web\Response */
        $response = \Yii::$app->getResponse();
        
        if (!is_readable($this->module->swaggerPath)) {
            throw new NotFoundHttpException();
        }
        
        // Read source json file
        $json = file_get_contents($this->module->swaggerPath);
    
        // Do replacements
        if (is_array($this->module->swaggerReplace)) {
            foreach ($this->module->swaggerReplace as $find => $replace) {
                if (is_callable($replace)) {
                    $replaceText = call_user_func($replace);
                } else {
                    $replaceText = (string) $replace;
                }
                $json = mb_ereg_replace((string)$find, $replaceText, $json);
            }
        }
        
        // Override default response formatters
        // To avvoid json format modification
        $response->format = Response::FORMAT_RAW;
        $response->getHeaders()->set('Content-Type', 'application/json; charset=UTF-8');
        
        // Trigger events
        $event = new BeforeJsonEvent;
        $event->responseText = $json;
        $this->module->trigger(self::EVENT_BEFORE_JSON, $event);
        
        return $event->responseText;
    }
public function actionJson()
    {
        /** @var \yii\web\Response */
        $response = \Yii::$app->getResponse();
        
        if (!is_readable($this->module->swaggerPath)) {
            throw new NotFoundHttpException();
        }
        
        // Read source json file
        $json = file_get_contents($this->module->swaggerPath);
    
        // Do replacements
        if (is_array($this->module->swaggerReplace)) {
            foreach ($this->module->swaggerReplace as $find => $replace) {
                if (is_callable($replace)) {
                    $replaceText = call_user_func($replace);
                } else {
                    $replaceText = (string) $replace;
                }
                $json = mb_ereg_replace((string)$find, $replaceText, $json);
            }
        }
        
        // Override default response formatters
        // To avvoid json format modification
        $response->format = Response::FORMAT_RAW;
        $response->getHeaders()->set('Content-Type', 'application/json; charset=UTF-8');
        
        // Trigger events
        $event = new BeforeJsonEvent;
        $event->responseText = $json;
        $this->module->trigger(self::EVENT_BEFORE_JSON, $event);
        
        return $event->responseText;
    }
public function actionJson ( ) { /** @var \yii\web\Response */ $ response = \ Yii :: $ app -> getResponse ( ) ; if ( ! is_readable ( $ this -> module -> swaggerPath ) ) { throw new NotFoundHttpException ( ) ; } // Read source json file $ json = file_get_contents ( $ this -> module -> swaggerPath ) ; // Do replacements if ( is_array ( $ this -> module -> swaggerReplace ) ) { foreach ( $ this -> module -> swaggerReplace as $ find => $ replace ) { if ( is_callable ( $ replace ) ) { $ replaceText = call_user_func ( $ replace ) ; } else { $ replaceText = ( string ) $ replace ; } $ json = mb_ereg_replace ( ( string ) $ find , $ replaceText , $ json ) ; } } // Override default response formatters // To avvoid json format modification $ response -> format = Response :: FORMAT_RAW ; $ response -> getHeaders ( ) -> set ( 'Content-Type' , 'application/json; charset=UTF-8' ) ; // Trigger events $ event = new BeforeJsonEvent ; $ event -> responseText = $ json ; $ this -> module -> trigger ( self :: EVENT_BEFORE_JSON , $ event ) ; return $ event -> responseText ; }
Parse swagger.json file, do replacements and return json

@return string
@throws NotFoundHttpException
Parse swagger . json file do replacements and return json