Code Duplication    Length = 22-22 lines in 2 locations

core/src/Core.php 2 locations

@@ 4686-4707 (lines=22) @@
4683
     * @param string $context . Default is an empty string which indicates the method should automatically pick 'web (frontend) or 'mgr' (backend)
4684
     * @return string
4685
     */
4686
    public function getLoginUserID($context = '')
4687
    {
4688
        $out = false;
4689
4690
        if (!empty($context)) {
4691
            if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) {
4692
                $out = $_SESSION[$context . 'InternalKey'];
4693
            }
4694
        } else {
4695
            switch (true) {
4696
                case ($this->isFrontend() && isset ($_SESSION['webValidated'])): {
4697
                    $out = $_SESSION['webInternalKey'];
4698
                    break;
4699
                }
4700
                case ($this->isBackend() && isset ($_SESSION['mgrValidated'])): {
4701
                    $out = $_SESSION['mgrInternalKey'];
4702
                    break;
4703
                }
4704
            }
4705
        }
4706
        return $out;
4707
    }
4708
4709
    /**
4710
     * Returns current user name
@@ 4715-4736 (lines=22) @@
4712
     * @param string $context . Default is an empty string which indicates the method should automatically pick 'web (frontend) or 'mgr' (backend)
4713
     * @return string
4714
     */
4715
    public function getLoginUserName($context = '')
4716
    {
4717
        $out = false;
4718
4719
        if (!empty($context)) {
4720
            if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) {
4721
                $out = $_SESSION[$context . 'Shortname'];
4722
            }
4723
        } else {
4724
            switch (true) {
4725
                case ($this->isFrontend() && isset ($_SESSION['webValidated'])): {
4726
                    $out = $_SESSION['webShortname'];
4727
                    break;
4728
                }
4729
                case ($this->isBackend() && isset ($_SESSION['mgrValidated'])): {
4730
                    $out = $_SESSION['mgrShortname'];
4731
                    break;
4732
                }
4733
            }
4734
        }
4735
        return $out;
4736
    }
4737
4738
    /**
4739
     * Returns current login user type - web or manager