@@ -119,24 +119,14 @@ public function getFrontName($checkHost = false)
119119 *
120120 * @return bool
121121 */
122- public function isHostBackend ()
122+ public function isHostBackend (): bool
123123 {
124124 if (!$ this ->request ->getServer ('HTTP_HOST ' )) {
125125 return false ;
126126 }
127127
128- if ($ this ->scopeConfig ->getValue (self ::XML_PATH_USE_CUSTOM_ADMIN_URL , ScopeInterface::SCOPE_STORE )) {
129- $ backendUrl = $ this ->scopeConfig ->getValue (self ::XML_PATH_CUSTOM_ADMIN_URL , ScopeInterface::SCOPE_STORE );
130- } else {
131- $ xmlPath = $ this ->request ->isSecure () ? Store::XML_PATH_SECURE_BASE_URL : Store::XML_PATH_UNSECURE_BASE_URL ;
132- $ backendUrl = $ this ->config ->getValue ($ xmlPath );
133- if ($ backendUrl === null ) {
134- $ backendUrl = $ this ->scopeConfig ->getValue (
135- $ xmlPath ,
136- ScopeInterface::SCOPE_STORE
137- );
138- }
139- }
128+ $ backendUrl = $ this ->getBackendUrl ();
129+
140130 $ this ->uri ->parse ($ backendUrl );
141131 $ configuredHost = $ this ->uri ->getHost ();
142132 if (!$ configuredHost ) {
@@ -154,4 +144,20 @@ public function isHostBackend()
154144
155145 return strcasecmp ($ configuredHost , $ host ) === 0 ;
156146 }
147+
148+ /**
149+ * Retrieve backend URL
150+ * @return string|null
151+ */
152+ private function getBackendUrl (): ?string
153+ {
154+ if ($ this ->scopeConfig ->getValue (self ::XML_PATH_USE_CUSTOM_ADMIN_URL , ScopeInterface::SCOPE_STORE )) {
155+ return $ this ->scopeConfig ->getValue (self ::XML_PATH_CUSTOM_ADMIN_URL , ScopeInterface::SCOPE_STORE );
156+ }
157+
158+ $ xmlPath = $ this ->request ->isSecure () ? Store::XML_PATH_SECURE_BASE_URL : Store::XML_PATH_UNSECURE_BASE_URL ;
159+ $ backendUrl = $ this ->config ->getValue ($ xmlPath );
160+ return $ backendUrl ?? $ this ->scopeConfig ->getValue ($ xmlPath , ScopeInterface::SCOPE_STORE );
161+ }
162+
157163}
0 commit comments