qcubed/framework

View on GitHub
assets/php/_devtools/jquery_ui_gen/jq_control_gen.php

Summary

Maintainability
A
1 hr
Test Coverage

Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function __construct($strUrl, $strJqClass = null, $strJqSetupFunc = null, $strQcClass = null, $strQcBaseClass = 'QPanel')
Severity: Minor
Found in assets/php/_devtools/jquery_ui_gen/jq_control_gen.php - About 35 mins to fix

    Function __construct has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function __construct($strUrl, $strJqClass = null, $strJqSetupFunc = null, $strQcClass = null, $strQcBaseClass = 'QPanel')
        {
            $this->hasDisabledProperty = false;
            $html = file_get_html($strUrl);
    
    
    Severity: Minor
    Found in assets/php/_devtools/jquery_ui_gen/jq_control_gen.php - About 25 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

    Missing class import via use statement (line '127', column '27').
    Open

                $this->options[] = new Event($this->strQcClass, $name, $origName, $type, $description);

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '189', column '22').
    Open

        $jqControlGen = new JqControlGen();

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '152', column '26').
    Open

            $this->methods[] = new Method($name, $origName, $signature, $description);

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '129', column '26').
    Open

                $this->events[] = new Event($this->strQcClass, $name, $origName, $type, $description);

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '98', column '26').
    Open

            $this->options[] = new Option($name, $origName, $type, $defaultValue, $description);

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '190', column '18').
    Open

        $objJqDoc = new HtmlJqDoc($strUrl, null, null, $strQcClass, $strQcBaseClass);

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    The method add_event uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

            } else {
                $this->events[] = new Event($this->strQcClass, $name, $origName, $type, $description);
            }

    ElseExpression

    Since: 1.4.0

    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

    Example

    class Foo
    {
        public function bar($flag)
        {
            if ($flag) {
                // one branch
            } else {
                // another branch
            }
        }
    }

    Source https://phpmd.org/rules/cleancode.html#elseexpression

    The method add_option uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

            } else {
                $desc_node = $name_node->next_sibling();
            }

    ElseExpression

    Since: 1.4.0

    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

    Example

    class Foo
    {
        public function bar($flag)
        {
            if ($flag) {
                // one branch
            } else {
                // another branch
            }
        }
    }

    Source https://phpmd.org/rules/cleancode.html#elseexpression

    The method CamelCaseFromDash uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

            } else {
                $strToReturn .= substr($strName, 0, $intPosition);
                $strName = substr($strName, $intPosition + 1);
            }

    ElseExpression

    Since: 1.4.0

    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

    Example

    class Foo
    {
        public function bar($flag)
        {
            if ($flag) {
                // one branch
            } else {
                // another branch
            }
        }
    }

    Source https://phpmd.org/rules/cleancode.html#elseexpression

    Avoid excessively long variable names like $strOutDirControlsBase. Keep variable name length under 20.
    Open

        $strOutDirControlsBase = __QCUBED_CORE__ . "/base_controls";

    LongVariable

    Since: 0.2

    Detects when a field, formal or local variable is declared with a long name.

    Example

    class Something {
        protected $reallyLongIntName = -3; // VIOLATION - Field
        public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
            $otherReallyLongName = -5; // VIOLATION - Local
            for ($interestingIntIndex = 0; // VIOLATION - For
                 $interestingIntIndex < 10;
                 $interestingIntIndex++ ) {
            }
        }
    }

    Source https://phpmd.org/rules/naming.html#longvariable

    The parameter $desc_node is not named in camelCase.
    Open

        public function description($desc_node) {
            $description = '';
            while ($desc_node) {
                if (strpos($desc_node->plaintext, 'Code examples:') !== false) {
                    break;

    CamelCaseParameterName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name parameters.

    Example

    class ClassName {
        public function doSomething($user_name) {
        }
    }

    Source

    The variable $name_node is not named in camelCase.
    Open

        public function add_option($htmlOption) {
            $nodes = $htmlOption->find('h3');
            $name_node = $nodes[0];
            $origName = $name = preg_replace('/\W.*/', '', $name_node->innertext());
    
    

    CamelCaseVariableName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name variables.

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    The variable $name_node is not named in camelCase.
    Open

        public function add_method($htmlMethod) {
            $nodes = $htmlMethod->find('h3');
            $name_node = $nodes[0];
            $origName = $name = preg_replace('/\W.*/', '', $name_node->innertext());
            if ($origName === "widget") {

    CamelCaseVariableName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name variables.

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    The variable $name_node is not named in camelCase.
    Open

        public function add_option($htmlOption) {
            $nodes = $htmlOption->find('h3');
            $name_node = $nodes[0];
            $origName = $name = preg_replace('/\W.*/', '', $name_node->innertext());
    
    

    CamelCaseVariableName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name variables.

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    The variable $desc_node is not named in camelCase.
    Open

        public function description($desc_node) {
            $description = '';
            while ($desc_node) {
                if (strpos($desc_node->plaintext, 'Code examples:') !== false) {
                    break;

    CamelCaseVariableName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name variables.

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    The variable $name_node is not named in camelCase.
    Open

        public function add_method($htmlMethod) {
            $nodes = $htmlMethod->find('h3');
            $name_node = $nodes[0];
            $origName = $name = preg_replace('/\W.*/', '', $name_node->innertext());
            if ($origName === "widget") {

    CamelCaseVariableName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name variables.

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    The variable $desc_node is not named in camelCase.
    Open

        public function add_event($htmlEvent, $type = null) {
            $nodes = $htmlEvent->find('h3');
            $name_node = $nodes[0];
            $origName = $name = preg_replace('/\W.*/', '', $name_node->innertext());
            if (substr($name, 0, 2) !== "on") {

    CamelCaseVariableName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name variables.

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    The variable $name_node is not named in camelCase.
    Open

        public function add_method($htmlMethod) {
            $nodes = $htmlMethod->find('h3');
            $name_node = $nodes[0];
            $origName = $name = preg_replace('/\W.*/', '', $name_node->innertext());
            if ($origName === "widget") {

    CamelCaseVariableName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name variables.

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    The variable $name_node is not named in camelCase.
    Open

        public function add_event($htmlEvent, $type = null) {
            $nodes = $htmlEvent->find('h3');
            $name_node = $nodes[0];
            $origName = $name = preg_replace('/\W.*/', '', $name_node->innertext());
            if (substr($name, 0, 2) !== "on") {

    CamelCaseVariableName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name variables.

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    The variable $desc_node is not named in camelCase.
    Open

        public function add_event($htmlEvent, $type = null) {
            $nodes = $htmlEvent->find('h3');
            $name_node = $nodes[0];
            $origName = $name = preg_replace('/\W.*/', '', $name_node->innertext());
            if (substr($name, 0, 2) !== "on") {

    CamelCaseVariableName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name variables.

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    The variable $name_node is not named in camelCase.
    Open

        public function add_event($htmlEvent, $type = null) {
            $nodes = $htmlEvent->find('h3');
            $name_node = $nodes[0];
            $origName = $name = preg_replace('/\W.*/', '', $name_node->innertext());
            if (substr($name, 0, 2) !== "on") {

    CamelCaseVariableName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name variables.

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    The variable $desc_node is not named in camelCase.
    Open

        public function description($desc_node) {
            $description = '';
            while ($desc_node) {
                if (strpos($desc_node->plaintext, 'Code examples:') !== false) {
                    break;

    CamelCaseVariableName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name variables.

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    The variable $name_node is not named in camelCase.
    Open

        public function add_option($htmlOption) {
            $nodes = $htmlOption->find('h3');
            $name_node = $nodes[0];
            $origName = $name = preg_replace('/\W.*/', '', $name_node->innertext());
    
    

    CamelCaseVariableName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name variables.

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    The variable $name_node is not named in camelCase.
    Open

        public function add_method($htmlMethod) {
            $nodes = $htmlMethod->find('h3');
            $name_node = $nodes[0];
            $origName = $name = preg_replace('/\W.*/', '', $name_node->innertext());
            if ($origName === "widget") {

    CamelCaseVariableName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name variables.

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    The variable $desc_node is not named in camelCase.
    Open

        public function add_method($htmlMethod) {
            $nodes = $htmlMethod->find('h3');
            $name_node = $nodes[0];
            $origName = $name = preg_replace('/\W.*/', '', $name_node->innertext());
            if ($origName === "widget") {

    CamelCaseVariableName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name variables.

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    The variable $name_node is not named in camelCase.
    Open

        public function add_event($htmlEvent, $type = null) {
            $nodes = $htmlEvent->find('h3');
            $name_node = $nodes[0];
            $origName = $name = preg_replace('/\W.*/', '', $name_node->innertext());
            if (substr($name, 0, 2) !== "on") {

    CamelCaseVariableName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name variables.

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    The variable $desc_node is not named in camelCase.
    Open

        public function description($desc_node) {
            $description = '';
            while ($desc_node) {
                if (strpos($desc_node->plaintext, 'Code examples:') !== false) {
                    break;

    CamelCaseVariableName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name variables.

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    The variable $desc_node is not named in camelCase.
    Open

        public function add_option($htmlOption) {
            $nodes = $htmlOption->find('h3');
            $name_node = $nodes[0];
            $origName = $name = preg_replace('/\W.*/', '', $name_node->innertext());
    
    

    CamelCaseVariableName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name variables.

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    The variable $desc_node is not named in camelCase.
    Open

        public function description($desc_node) {
            $description = '';
            while ($desc_node) {
                if (strpos($desc_node->plaintext, 'Code examples:') !== false) {
                    break;

    CamelCaseVariableName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name variables.

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    The variable $desc_node is not named in camelCase.
    Open

        public function add_option($htmlOption) {
            $nodes = $htmlOption->find('h3');
            $name_node = $nodes[0];
            $origName = $name = preg_replace('/\W.*/', '', $name_node->innertext());
    
    

    CamelCaseVariableName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name variables.

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    The variable $desc_node is not named in camelCase.
    Open

        public function add_method($htmlMethod) {
            $nodes = $htmlMethod->find('h3');
            $name_node = $nodes[0];
            $origName = $name = preg_replace('/\W.*/', '', $name_node->innertext());
            if ($origName === "widget") {

    CamelCaseVariableName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name variables.

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    The variable $desc_node is not named in camelCase.
    Open

        public function description($desc_node) {
            $description = '';
            while ($desc_node) {
                if (strpos($desc_node->plaintext, 'Code examples:') !== false) {
                    break;

    CamelCaseVariableName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name variables.

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    The variable $desc_node is not named in camelCase.
    Open

        public function add_option($htmlOption) {
            $nodes = $htmlOption->find('h3');
            $name_node = $nodes[0];
            $origName = $name = preg_replace('/\W.*/', '', $name_node->innertext());
    
    

    CamelCaseVariableName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name variables.

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    The method add_event is not named in camelCase.
    Open

        public function add_event($htmlEvent, $type = null) {
            $nodes = $htmlEvent->find('h3');
            $name_node = $nodes[0];
            $origName = $name = preg_replace('/\W.*/', '', $name_node->innertext());
            if (substr($name, 0, 2) !== "on") {

    CamelCaseMethodName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name methods.

    Example

    class ClassName {
        public function get_name() {
        }
    }

    Source

    The method add_option is not named in camelCase.
    Open

        public function add_option($htmlOption) {
            $nodes = $htmlOption->find('h3');
            $name_node = $nodes[0];
            $origName = $name = preg_replace('/\W.*/', '', $name_node->innertext());
    
    

    CamelCaseMethodName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name methods.

    Example

    class ClassName {
        public function get_name() {
        }
    }

    Source

    The method add_method is not named in camelCase.
    Open

        public function add_method($htmlMethod) {
            $nodes = $htmlMethod->find('h3');
            $name_node = $nodes[0];
            $origName = $name = preg_replace('/\W.*/', '', $name_node->innertext());
            if ($origName === "widget") {

    CamelCaseMethodName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name methods.

    Example

    class ClassName {
        public function get_name() {
        }
    }

    Source

    The method is_event_option is not named in camelCase.
    Open

        public function is_event_option($type) {
            return stripos($type, 'function') !== false && strpos($type, ' or ') === false;
        }

    CamelCaseMethodName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name methods.

    Example

    class ClassName {
        public function get_name() {
        }
    }

    Source

    There are no issues that match your filters.

    Category
    Status