@@ -119,24 +119,14 @@ public function getFrontName($checkHost = false)
119
119
*
120
120
* @return bool
121
121
*/
122
- public function isHostBackend ()
122
+ public function isHostBackend (): bool
123
123
{
124
124
if (!$ this ->request ->getServer ('HTTP_HOST ' )) {
125
125
return false ;
126
126
}
127
127
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
+
140
130
$ this ->uri ->parse ($ backendUrl );
141
131
$ configuredHost = $ this ->uri ->getHost ();
142
132
if (!$ configuredHost ) {
@@ -154,4 +144,20 @@ public function isHostBackend()
154
144
155
145
return strcasecmp ($ configuredHost , $ host ) === 0 ;
156
146
}
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
+
157
163
}
0 commit comments