Translate menulinks params to a single dimensional array and returns only current language params

@param  string $params
@return array
550687
public static function decodeParams($params)
    {
        if(!$params) {
            return [];
        }
        $paramsArrayList = json_decode(json_encode($params), true);
        $decodedParams = [];
        foreach($paramsArrayList as $paramKey=>$paramValue){
            if(is_array($paramValue)) {
                foreach($paramValue as $languageSlug=>$langParamValue){
                    if($languageSlug == App::getLocale()) {
                        $decodedParams[$paramKey] = $langParamValue;
                        break;
                    }else{
                        $decodedParams[$paramKey] = "";
                    }
                }
            }else{
                $decodedParams[$paramKey] = $paramValue;
            }
        }
        return $decodedParams;
    }
663090
public function unserializeParams($params) {
		$parts = explode($this->options['param-delimiter'], $params);
		$params = [];
		foreach ($parts as $part) {
			$kv = explode('=', $part);
			if ($kv[0] != '') {
				$value = count($kv) > 1
					? $kv[1] == $this->options['param-true'] ? true
					: ($kv[1] == $this->options['param-false'] ? false : $kv[1]) : true;
				$params = $this->setParam($params, $kv[0], $value);
			}
		}
		
		return $params;
	}
4804
public function findByLocale(array $params = [])
    {
        return (empty($params)) ? $this->fetchAll() : $this->makeModel()->whereIn('code', array_values($params))->get();
    }
897493
private static function transferParams($params): array
    {
        $newParams = [];
        foreach ($params as $key => $value) {
            list($nkey, $nvalue) = EntityHelper::transferParameter($key, $value, null);
            $newParams[$nkey] = $nvalue;
        }

        return $newParams;
    }
955385
protected static function formatParams($params)
    {
        $reslt = '';
        //
        for ($i = 0; $i < count($params); $i++) {
            $reslt .= '$'.$params[$i];
            if ($i < count($params) - 1) {
                $reslt .= ',';
            }
        }

        return $reslt;
    }
968731
public function getHrefWithDoAppend(array $params): string
    {
        $href = [];
        $href[] = static::makeParam('p', $this->p);
        $href[] = $this->parseParameter('do', $this->do == '_default' ? '' : $this->do, $params);

        foreach ($params as $key => $value) {
            $href[] = static::makeParam($key, $value);
        }

        return '?' . implode('&', $href);
    }
979255
public static function encodeParameters($params)
    {
        $flattenedParams = self::flattenParams($params);
        $pieces = [];
        foreach ($flattenedParams as $param) {
            list($k, $v) = $param;
            array_push($pieces, self::urlEncode($k) . '=' . self::urlEncode($v));
        }
        return implode('&', $pieces);
    }
767492
public function getAlternateLinks($urls)
    {
        // determine default and current values
        $webspaceKey = $this->requestAnalyzer->getWebspace()->getKey();
        $currentPortal = $this->requestAnalyzer->getPortal();

        $defaultLocale = null;
        if (null !== $currentPortal && null !== ($defaultLocale = $currentPortal->getXDefaultLocalization())) {
            $defaultLocale = $defaultLocale->getLocale();
        }

        $result = [];
        foreach ($urls as $locale => $url) {
            // url = '/' means that there is no translation for this page
            // the only exception is the homepage where the requested resource-locator is '/'
            if ('/' !== $url || '/' === $this->requestAnalyzer->getResourceLocator()) {
                if ($locale === $defaultLocale) {
                    $result[] = $this->getAlternate($url, $webspaceKey, $locale, true);
                }
                $result[] = $this->getAlternate($url, $webspaceKey, $locale);
            }
        }

        return implode(PHP_EOL, $result);
    }
239960
public function getUrls(array $locales = [])
    {
        if (!is_null($this->urls)) {
            return $this->urls;
        }

        $locales = $locales ?: $this->locales;
        $this->urls = [];

        // By resource
        if ($this->resource) {
            $this->resourceHelper->getEntityManager()->refresh($this->resource);

            foreach ($locales as $locale) {
                $this->urls[$locale] = $this->resourceHelper->generatePublicUrl($this->resource, false, $locale);
            }
        } // By route and parameters
        elseif ($request = $this->requestStack->getMasterRequest()) {
            $route = $request->attributes->get('_route');
            $parameters = $request->attributes->get('_route_params');

            foreach ($locales as $locale) {
                $params = array_replace($parameters, ['_locale' => $locale]);
                $this->urls[$locale] = $this->urlGenerator->generate($route, $params,
                    UrlGeneratorInterface::ABSOLUTE_PATH);
            }
        }

        return $this->urls;
    }
942943
public function menuLinkParameters()
    {
        $previousAutoTranslate = $this->getAutoTranslate();
        $this->setAutoTranslate(false);

        $data = [
            'postID'        => $this->postID,
            'postSlug'      => $this->slug,
            'date'          => date('Y-m-d', strtotime($this->created_at)),
            'postTypeSlug'  => cleanPostTypeSlug($this->getTable())
        ];

        $this->setAutoTranslate($previousAutoTranslate);
        return $data;
    }
1249147
protected function _parseApiParams($params)
  {
    $apiparams = [];
    if (count($params) === 0) {
      return $apiparams;
    }

    if (is_array($params[0])) {
      // given parameters are array
      $apiparams = $params[0];
      return $apiparams;
    }

    // user gave us query-style params
    parse_str($params[0], $apiparams);
    if (! is_array($apiparams)) {
      $apiparams = [];
    }

    return $apiparams;
  }
76337
public function search($params)
    {//echo __METHOD__;var_dump($params);//exit;
        $modelNewsClassname = $this->module->model('News')->className();
        $query = $this->module->model('NewsQuery', [$modelNewsClassname]);//var_dump($query);exit;

        // for REST: select by language
        $lang_code = false;
        if (!empty($params['lang_code'])) $lang_code = $params['lang_code'];
        if (!empty($params['lang']))      $lang_code = $params['lang'];
        if (!empty($lang_code)) {
            //$config = Module::getModuleConfigByClassname(Module::className());
            //$langHelper = new $config['params']['langHelper'];
            $module = Module::getModuleByClassname(Module::className());
            $langHelper = $module->langHelper;

            if ($langHelper::isValidLangCode($lang_code)) {
                $query->langCodeMain = $langHelper::normalizeLangCode($lang_code);
            }//var_dump($query->langCodeMain);exit;
        }

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);

        $this->load($params);

        if (!$this->validate()) {
            // uncomment the following line if you do not want to return any records when validation fails
            // $query->where('0=1');
            return $dataProvider;
        }

        $query->andFilterWhere([
            'main.id' => $this->id, //ambiguous: 'id' => $this->id,
            'owner_id' => $this->owner_id,
            'is_visible' => $this->is_visible,
            'show_from_time' => $this->show_from_time,
            'show_to_time' => $this->show_to_time,
            //'create_time' => $this->create_time,
            //'update_time' => $this->update_time,
        ]);

        //$query->alias('main')->leftJoin(['i18n' => NewsI18n::tableName()], "main.id = i18n.news_id AND i18n.lang_code = '{$this->langCodeMain}'");

        //$query->andFilterWhere(['like', 'image', $this->image]);

        $query->andFilterWhere(['like', 'title', $this->title]);
        $query->andFilterWhere(['like', 'body', $this->body]);

        $query
            ->andFilterWhere(['>=', 'show_from_time'
                , $this->show_from_time_begin ? $this->show_from_time_begin . ' 00:00:00' : null])
            ->andFilterWhere(['<=', 'show_from_time'
                , $this->show_from_time_end ? $this->show_from_time_end . ' 23:59:59' : null])
            ->andFilterWhere(['>=', 'show_to_time'
                , $this->show_to_time_begin ? $this->show_to_time_begin . ' 00:00:00' : null])
            ->andFilterWhere(['<=', 'show_to_time'
                , $this->show_to_time_end ? $this->show_to_time_end . ' 23:59:59' : null])
            ;

        $dataProvider->sort->attributes['title'] = [
            'asc'  => ['title' => SORT_ASC],
            'desc' => ['title' => SORT_DESC],
        ];

        if (empty($params['sort'])) {
            //$query->orderBy(['show_from_time' => SORT_DESC]); // default order
            $query->orderBy($this->defaultOrderBy);
        }
            
        //list($sql, $sqlParams) = Yii::$app->db->getQueryBuilder()->build($query);var_dump($sql);var_dump($sqlParams);exit;
        return $dataProvider;
    }
701116
private static function setParams($menuLink)
    {
        $menuLinkParams = self::decodeParams($menuLink->params);
        $routeParams = Route::getRoutes()->getByName($menuLink->routeName)->parameterNames();
        $params = [];
        foreach($routeParams as $key){
            if(isset($menuLinkParams[$key])) {
                $params[$key] = $menuLinkParams[$key];
            }
        }
        return $params;
    }
620476
private function constructPdoDsn(array $params)
    {
        $dsn = 'oci:dbname=' . $this->getEasyConnectString($params);

        if (isset($params['charset'])) {
            $dsn .= ';charset=' . $params['charset'];
        }

        return $dsn;
    }
593490
public function translate(string $key, array $params, string $locale = null): string
    {
        $realKey = $this->getRealKey($key, $locale);
        $message = ArrayHelper::get($this->messages, $realKey);
        
        // not exist, return key
        if (!\is_string($message)) {
            return $key;
        }

        // no params
        if (!$params) {
            return $message;
        }

        return $this->formatMessage($message, $params);
    }
915864
private function queryString($params)
	{
		$querystring = '?';
		foreach($params as $k => $v) {
			$querystring .= $k.'='.urlencode($v).'&';
		}
		return substr($querystring, 0, -1);
	}
1366905
protected static function _defaults($params)
	{
		$defaults = array(
			'check'   => null,
			'regex'   => null,
			'country' => null,
			'deep'    => false,
			'type'    => null
		);
		$params = array_merge($defaults, $params);
		if ($params['country'] !== null)
		{
			$params['country'] = mb_strtolower($params['country']);
		}
		return $params;
	}