Code Duplication    Length = 22-22 lines in 2 locations

manager/includes/src/Core.php 2 locations

@@ 5251-5272 (lines=22) @@
5248
     * @param string $context . Default is an empty string which indicates the method should automatically pick 'web (frontend) or 'mgr' (backend)
5249
     * @return string
5250
     */
5251
    public function getLoginUserID($context = '')
5252
    {
5253
        $out = false;
5254
5255
        if (!empty($context)) {
5256
            if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) {
5257
                $out = $_SESSION[$context . 'InternalKey'];
5258
            }
5259
        } else {
5260
            switch (true) {
5261
                case ($this->isFrontend() && isset ($_SESSION['webValidated'])): {
5262
                    $out = $_SESSION['webInternalKey'];
5263
                    break;
5264
                }
5265
                case ($this->isBackend() && isset ($_SESSION['mgrValidated'])): {
5266
                    $out = $_SESSION['mgrInternalKey'];
5267
                    break;
5268
                }
5269
            }
5270
        }
5271
        return $out;
5272
    }
5273
5274
    /**
5275
     * Returns current user name
@@ 5280-5301 (lines=22) @@
5277
     * @param string $context . Default is an empty string which indicates the method should automatically pick 'web (frontend) or 'mgr' (backend)
5278
     * @return string
5279
     */
5280
    public function getLoginUserName($context = '')
5281
    {
5282
        $out = false;
5283
5284
        if (!empty($context)) {
5285
            if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) {
5286
                $out = $_SESSION[$context . 'Shortname'];
5287
            }
5288
        } else {
5289
            switch (true) {
5290
                case ($this->isFrontend() && isset ($_SESSION['webValidated'])): {
5291
                    $out = $_SESSION['webShortname'];
5292
                    break;
5293
                }
5294
                case ($this->isBackend() && isset ($_SESSION['mgrValidated'])): {
5295
                    $out = $_SESSION['mgrShortname'];
5296
                    break;
5297
                }
5298
            }
5299
        }
5300
        return $out;
5301
    }
5302
5303
    /**
5304
     * Returns current login user type - web or manager