Code Duplication    Length = 22-22 lines in 2 locations

manager/includes/src/Core.php 2 locations

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