/**
  * @return array
  */
 protected function getData()
 {
     /**@var  $currentLanguage Language */
     list($route, $params) = Yii::$app->getUrlManager()->parseRequest(Yii::$app->getRequest());
     $route = Yii::$app->controller->getRoute() != '' ? Yii::$app->controller->route : $route;
     $params = ArrayHelper::merge($_GET, $params);
     $data = [0];
     foreach ($this->languages as $language) {
         if ($language['code'] === Yii::$app->language) {
             $this->current = ArrayHelper::merge(['url' => $this->urlManager->createUrl(ArrayHelper::merge($params, [array_key_exists('route', $params) ? $params['route'] : $route, 'language' => $language['code']]))], $language);
             $data[0] = $this->current;
         } else {
             $data[] = ArrayHelper::merge(['url' => $this->urlManager->createUrl(ArrayHelper::merge($params, [array_key_exists('route', $params) ? $params['route'] : $route, 'language' => $language['code']]))], $language);
         }
     }
     if (!array_key_exists(0, $data) || $data[0] === 0) {
         $currentLanguage = Language::findOne(['code' => Yii::$app->language]);
         if ($currentLanguage) {
             $data[0] = ['url' => $this->urlManager->createUrl(ArrayHelper::merge($params, [array_key_exists('route', $params) ? $params['route'] : $route, 'language' => $currentLanguage->code])), 'code' => $currentLanguage->code, 'name' => $currentLanguage->name, 'country' => $currentLanguage->country];
         }
     }
     if (count($data) > count(Language::getLanguages())) {
         return array_unique($data);
     } else {
         return $data;
     }
 }
 /**
  * Finds the Language model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  *
  * @param integer $id
  *
  * @return Language the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  * @since 1.0.0
  */
 protected function findModel($id)
 {
     if (($model = Language::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }