/**
  * {@inheritdoc}
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 public function setRouteParams(array $data, $unsetOldParams = true)
 {
     if (isset($data['_type'])) {
         $this->setType($data['_type']);
         unset($data['_type']);
     }
     if (isset($data['_forced_secure'])) {
         $this->setSecure((bool) $data['_forced_secure']);
         $this->setSecureIsForced(true);
         unset($data['_forced_secure']);
     } elseif (isset($data['_secure'])) {
         $this->setSecure((bool) $data['_secure']);
         unset($data['_secure']);
     }
     if (isset($data['_absolute'])) {
         unset($data['_absolute']);
     }
     if ($unsetOldParams) {
         $this->unsetData('route_params');
     }
     if (isset($data['_current'])) {
         if (is_array($data['_current'])) {
             foreach ($data['_current'] as $key) {
                 if (array_key_exists($key, $data) || !$this->request->getUserParam($key)) {
                     continue;
                 }
                 $data[$key] = $this->request->getUserParam($key);
             }
         } elseif ($data['_current']) {
             foreach ($this->request->getUserParams() as $key => $value) {
                 if (array_key_exists($key, $data) || $this->getRouteParam($key)) {
                     continue;
                 }
                 $data[$key] = $value;
             }
             foreach ($this->request->getQuery() as $key => $value) {
                 $this->queryParamsResolver->setQueryParam($key, $value);
             }
         }
         unset($data['_current']);
     }
     if (isset($data['_use_rewrite'])) {
         unset($data['_use_rewrite']);
     }
     foreach ($data as $key => $value) {
         $this->setRouteParam($key, $value);
     }
     return $this;
 }
 /**
  * {@inheritdoc}
  */
 public function setRouteParams(array $data, $unsetOldParams = true)
 {
     if (isset($data['_type'])) {
         $this->setType($data['_type']);
         unset($data['_type']);
     }
     if (isset($data['_scope'])) {
         $this->setScope($data['_scope']);
         unset($data['_scope']);
     }
     if (isset($data['_forced_secure'])) {
         $this->setSecure((bool) $data['_forced_secure']);
         $this->setSecureIsForced(true);
         unset($data['_forced_secure']);
     } elseif (isset($data['_secure'])) {
         $this->setSecure((bool) $data['_secure']);
         unset($data['_secure']);
     }
     if (isset($data['_absolute'])) {
         unset($data['_absolute']);
     }
     if ($unsetOldParams) {
         $this->unsetData('route_params');
     }
     if (isset($data['_current'])) {
         if (is_array($data['_current'])) {
             foreach ($data['_current'] as $key) {
                 if (array_key_exists($key, $data) || !$this->_request->getUserParam($key)) {
                     continue;
                 }
                 $data[$key] = $this->_request->getUserParam($key);
             }
         } elseif ($data['_current']) {
             foreach ($this->_request->getUserParams() as $key => $value) {
                 if (array_key_exists($key, $data) || $this->getRouteParam($key)) {
                     continue;
                 }
                 $data[$key] = $value;
             }
             foreach ($this->_request->getQuery() as $key => $value) {
                 $this->_queryParamsResolver->setQueryParam($key, $value);
             }
         }
         unset($data['_current']);
     }
     if (isset($data['_use_rewrite'])) {
         unset($data['_use_rewrite']);
     }
     if (isset($data['_scope_to_url']) && (bool) $data['_scope_to_url'] === true) {
         $store = $this->getScope() ?: $this->_storeManager->getStore();
         if (!$this->_scopeConfig->getValue(\Magento\Store\Model\Store::XML_PATH_STORE_IN_URL, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $this->getScope()) && !$this->_storeManager->hasSingleStore()) {
             $this->_queryParamsResolver->setQueryParam('___store', $store->getCode());
         }
     }
     unset($data['_scope_to_url']);
     foreach ($data as $key => $value) {
         $this->setRouteParam($key, $value);
     }
     return $this;
 }