Asymptix/Framework

View on GitHub

Showing 720 of 720 total issues

getUserAgent accesses the super-global variable $_SERVER.
Open

    public static function getUserAgent() {
        return isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : "";
    }
Severity: Minor
Found in framework/web/Browser.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

getIP accesses the super-global variable $_SERVER.
Open

    public static function getIP() {
        if (!empty($_SERVER['HTTP_CLIENT_IP'])) { //check ip from share internet
            return $_SERVER['HTTP_CLIENT_IP'];
        } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { //to check ip is pass from proxy
            return $_SERVER['HTTP_X_FORWARDED_FOR'];
Severity: Minor
Found in framework/web/Http.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

clean accesses the super-global variable $_POST.
Open

    public static function clean($source = null) {
        switch ($source) {
            case (Http::GET):
                $_GET = [];

Severity: Minor
Found in framework/web/Request.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

http_response_code accesses the super-global variable $_SERVER.
Open

    function http_response_code($code = NULL) {
        if ($code !== NULL) {
            switch ($code) {
                case 100: $text = 'Continue';
                    break;
Severity: Minor
Found in modules/http.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

httpRedirect accesses the super-global variable $_SERVER.
Open

    public static function httpRedirect($url = "", $postData = [], $serialize = true) {
        if (preg_match("#^http[s]?://.+#", $url)) { // absolute url
            if (function_exists("http_redirect")) {
                http_redirect($url);
            } else {
Severity: Minor
Found in framework/web/Http.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

exists accesses the super-global variable $_SESSION.
Open

    public static function exists($fieldName) {
        return isset($_SESSION[$fieldName]);
    }
Severity: Minor
Found in framework/web/Session.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

forgetField accesses the super-global variable $_SESSION.
Open

    public static function forgetField($fieldName) {
        Naming::unsetValueWithComplexName($_SESSION, "_post[{$fieldName}]");
    }
Severity: Minor
Found in framework/web/Request.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

clean accesses the super-global variable $_GET.
Open

    public static function clean($source = null) {
        switch ($source) {
            case (Http::GET):
                $_GET = [];

Severity: Minor
Found in framework/web/Request.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

remove accesses the super-global variable $_SESSION.
Open

    public static function remove($fieldName) {
        if (self::exists($fieldName)) {
            unset($_SESSION[$fieldName]);

            return true;
Severity: Minor
Found in framework/web/Session.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

http_response_code accesses the super-global variable $GLOBALS.
Open

    function http_response_code($code = NULL) {
        if ($code !== NULL) {
            switch ($code) {
                case 100: $text = 'Continue';
                    break;
Severity: Minor
Found in modules/http.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

The method friendlyErrorType() has a Cyclomatic Complexity of 16. The configured cyclomatic complexity threshold is 10.
Open

    private static function friendlyErrorType($type) {
        switch($type) {
            case E_ERROR: // 1
                return 'E_ERROR';
            case E_WARNING: // 2
Severity: Minor
Found in classes/db/tools/ErrorLog.php by phpmd

CyclomaticComplexity

Since: 0.1

Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

Example

// Cyclomatic Complexity = 11
class Foo {
1   public function example() {
2       if ($a == $b) {
3           if ($a1 == $b1) {
                fiddle();
4           } elseif ($a2 == $b2) {
                fiddle();
            } else {
                fiddle();
            }
5       } elseif ($c == $d) {
6           while ($c == $d) {
                fiddle();
            }
7        } elseif ($e == $f) {
8           for ($n = 0; $n < $h; $n++) {
                fiddle();
            }
        } else {
            switch ($z) {
9               case 1:
                    fiddle();
                    break;
10              case 2:
                    fiddle();
                    break;
11              case 3:
                    fiddle();
                    break;
                default:
                    fiddle();
                    break;
            }
        }
    }
}

Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

getIP accesses the super-global variable $_SERVER.
Open

    public static function getIP() {
        if (!empty($_SERVER['HTTP_CLIENT_IP'])) { //check ip from share internet
            return $_SERVER['HTTP_CLIENT_IP'];
        } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { //to check ip is pass from proxy
            return $_SERVER['HTTP_X_FORWARDED_FOR'];
Severity: Minor
Found in framework/web/Http.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

getFieldValue accesses the super-global variable $_GET.
Open

    public static function getFieldValue($fieldName, $source = null) {
        $value = null;

        try {
            switch ($source) {
Severity: Minor
Found in framework/web/Request.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

getFieldValue accesses the super-global variable $_POST.
Open

    public static function getFieldValue($fieldName, $source = null) {
        $value = null;

        try {
            switch ($source) {
Severity: Minor
Found in framework/web/Request.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

getDBConfig accesses the super-global variable $_SERVER.
Open

    public static function getDBConfig() {
        if (isset($_SERVER['HTTP_HOST']) && isset(self::$db[$_SERVER['HTTP_HOST']])) {
            return self::$db[$_SERVER['HTTP_HOST']];
        }
        return self::$db['default'];
Severity: Minor
Found in conf/Config.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

getIP accesses the super-global variable $_SERVER.
Open

    public static function getIP() {
        if (!empty($_SERVER['HTTP_CLIENT_IP'])) { //check ip from share internet
            return $_SERVER['HTTP_CLIENT_IP'];
        } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { //to check ip is pass from proxy
            return $_SERVER['HTTP_X_FORWARDED_FOR'];
Severity: Minor
Found in framework/web/Http.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

clean accesses the super-global variable $_POST.
Open

    public static function clean($source = null) {
        switch ($source) {
            case (Http::GET):
                $_GET = [];

Severity: Minor
Found in framework/web/Request.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

start accesses the super-global variable $_COOKIE.
Open

    public static function start($name = "", array $iniSettings = [], $useCookie = false,
            $lifetime = null, $path = null, $domain = null, $secure = null, $httponly = null)
    {
        if (!empty($iniSettings)) {
            foreach ($iniSettings as $key => $value) {
Severity: Minor
Found in framework/web/Session.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

clean accesses the super-global variable $_GET.
Open

    public static function clean($source = null) {
        switch ($source) {
            case (Http::GET):
                $_GET = [];

Severity: Minor
Found in framework/web/Request.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

get accesses the super-global variable $_SESSION.
Open

    public static function get($fieldName) {
        if (self::exists($fieldName)) {
            return $_SESSION[$fieldName];
        }

Severity: Minor
Found in framework/web/Session.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

Severity
Category
Status
Source
Language