qcubed/framework

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

Summary

Maintainability
D
1 day
Test Coverage

The class QDialogBase has an overall complexity of 61 which is very high. The configured complexity threshold is 50.
Open

    class QDialogBase extends QDialogGen
    {
        // enumerations

        /** Default dialog state */

The class QDialogBase has 15 public methods. Consider refactoring QDialogBase to keep number of public methods under 10.
Open

    class QDialogBase extends QDialogGen
    {
        // enumerations

        /** Default dialog state */

TooManyPublicMethods

Since: 0.1

A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

By default it ignores methods starting with 'get' or 'set'.

Example

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

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

        public function __set($strName, $mixValue) {
            switch ($strName) {
                case '_ClickedButton': // Internal only. Do not use. Used by JS above to keep track of clicked button.
                    try {
                        $this->strClickedButtonId = QType::Cast($mixValue, QType::String);
Severity: Minor
Found in includes/base_controls/QDialogBase.class.php - About 3 hrs 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

File QDialogBase.class.php has 302 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
    /**
     * Dialog Base Class
     * 
     * The QDialogBase class defined here provides an interface between the generated
Severity: Minor
Found in includes/base_controls/QDialogBase.class.php - About 3 hrs to fix

    Method __set has 75 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            public function __set($strName, $mixValue) {
                switch ($strName) {
                    case '_ClickedButton': // Internal only. Do not use. Used by JS above to keep track of clicked button.
                        try {
                            $this->strClickedButtonId = QType::Cast($mixValue, QType::String);
    Severity: Major
    Found in includes/base_controls/QDialogBase.class.php - About 3 hrs to fix

      Method AddButton has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              public function AddButton ($strButtonName, $strButtonId = null, $blnCausesValidation = false, $blnIsPrimary = false, $strConfirmation = null, $options = null) {
                  if (!$this->mixButtons) {
                      $this->mixButtons = array();
                  }
                  $strJS = '';
      Severity: Minor
      Found in includes/base_controls/QDialogBase.class.php - About 1 hr to fix

        Method Alert has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                public static function Alert($strMessage, $strButtons = null, $strControlId = null) {
                    global $_FORM;
        
                    $dlg = new QDialog(null, $strControlId);
                    $dlg->Modal = true;
        Severity: Minor
        Found in includes/base_controls/QDialogBase.class.php - About 1 hr to fix

          Function Alert has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

                  public static function Alert($strMessage, $strButtons = null, $strControlId = null) {
                      global $_FORM;
          
                      $dlg = new QDialog(null, $strControlId);
                      $dlg->Modal = true;
          Severity: Minor
          Found in includes/base_controls/QDialogBase.class.php - About 55 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 AddButton has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  public function AddButton ($strButtonName, $strButtonId = null, $blnCausesValidation = false, $blnIsPrimary = false, $strConfirmation = null, $options = null) {
          Severity: Minor
          Found in includes/base_controls/QDialogBase.class.php - About 45 mins to fix

            Function ValidateControlAndChildren has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                    public function ValidateControlAndChildren() {
                        if ($this->blnIsOpen) {    // don't validate a closed dialog
                            if (!empty($this->mixButtons)) {    // using built-in dialog buttons
                                if (!empty ($this->blnValidationArray[$this->strClickedButtonId])) {
                                    return parent::ValidateControlAndChildren();
            Severity: Minor
            Found in includes/base_controls/QDialogBase.class.php - About 35 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 18. The configured cyclomatic complexity threshold is 10.
            Open

                    public function __set($strName, $mixValue) {
                        switch ($strName) {
                            case '_ClickedButton': // Internal only. Do not use. Used by JS above to keep track of clicked button.
                                try {
                                    $this->strClickedButtonId = QType::Cast($mixValue, QType::String);

            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

            Missing class import via use statement (line '231', column '33').
            Open

                            $jqOptions['create'] =  new QJsClosure($strCreateJs);

            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 '121', column '26').
            Open

                            $this->AddAction(new QDialog_CloseEvent(10), new QAjaxControlAction($this, 'dialog_Close'));

            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 '220', column '29').
            Open

                        $jqOptions['open'] = new QJsClosure (

            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 '121', column '54').
            Open

                            $this->AddAction(new QDialog_CloseEvent(10), new QAjaxControlAction($this, 'dialog_Close'));

            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 AddButton has a boolean flag argument $blnCausesValidation, which is a certain sign of a Single Responsibility Principle violation.
            Open

                    public function AddButton ($strButtonName, $strButtonId = null, $blnCausesValidation = false, $blnIsPrimary = false, $strConfirmation = null, $options = null) {

            BooleanArgumentFlag

            Since: 1.4.0

            A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

            Example

            class Foo {
                public function bar($flag = true) {
                }
            }

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

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

                            'click'=>new QJsNoQuoteKey(new QJsClosure($strJS, array ('event'))),

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

                        $this->mixButtons[$strButtonName] = new QJsClosure('$j(this).dialog("close")');

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

                        $jqOptions['close'] = new QJsClosure (sprintf (

            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 AddButton has a boolean flag argument $blnIsPrimary, which is a certain sign of a Single Responsibility Principle violation.
            Open

                    public function AddButton ($strButtonName, $strButtonId = null, $blnCausesValidation = false, $blnIsPrimary = false, $strConfirmation = null, $options = null) {

            BooleanArgumentFlag

            Since: 1.4.0

            A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

            Example

            class Foo {
                public function bar($flag = true) {
                }
            }

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

            Missing class import via use statement (line '276', column '36').
            Open

                            'click'=>new QJsNoQuoteKey(new QJsClosure($strJS, array ('event'))),

            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 '382', column '15').
            Open

                        $dlg = new QDialog(null, $strControlId);

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

                                    } else {
                                        parent::__set($strName, $mixValue);
                                    }

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

                        } else {
                            QApplication::ExecuteJavaScript(
                                sprintf ('$j("#%s").next().find("button[data-btnid=\'%s\']").hide();',
                                    $this->getJqControlId(), $strButtonId)
                            );

            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 'ShowHideButton'.
            Open

                            QApplication::ExecuteJavaScript(
                                sprintf ('$j("#%s").next().find("button[data-btnid=\'%s\']").hide();',
                                    $this->getJqControlId(), $strButtonId)
                            );

            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->blnHasCloseButton = QType::Cast($mixValue, QType::Boolean);

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

                        else {
                            $strHideCloseButtonScript = '';
                        }

            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 'JavaScriptHelper' in method 'SetButtonStyle'.
            Open

                            sprintf ('$j("#%s").next().find("button[data-btnid=\'%s\']").css(%s)', $this->getJqControlId(), $strButtonId, JavaScriptHelper::toJsObject($styles))

            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 'Close'.
            Open

                        QApplication::ExecuteControlCommand($this->getJqControlId(), $this->getJqSetupFunction(), "close", QJsPriority::Last);

            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 '230', column '8').
            Open

                    protected function MakeJqOptions() {
                        $jqOptions = parent::MakeJqOptions();
            
                        $controlId = $this->ControlId;
                        $strFormId = $this->Form->FormId;

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

                            else {
                                $strButton = array_shift($strButtons);
                                $dlg->AddButton($strButton, null, false, true);    // primary button
            
                                foreach ($strButtons as $strButton) {

            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 'QType' in method '__set'.
            Open

                                    $this->blnIsOpen = QType::Cast($mixValue, QType::Boolean);

            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 'SetButtonStyle'.
            Open

                        QApplication::ExecuteJavaScript(
                            sprintf ('$j("#%s").next().find("button[data-btnid=\'%s\']").css(%s)', $this->getJqControlId(), $strButtonId, JavaScriptHelper::toJsObject($styles))
                        );

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

                            } else {    // using QButtons placed in the control
                                return parent::ValidateControlAndChildren();
                            }

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

                        } else {
                            $dlg->blnHasCloseButton = true;
                            $dlg->Height = 100; // fix problem with jquery ui dialog making space for buttons that don't exist
                        }

            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 'ShowHideButton'.
            Open

                            QApplication::ExecuteJavaScript(
                                sprintf ('$j("#%s").next().find("button[data-btnid=\'%s\']").show();',
                                    $this->getJqControlId(), $strButtonId)
                            );

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

                        else {
                            $this->blnDisplay = 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

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

                        QApplication::ExecuteJsFunction('qc.dialog', $strControlId, QJsPriority::High);

            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->strClickedButtonId = 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 {
                                        parent::__set($strName, $mixValue);
                                    }

            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 unused parameters such as '$strFormId'.
            Open

                    public function dialog_Close($strFormId, $strControlId, $strParameter) {

            UnusedFormalParameter

            Since: 0.2

            Avoid passing parameters to methods or constructors and then not using those parameters.

            Example

            class Foo
            {
                private function bar($howdy)
                {
                    // $howdy is not used
                }
            }

            Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

            Avoid unused parameters such as '$strParameter'.
            Open

                    public function dialog_Close($strFormId, $strControlId, $strParameter) {

            UnusedFormalParameter

            Since: 0.2

            Avoid passing parameters to methods or constructors and then not using those parameters.

            Example

            class Foo
            {
                private function bar($howdy)
                {
                    // $howdy is not used
                }
            }

            Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

            Avoid unused parameters such as '$strControlId'.
            Open

                    public function dialog_Close($strFormId, $strControlId, $strParameter) {

            UnusedFormalParameter

            Since: 0.2

            Avoid passing parameters to methods or constructors and then not using those parameters.

            Example

            class Foo
            {
                private function bar($howdy)
                {
                    // $howdy is not used
                }
            }

            Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

            Avoid unused local variables such as '$_FORM'.
            Open

                        global $_FORM;

            UnusedLocalVariable

            Since: 0.2

            Detects when a local variable is declared and/or assigned, but not used.

            Example

            class Foo {
                public function doSomething()
                {
                    $i = 5; // Unused
                }
            }

            Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

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

                            $strHideCloseButtonScript = '$j(this).prev().find(".ui-dialog-titlebar-close").hide();';

            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 class QDialog_ButtonEvent is not named in CamelCase.
            Open

                class QDialog_ButtonEvent extends QEvent {
                    /** Event Name */
                    const EventName = 'QDialog_Button';
                    const JsReturnParam = 'ui'; // ends up being the button id
                }

            CamelCaseClassName

            Since: 0.2

            It is considered best practice to use the CamelCase notation to name classes.

            Example

            class class_name {
            }

            Source

            Avoid variables with short names like $a. Configured minimum length is 3.
            Open

                            $this->mixButtons = array_filter ($this->mixButtons, function ($a) use ($strButtonId) {return $a['id'] == $strButtonId;});

            ShortVariable

            Since: 0.2

            Detects when a field, local, or parameter has a very short name.

            Example

            class Something {
                private $q = 15; // VIOLATION - Field
                public static function main( array $as ) { // VIOLATION - Formal
                    $r = 20 + $this->q; // VIOLATION - Local
                    for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                        $r += $this->q;
                    }
                }
            }

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

            Constant StateHighlight should be defined in uppercase
            Open

                    const StateHighlight = 'ui-state-highlight';

            ConstantNamingConventions

            Since: 0.2

            Class/Interface constant names should always be defined in uppercase.

            Example

            class Foo {
                const MY_NUM = 0; // ok
                const myTest = ""; // fail
            }

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

            Constant MessageDialogId should be defined in uppercase
            Open

                    const MessageDialogId = 'qAlertDialog';

            ConstantNamingConventions

            Since: 0.2

            Class/Interface constant names should always be defined in uppercase.

            Example

            class Foo {
                const MY_NUM = 0; // ok
                const myTest = ""; // fail
            }

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

            Constant StateNone should be defined in uppercase
            Open

                    const StateNone = '';

            ConstantNamingConventions

            Since: 0.2

            Class/Interface constant names should always be defined in uppercase.

            Example

            class Foo {
                const MY_NUM = 0; // ok
                const myTest = ""; // fail
            }

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

            Constant JsReturnParam should be defined in uppercase
            Open

                    const JsReturnParam = 'ui'; // ends up being the button id

            ConstantNamingConventions

            Since: 0.2

            Class/Interface constant names should always be defined in uppercase.

            Example

            class Foo {
                const MY_NUM = 0; // ok
                const myTest = ""; // fail
            }

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

            Constant EventName should be defined in uppercase
            Open

                    const EventName = 'QDialog_Button';

            ConstantNamingConventions

            Since: 0.2

            Class/Interface constant names should always be defined in uppercase.

            Example

            class Foo {
                const MY_NUM = 0; // ok
                const myTest = ""; // fail
            }

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

            Constant StateError should be defined in uppercase
            Open

                    const StateError = 'ui-state-error';

            ConstantNamingConventions

            Since: 0.2

            Class/Interface constant names should always be defined in uppercase.

            Example

            class Foo {
                const MY_NUM = 0; // ok
                const myTest = ""; // fail
            }

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

            The variable $_FORM is not named in camelCase.
            Open

                    public function __construct($objParentObject = null, $strControlId = null) {
                        // Detect which mode we are going to display in, whether to show right away, or wait for later.
                        if ($objParentObject === null) {
                            // The dialog will be shown right away, and then when closed, removed from the form.
                            global $_FORM;

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

                    public function __construct($objParentObject = null, $strControlId = null) {
                        // Detect which mode we are going to display in, whether to show right away, or wait for later.
                        if ($objParentObject === null) {
                            // The dialog will be shown right away, and then when closed, removed from the form.
                            global $_FORM;

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

                    public static function Alert($strMessage, $strButtons = null, $strControlId = null) {
                        global $_FORM;
            
                        $dlg = new QDialog(null, $strControlId);
                        $dlg->Modal = true;

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

                    protected function StylingJs() {
                        $strJs = '';
                        if ($this->strDialogState) {
                            // Move the dialog class to the header of dialog to improve the appearance over the default.
                            // Also add an appropriate icon.

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

                    public function RemoveAllButtons() {
                        $this->mixButtons = array();
                        $this->blnValidationArray = array();
                        $this->blnModified = true;
                    }

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

                    public function AddCloseButton ($strButtonName) {
                        // This is an alternate button format supported by jQuery UI.
                        $this->mixButtons[$strButtonName] = new QJsClosure('$j(this).dialog("close")');
                    }

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

                    public static function Alert($strMessage, $strButtons = null, $strControlId = null) {
                        global $_FORM;
            
                        $dlg = new QDialog(null, $strControlId);
                        $dlg->Modal = true;

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

                    public function RemoveButton ($strButtonId) {
                        if (!empty($this->mixButtons)) {
                            $this->mixButtons = array_filter ($this->mixButtons, function ($a) use ($strButtonId) {return $a['id'] == $strButtonId;});
                        }
            
            

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

                    public function dialog_Close($strFormId, $strControlId, $strParameter) {
                        $this->Form->RemoveControl($this->ControlId);
                    }

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

                    public function AddButton ($strButtonName, $strButtonId = null, $blnCausesValidation = false, $blnIsPrimary = false, $strConfirmation = null, $options = null) {
                        if (!$this->mixButtons) {
                            $this->mixButtons = array();
                        }
                        $strJS = '';

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

                    public function ValidateControlAndChildren() {
                        if ($this->blnIsOpen) {    // don't validate a closed dialog
                            if (!empty($this->mixButtons)) {    // using built-in dialog buttons
                                if (!empty ($this->blnValidationArray[$this->strClickedButtonId])) {
                                    return parent::ValidateControlAndChildren();

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

                    protected function MakeJqOptions() {
                        $jqOptions = parent::MakeJqOptions();
            
                        $controlId = $this->ControlId;
                        $strFormId = $this->Form->FormId;

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

                    public function HideDialogBox() {
                        $this->Close();
                    }

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

                    public function GetEndScript() {
                        $strJS = parent::GetEndScript();
                        $strControlId = $this->GetJqControlId();
                        QApplication::ExecuteJsFunction('qc.dialog', $strControlId, QJsPriority::High);
            
            

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

                    public function ShowHideButton ($strButtonId, $blnVisible) {
                        if ($blnVisible) {
                            QApplication::ExecuteJavaScript(
                                sprintf ('$j("#%s").next().find("button[data-btnid=\'%s\']").show();',
                                    $this->getJqControlId(), $strButtonId)

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

                    public function Close() {
                        QApplication::ExecuteControlCommand($this->getJqControlId(), $this->getJqSetupFunction(), "close", QJsPriority::Last);
                    }

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

                    public function SetButtonStyle ($strButtonId, $styles) {
                        QApplication::ExecuteJavaScript(
                            sprintf ('$j("#%s").next().find("button[data-btnid=\'%s\']").css(%s)', $this->getJqControlId(), $strButtonId, JavaScriptHelper::toJsObject($styles))
                        );
                    }

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

                    public function Open() {
                        $this->Visible = true;
                        $this->Display = true;
                        parent::Open();
                    }

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

                    public function ShowDialogBox() {
                        $this->Open();
                    }

            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