/**
  * Parse Widget
  * @param string $html Html to parse
  * @return mixed
  */
 protected function parseWidget($html)
 {
     $list = array();
     preg_match_all("#\\<cms_widget id=\"(.*)\">(.*)</cms_widget>#msU", $html, $list, PREG_SET_ORDER);
     $find = [];
     $replace = [];
     foreach ($list as $function) {
         // cache key
         $cacheKey = 'cms_widget_id:' . $function[1];
         // get model from cache
         if (($widgetModel = Yii::$app->commonCache->get($cacheKey)) === false) {
             $widgetModel = CmsWidget::find()->where(['id' => $function[1]])->asArray()->one();
             Yii::$app->commonCache->set($cacheKey, $widgetModel, CmsWidgetService::$cacheDuration, new TagDependency(['tags' => [CmsWidgetService::getCacheTag(), CmsWidgetService::getCacheTag($function[1])]]));
         }
         if ($widgetModel !== null) {
             $arg = json_decode($widgetModel['arg'], true);
             if ($arg === null) {
                 $arg = [];
             }
             $widget = $widgetModel['path'];
             $find[] = '<cms_widget id="' . $function[1] . '">' . $function[2] . '</cms_widget>';
             $replace[] = $widget::widget($arg);
         }
     }
     return str_replace($find, $replace, $html);
 }