qcubed/framework

View on GitHub
includes/base_controls/QListBoxBase.class.php

Summary

Maintainability
C
1 day
Test Coverage

ParsePostData accesses the super-global variable $_POST.
Open

        public function ParsePostData() {
            if (array_key_exists($this->strControlId, $_POST)) {
                if (is_array($_POST[$this->strControlId])) {
                    // Multi-Select, so find them all.
                    $this->SetSelectedItemsById($_POST[$this->strControlId], false);

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

ParsePostData accesses the super-global variable $_POST.
Open

        public function ParsePostData() {
            if (array_key_exists($this->strControlId, $_POST)) {
                if (is_array($_POST[$this->strControlId])) {
                    // Multi-Select, so find them all.
                    $this->SetSelectedItemsById($_POST[$this->strControlId], false);

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

ParsePostData accesses the super-global variable $_POST.
Open

        public function ParsePostData() {
            if (array_key_exists($this->strControlId, $_POST)) {
                if (is_array($_POST[$this->strControlId])) {
                    // Multi-Select, so find them all.
                    $this->SetSelectedItemsById($_POST[$this->strControlId], false);

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

ParsePostData accesses the super-global variable $_POST.
Open

        public function ParsePostData() {
            if (array_key_exists($this->strControlId, $_POST)) {
                if (is_array($_POST[$this->strControlId])) {
                    // Multi-Select, so find them all.
                    $this->SetSelectedItemsById($_POST[$this->strControlId], false);

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

ParsePostData accesses the super-global variable $_POST.
Open

        public function ParsePostData() {
            if (array_key_exists($this->strControlId, $_POST)) {
                if (is_array($_POST[$this->strControlId])) {
                    // Multi-Select, so find them all.
                    $this->SetSelectedItemsById($_POST[$this->strControlId], false);

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 class QListBoxBase has an overall complexity of 60 which is very high. The configured complexity threshold is 50.
Open

    abstract class QListBoxBase extends QListControl {
        ///////////////////////////
        // Private Member Variables
        ///////////////////////////

Function RenderInnerHtml has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

        protected function RenderInnerHtml() {
            $strHtml = '';
            $intItemCount = $this->GetItemCount();
            if (!$intItemCount) return '';
            $groups = array();
Severity: Minor
Found in includes/base_controls/QListBoxBase.class.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 __set has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        public function __set($strName, $mixValue) {
            switch ($strName) {
                // APPEARANCE
                case "Rows":
                    try {
Severity: Minor
Found in includes/base_controls/QListBoxBase.class.php - About 1 hr to fix

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

            public function Validate() {
                if ($this->blnRequired) {
                    if ($this->SelectedIndex == -1) {
                        if ($this->strName)
                            $this->ValidationError = sprintf($this->strLabelForRequired, $this->strName);
    Severity: Minor
    Found in includes/base_controls/QListBoxBase.class.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

    Function __set has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

            public function __set($strName, $mixValue) {
                switch ($strName) {
                    // APPEARANCE
                    case "Rows":
                        try {
    Severity: Minor
    Found in includes/base_controls/QListBoxBase.class.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 RenderInnerHtml has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            protected function RenderInnerHtml() {
                $strHtml = '';
                $intItemCount = $this->GetItemCount();
                if (!$intItemCount) return '';
                $groups = array();
    Severity: Minor
    Found in includes/base_controls/QListBoxBase.class.php - About 1 hr to fix

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

              public function ParsePostData() {
                  if (array_key_exists($this->strControlId, $_POST)) {
                      if (is_array($_POST[$this->strControlId])) {
                          // Multi-Select, so find them all.
                          $this->SetSelectedItemsById($_POST[$this->strControlId], false);
      Severity: Minor
      Found in includes/base_controls/QListBoxBase.class.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

      Avoid too many return statements within this method.
      Open

                              return parent::__get($strName);
      Severity: Major
      Found in includes/base_controls/QListBoxBase.class.php - About 30 mins to fix

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

                protected function GetControlHtml() {
                    // If no selection is specified, we select the first item, because once we draw this, that is what the browser
                    // will consider selected on the screen.
                    // We need to make sure that what we draw is mirrored in our current state
                    if ($this->SelectionMode == QSelectionMode::Single &&
        Severity: Minor
        Found in includes/base_controls/QListBoxBase.class.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

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

                public function __set($strName, $mixValue) {
                    switch ($strName) {
                        // APPEARANCE
                        case "Rows":
                            try {

        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

        Avoid using undefined variables such as '$attrOverride' which will lead to PHP notices.
        Open

                        $attrOverride['name'] = $this->strControlId;

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

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

        Avoid using undefined variables such as '$attrOverride' which will lead to PHP notices.
        Open

                        $attrOverride['name'] = $this->strControlId . "[]";

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

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

        Avoid using undefined variables such as '$attrOverride' which will lead to PHP notices.
        Open

                    $strToReturn = $this->RenderTag('select', $attrOverride, null, $this->RenderInnerHtml());

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

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

        Missing class import via use statement (line '325', column '9').
        Open

                        new QModelConnectorParam (get_called_class(), 'SelectionMode', 'Single or multiple selections', QModelConnectorParam::SelectionList,

        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 '81', column '22').
        Open

                        $objStyler = new QListItemStyle();

        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 '324', column '9').
        Open

                        new QModelConnectorParam (get_called_class(), 'Rows', 'Height of field for multirow field', QType::Integer),

        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 '44', column '30').
        Open

                    $this->objItemStyle = new QListItemStyle();

        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

        Avoid using static access to class 'QType' in method '__set'.
        Open

                                $this->strLabelForRequiredUnnamed = QType::Cast($mixValue, QType::String);

        StaticAccess

        Since: 1.4.0

        Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

        Example

        class Foo
        {
            public function bar()
            {
                Bar::baz();
            }
        }

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

        Avoid using static access to class 'QApplication' in method '__construct'.
        Open

                    $this->strLabelForRequiredUnnamed = QApplication::Translate('Required');

        StaticAccess

        Since: 1.4.0

        Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

        Example

        class Foo
        {
            public function bar()
            {
                Bar::baz();
            }
        }

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

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

                    } else {
                        // Multiselect forms with nothing passed via $_POST means that everything was DE selected
                        if ($this->SelectionMode == QSelectionMode::Multiple) {
                            $this->UnselectAllItems(false);
                        }

        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 GetControlHtml uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

                    } else {
                        $attrOverride['name'] = $this->strControlId;
                    }

        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 using static access to class 'QApplication' in method '__construct'.
        Open

                    $this->strLabelForRequired = QApplication::Translate('%s is required');

        StaticAccess

        Since: 1.4.0

        Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

        Example

        class Foo
        {
            public function bar()
            {
                Bar::baz();
            }
        }

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

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

                        else {
                            // Single-select
                            $this->SetSelectedItemsById(array($_POST[$this->strControlId]), false);
                        }

        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 GetItemHtml uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

                    } else {
                        $objStyler = new QListItemStyle();
                    }

        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 using static access to class 'QHtml' in method 'RenderInnerHtml'.
        Open

                            $strHtml .= QHtml::RenderTag('optgroup', ['label' => QApplication::HtmlEntities($strGroup)], $strGroupHtml);

        StaticAccess

        Since: 1.4.0

        Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

        Example

        class Foo
        {
            public function bar()
            {
                Bar::baz();
            }
        }

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

        Avoid assigning values to variables in if clauses and the like (line '141', column '9').
        Open

                protected function RenderInnerHtml() {
                    $strHtml = '';
                    $intItemCount = $this->GetItemCount();
                    if (!$intItemCount) return '';
                    $groups = array();

        IfStatementAssignment

        Since: 2.7.0

        Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

        Example

        class Foo
        {
            public function bar($flag)
            {
                if ($foo = 'bar') { // possible typo
                    // ...
                }
                if ($baz = 0) { // always false
                    // ...
                }
            }
        }

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

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

                        } else {
                            $groups[''][] = $objItem;
                        }

        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 using static access to class 'QApplication' in method 'RenderInnerHtml'.
        Open

                            $strHtml .= QHtml::RenderTag('optgroup', ['label' => QApplication::HtmlEntities($strGroup)], $strGroupHtml);

        StaticAccess

        Since: 1.4.0

        Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

        Example

        class Foo
        {
            public function bar()
            {
                Bar::baz();
            }
        }

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

        Avoid using static access to class 'QType' in method '__set'.
        Open

                                $this->SetHtmlAttribute('size', QType::Cast($mixValue, QType::Integer));

        StaticAccess

        Since: 1.4.0

        Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

        Example

        class Foo
        {
            public function bar()
            {
                Bar::baz();
            }
        }

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

        Avoid using static access to class 'QApplication' in method 'GetItemHtml'.
        Open

                    $strHtml = QHtml::RenderTag('option', $objStyler->RenderHtmlAttributes(), QApplication::HtmlEntities($objItem->Name), false, true) . _nl();

        StaticAccess

        Since: 1.4.0

        Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

        Example

        class Foo
        {
            public function bar()
            {
                Bar::baz();
            }
        }

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

        Avoid using static access to class 'QType' in method '__set'.
        Open

                                $this->strLabelForRequired = QType::Cast($mixValue, QType::String);

        StaticAccess

        Since: 1.4.0

        Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

        Example

        class Foo
        {
            public function bar()
            {
                Bar::baz();
            }
        }

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

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

                                } else {
                                    $this->RemoveHtmlAttribute('multiple');
                                }

        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 using static access to class 'QHtml' in method 'GetItemHtml'.
        Open

                    $strHtml = QHtml::RenderTag('option', $objStyler->RenderHtmlAttributes(), QApplication::HtmlEntities($objItem->Name), false, true) . _nl();

        StaticAccess

        Since: 1.4.0

        Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

        Example

        class Foo
        {
            public function bar()
            {
                Bar::baz();
            }
        }

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

        Avoid assigning values to variables in if clauses and the like (line '85', column '8').
        Open

                protected function GetItemHtml(QListItem $objItem) {
                    // The Default Item Style
                    if ($this->objItemStyle) {
                        $objStyler = clone ($this->objItemStyle);
                    } else {

        IfStatementAssignment

        Since: 2.7.0

        Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

        Example

        class Foo
        {
            public function bar($flag)
            {
                if ($foo = 'bar') { // possible typo
                    // ...
                }
                if ($baz = 0) { // always false
                    // ...
                }
            }
        }

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

        Avoid using static access to class 'QApplication' in method 'RefreshSelection'.
        Open

                    QApplication::ExecuteControlCommand($this->ControlId, 'val', $values);

        StaticAccess

        Since: 1.4.0

        Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

        Example

        class Foo
        {
            public function bar()
            {
                Bar::baz();
            }
        }

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

        Avoid using static access to class 'QType' in method '__set'.
        Open

                                if (QType::Cast($mixValue, QType::String) == QSelectionMode::Multiple) {

        StaticAccess

        Since: 1.4.0

        Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

        Example

        class Foo
        {
            public function bar()
            {
                Bar::baz();
            }
        }

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

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

                        else {
                            $strGroupHtml = '';
                            foreach ($items as $objItem) {
                                $strGroupHtml .= $this->GetItemHtml($objItem);
                            }

        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 $strLabelForRequiredUnnamed. Keep variable name length under 20.
        Open

                protected $strLabelForRequiredUnnamed;

        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 method GetModelConnectorParams is not named in camelCase.
        Open

                public static function GetModelConnectorParams() {
                    return array_merge(parent::GetModelConnectorParams(), array(
                        new QModelConnectorParam (get_called_class(), 'Rows', 'Height of field for multirow field', QType::Integer),
                        new QModelConnectorParam (get_called_class(), 'SelectionMode', 'Single or multiple selections', QModelConnectorParam::SelectionList,
                            array (null=>'Default',

        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 ParsePostData is not named in camelCase.
        Open

                public function ParsePostData() {
                    if (array_key_exists($this->strControlId, $_POST)) {
                        if (is_array($_POST[$this->strControlId])) {
                            // Multi-Select, so find them all.
                            $this->SetSelectedItemsById($_POST[$this->strControlId], 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

        The method PutState is not named in camelCase.
        Open

                public function PutState($state) {
                    if (!empty($state['SelectedValues'])) {
                        // assume only one selection in list
                        $strValue = reset($state['SelectedValues']);
                        if ($this->FindItemByValue($strValue)) {

        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 GetControlHtml is not named in camelCase.
        Open

                protected function GetControlHtml() {
                    // If no selection is specified, we select the first item, because once we draw this, that is what the browser
                    // will consider selected on the screen.
                    // We need to make sure that what we draw is mirrored in our current state
                    if ($this->SelectionMode == QSelectionMode::Single &&

        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 GetItemHtml is not named in camelCase.
        Open

                protected function GetItemHtml(QListItem $objItem) {
                    // The Default Item Style
                    if ($this->objItemStyle) {
                        $objStyler = clone ($this->objItemStyle);
                    } else {

        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 Validate is not named in camelCase.
        Open

                public function Validate() {
                    if ($this->blnRequired) {
                        if ($this->SelectedIndex == -1) {
                            if ($this->strName)
                                $this->ValidationError = sprintf($this->strLabelForRequired, $this->strName);

        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 RenderInnerHtml is not named in camelCase.
        Open

                protected function RenderInnerHtml() {
                    $strHtml = '';
                    $intItemCount = $this->GetItemCount();
                    if (!$intItemCount) return '';
                    $groups = array();

        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 GetResetButtonHtml is not named in camelCase.
        Open

                abstract protected function GetResetButtonHtml();

        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 RefreshSelection is not named in camelCase.
        Open

                protected function RefreshSelection() {
                    $items = $this->SelectedItems;
                    $values = [];
                    foreach ($items as $objItem) {
                        $values[] = $objItem->Id;

        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