koselig/library

View on GitHub
src/Proxy/WordpressDatabase.php

Summary

Maintainability
B
4 hrs
Test Coverage

Function query has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function query($query)
    {
        if (!$this->ready) {
            $this->check_current_query = true;

Severity: Minor
Found in src/Proxy/WordpressDatabase.php - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method query has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function query($query)
    {
        if (!$this->ready) {
            $this->check_current_query = true;

Severity: Minor
Found in src/Proxy/WordpressDatabase.php - About 1 hr to fix

    Function _do_query has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        private function _do_query($query)
        {
            if (defined('SAVEQUERIES') && SAVEQUERIES) {
                $this->timer_start();
            }
    Severity: Minor
    Found in src/Proxy/WordpressDatabase.php - About 45 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method name "WordpressDatabase::_do_query" is not in camel caps format
    Open

        private function _do_query($query)

    Method name "WordpressDatabase::db_connect" is not in camel caps format
    Open

        public function db_connect($allowBail = true)

    Method name "WordpressDatabase::has_cap" is not in camel caps format
    Open

        public function has_cap($capability)

    Method name "WordpressDatabase::check_connection" is not in camel caps format
    Open

        public function check_connection($allowBail = true)

    Method name "WordpressDatabase::_real_escape" is not in camel caps format
    Open

        public function _real_escape($string)

    Method name "WordpressDatabase::set_sql_mode" is not in camel caps format
    Open

        public function set_sql_mode($modes = [])

    Method name "WordpressDatabase::db_version" is not in camel caps format
    Open

        public function db_version()

    There are no issues that match your filters.

    Category
    Status