Code Duplication    Length = 22-22 lines in 2 locations

manager/includes/document.parser.class.inc.php 2 locations

@@ 4927-4948 (lines=22) @@
4924
     * @param string $context . Default is an empty string which indicates the method should automatically pick 'web (frontend) or 'mgr' (backend)
4925
     * @return string
4926
     */
4927
    public function getLoginUserID($context = '')
4928
    {
4929
        $out = false;
4930
4931
        if (!empty($context)) {
4932
            if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) {
4933
                $out = $_SESSION[$context . 'InternalKey'];
4934
            }
4935
        } else {
4936
            switch (true) {
4937
                case ($this->isFrontend() && isset ($_SESSION['webValidated'])): {
4938
                    $out = $_SESSION['webInternalKey'];
4939
                    break;
4940
                }
4941
                case ($this->isBackend() && isset ($_SESSION['mgrValidated'])): {
4942
                    $out = $_SESSION['mgrInternalKey'];
4943
                    break;
4944
                }
4945
            }
4946
        }
4947
        return $out;
4948
    }
4949
4950
    /**
4951
     * Returns current user name
@@ 4956-4977 (lines=22) @@
4953
     * @param string $context . Default is an empty string which indicates the method should automatically pick 'web (frontend) or 'mgr' (backend)
4954
     * @return string
4955
     */
4956
    public function getLoginUserName($context = '')
4957
    {
4958
        $out = false;
4959
4960
        if (!empty($context)) {
4961
            if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) {
4962
                $out = $_SESSION[$context . 'Shortname'];
4963
            }
4964
        } else {
4965
            switch (true) {
4966
                case ($this->isFrontend() && isset ($_SESSION['webValidated'])): {
4967
                    $out = $_SESSION['webShortname'];
4968
                    break;
4969
                }
4970
                case ($this->isBackend() && isset ($_SESSION['mgrValidated'])): {
4971
                    $out = $_SESSION['mgrShortname'];
4972
                    break;
4973
                }
4974
            }
4975
        }
4976
        return $out;
4977
    }
4978
4979
    /**
4980
     * Returns current login user type - web or manager