Code Duplication    Length = 22-22 lines in 2 locations

manager/includes/src/Core.php 2 locations

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