Code Duplication    Length = 22-22 lines in 2 locations

manager/includes/src/Core.php 2 locations

@@ 5213-5234 (lines=22) @@
5210
     * @param string $context . Default is an empty string which indicates the method should automatically pick 'web (frontend) or 'mgr' (backend)
5211
     * @return string
5212
     */
5213
    public function getLoginUserID($context = '')
5214
    {
5215
        $out = false;
5216
5217
        if (!empty($context)) {
5218
            if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) {
5219
                $out = $_SESSION[$context . 'InternalKey'];
5220
            }
5221
        } else {
5222
            switch (true) {
5223
                case ($this->isFrontend() && isset ($_SESSION['webValidated'])): {
5224
                    $out = $_SESSION['webInternalKey'];
5225
                    break;
5226
                }
5227
                case ($this->isBackend() && isset ($_SESSION['mgrValidated'])): {
5228
                    $out = $_SESSION['mgrInternalKey'];
5229
                    break;
5230
                }
5231
            }
5232
        }
5233
        return $out;
5234
    }
5235
5236
    /**
5237
     * Returns current user name
@@ 5242-5263 (lines=22) @@
5239
     * @param string $context . Default is an empty string which indicates the method should automatically pick 'web (frontend) or 'mgr' (backend)
5240
     * @return string
5241
     */
5242
    public function getLoginUserName($context = '')
5243
    {
5244
        $out = false;
5245
5246
        if (!empty($context)) {
5247
            if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) {
5248
                $out = $_SESSION[$context . 'Shortname'];
5249
            }
5250
        } else {
5251
            switch (true) {
5252
                case ($this->isFrontend() && isset ($_SESSION['webValidated'])): {
5253
                    $out = $_SESSION['webShortname'];
5254
                    break;
5255
                }
5256
                case ($this->isBackend() && isset ($_SESSION['mgrValidated'])): {
5257
                    $out = $_SESSION['mgrShortname'];
5258
                    break;
5259
                }
5260
            }
5261
        }
5262
        return $out;
5263
    }
5264
5265
    /**
5266
     * Returns current login user type - web or manager