qcubed/framework

View on GitHub
includes/codegen/QModelConnectorEditDlg.class.php

Summary

Maintainability
D
2 days
Test Coverage

ButtonClick accesses the super-global variable $_SERVER.
Open

    public function ButtonClick ($strFormId, $strControlId, $mixParam) {
        if ($mixParam == 'save') {
            $this->UpdateControlInfo();
            $this->WriteParams();
        } elseif ($mixParam == 'saveRefresh') {

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

Function SetupTabs has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    protected function SetupTabs() {
        $strClassNames = $this->CreateClassNameArray();
        $this->tabs->RemoveChildControls(true);
        $this->categories = array();

Severity: Minor
Found in includes/codegen/QModelConnectorEditDlg.class.php - About 4 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

Function CreateClassNameArray has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    protected function CreateClassNameArray() {
        // create the control array
        $controls = array();
        include (__QCUBED_CORE__ . '/control_registry.inc.php');

Severity: Minor
Found in includes/codegen/QModelConnectorEditDlg.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

Method SetupTabs has 87 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function SetupTabs() {
        $strClassNames = $this->CreateClassNameArray();
        $this->tabs->RemoveChildControls(true);
        $this->categories = array();

Severity: Major
Found in includes/codegen/QModelConnectorEditDlg.class.php - About 3 hrs to fix

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

    class QModelConnectorEditDlg extends QDialog {
        /** @var  QControl */
        protected $objCurrentControl;
    
        protected $tabs;

    Function UpdateControlInfo has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function UpdateControlInfo() {
            $objParams = $this->generalOptions;
            foreach ($objParams as $objParam) {
                $objControl = $objParam->GetControl ($this->dtgGeneralOptions);
                $strName = $objControl->Name;
    Severity: Minor
    Found in includes/codegen/QModelConnectorEditDlg.class.php - About 2 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 QModelConnectorEditDlg.class.php has 256 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    require(__QCUBED__ . '/codegen/QCodeGen.class.php');
    include (__QCUBED_CORE__ . '/codegen/controls/_class_paths.inc.php');
    
    
    Severity: Minor
    Found in includes/codegen/QModelConnectorEditDlg.class.php - About 2 hrs to fix

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

          protected function CreateClassNameArray() {
              // create the control array
              $controls = array();
              include (__QCUBED_CORE__ . '/control_registry.inc.php');
      
      
      Severity: Minor
      Found in includes/codegen/QModelConnectorEditDlg.class.php - About 1 hr to fix

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

            protected function UpdateControlInfo() {
                $objParams = $this->generalOptions;
                foreach ($objParams as $objParam) {
                    $objControl = $objParam->GetControl ($this->dtgGeneralOptions);
                    $strName = $objControl->Name;
        Severity: Minor
        Found in includes/codegen/QModelConnectorEditDlg.class.php - About 1 hr to fix

          The method CreateClassNameArray() has an NPath complexity of 378. The configured NPath complexity threshold is 200.
          Open

              protected function CreateClassNameArray() {
                  // create the control array
                  $controls = array();
                  include (__QCUBED_CORE__ . '/control_registry.inc.php');
          
          

          NPathComplexity

          Since: 0.1

          The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

          Example

          class Foo {
              function bar() {
                  // lots of complicated code
              }
          }

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

          The method SetupTabs() has an NPath complexity of 640. The configured NPath complexity threshold is 200.
          Open

              protected function SetupTabs() {
                  $strClassNames = $this->CreateClassNameArray();
                  $this->tabs->RemoveChildControls(true);
                  $this->categories = array();
          
          

          NPathComplexity

          Since: 0.1

          The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

          Example

          class Foo {
              function bar() {
                  // lots of complicated code
              }
          }

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

          The method SetupTabs() has 122 lines of code. Current threshold is set to 100. Avoid really long methods.
          Open

              protected function SetupTabs() {
                  $strClassNames = $this->CreateClassNameArray();
                  $this->tabs->RemoveChildControls(true);
                  $this->categories = array();
          
          

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

              protected function CreateClassNameArray() {
                  // create the control array
                  $controls = array();
                  include (__QCUBED_CORE__ . '/control_registry.inc.php');
          
          

          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

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

              protected function SetupTabs() {
                  $strClassNames = $this->CreateClassNameArray();
                  $this->tabs->RemoveChildControls(true);
                  $this->categories = array();
          
          

          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 '$a' which will lead to PHP notices.
          Open

                      return $a;

          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 '$a' which will lead to PHP notices.
          Open

                          $a[$strClassName] = $strClassName;    // remove duplicates

          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

          The class QModelConnectorEditDlg has a coupling between objects value of 14. Consider to reduce the number of dependencies under 13.
          Open

          class QModelConnectorEditDlg extends QDialog {
              /** @var  QControl */
              protected $objCurrentControl;
          
              protected $tabs;

          CouplingBetweenObjects

          Since: 1.1.0

          A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

          Example

          class Foo {
              /**
               * @var \foo\bar\X
               */
              private $x = null;
          
              /**
               * @var \foo\bar\Y
               */
              private $y = null;
          
              /**
               * @var \foo\bar\Z
               */
              private $z = null;
          
              public function setFoo(\Foo $foo) {}
              public function setBar(\Bar $bar) {}
              public function setBaz(\Baz $baz) {}
          
              /**
               * @return \SplObjectStorage
               * @throws \OutOfRangeException
               * @throws \InvalidArgumentException
               * @throws \ErrorException
               */
              public function process(\Iterator $it) {}
          
              // ...
          }

          Source https://phpmd.org/rules/design.html#couplingbetweenobjects

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

                          new QModelConnectorParam (QModelConnectorParam::GeneralCategory, 'FormGen',

          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 '61', column '51').
          Open

                  $this->AddAction(new QDialog_ButtonEvent(), new QAjaxControlAction($this, 'ButtonClick'));

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

                          new QModelConnectorParam (QModelConnectorParam::GeneralCategory, 'ControlClass', 'Override of the PHP type for the control. If you change this, save the dialog and reopen to reload the tabs to show the control specific options.', QModelConnectorParam::SelectionList, $strClassNames),

          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 '72', column '34').
          Open

                  $this->dtgGeneralOptions = new QHtmlTable($this->tabs);

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

                          new QModelConnectorParam (QModelConnectorParam::GeneralCategory, 'EditMode',

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

                          new QModelConnectorParam (QModelConnectorParam::GeneralCategory, 'Name', 'The Control\'s Name. Generally leave this blank, or use a plural name.', QType::String),

          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 '50', column '19').
          Open

                  $objPanel = new QPanel($this);    // This is a kind of bug fix, to fix a unique problem when putting tabs in a dialog

          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 '48', column '41').
          Open

                  $this->objModelConnectorOptions = new QModelConnectorOptions();

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

                  $this->tabs = new QTabs ($objPanel, 'qconnectoreditTabs');

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

                          new QModelConnectorParam (QModelConnectorParam::GeneralCategory, 'Name', 'Control\'s Name', QType::String),

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

                          new QModelConnectorParam (QModelConnectorParam::GeneralCategory, 'ControlClass', 'Override of the PHP type for the control. If you change this, save the dialog and reopen to reload the tabs to show the control specific options.', QModelConnectorParam::SelectionList, $strClassNames),

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

                          new QModelConnectorParam (QModelConnectorParam::GeneralCategory, 'ItemName', 'The public name of an item in the list. Its used by the title of the edit form, for example. Defaults to the name of the table in the database.', QType::String),

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

                      $dtg = new QHtmlTable($this->tabs);

          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 '61', column '24').
          Open

                  $this->AddAction(new QDialog_ButtonEvent(), new QAjaxControlAction($this, 'ButtonClick'));

          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 '76', column '51').
          Open

                  $col = $this->dtgGeneralOptions->AddColumn (new QHtmlTableCallableColumn('Attribute', array ($this, 'dtg_ValueRender'), $this->dtgGeneralOptions));

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

                          new QModelConnectorParam (QModelConnectorParam::GeneralCategory, 'NoColumn', 'True to prevent a column in the lister from being generated.', QType::Boolean)

          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 '167', column '32').
          Open

                      $col = $dtg->AddColumn (new QHtmlTableCallableColumn('Attribute', array ($this, 'dtg_ValueRender'), $dtg));

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

                          new QModelConnectorParam (QModelConnectorParam::GeneralCategory, 'CreateFilter', 'Whether to generate a separate control to filter the data. If the data list control does its own filtering, set this to false. Default is true.', QType::Boolean),

          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 'QApplication' in method 'ButtonClick'.
          Open

                      QApplication::Redirect($_SERVER['PHP_SELF']);

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

                      } else {
                          // Table options
                          $this->objModelConnectorOptions->SetOptions ($node->_ClassName, QModelConnectorOptions::TableOptionsFieldName, $this->params);
                          $this->objModelConnectorOptions->Save();
                      }

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

                  } else {
                      return null;
                  }

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

                      } else {
                          unset ($this->params[$strName]);
                      }

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

                              } else {
                                  $objControl->Value = null;
                              }

          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 'QCodeGen' in method 'ButtonClick'.
          Open

                      QCodeGen::Run(__CONFIGURATION__ . '/codegen_settings.xml');

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

                          } else {
                              $objControl->Value = null;
                          }

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

                          } else {
                              unset ($this->params['Overrides'][$strName]);
                          }

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

                      else {
                          // Table options
                          $this->params = $this->objModelConnectorOptions->GetOptions ($node->_ClassName, QModelConnectorOptions::TableOptionsFieldName);
                      }

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

                      } else {
                          $objControl->Value = null;
                      }

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

                              } else {
                                  unset ($this->params['Overrides'][$strName]);
                              }

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

                      } else {
                          // A top level table, so a grid or list view
                          $type = QControlCategoryType::Table;
                      }

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

                  else {
                      // Specify general options for a database table, meaning an object that is listing the content of a whole table.
                      // These would be options at a higher level than the control itself, and would modify how the control is used in a form.
                      $this->generalOptions = array (
                          new QModelConnectorParam (QModelConnectorParam::GeneralCategory, 'ControlClass', 'Override of the PHP type for the control. If you change this, save the dialog and reopen to reload the tabs to show the control specific options.', QModelConnectorParam::SelectionList, $strClassNames),

          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 ButtonClick ($strFormId, $strControlId, $mixParam) {

          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 ButtonClick ($strFormId, $strControlId, $mixParam) {

          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 excessively long variable names like $objModelConnectorOptions. Keep variable name length under 20.
          Open

              protected $objModelConnectorOptions;

          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

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

                          $a[$strClassName] = $strClassName;    // remove duplicates

          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

          The method EditControl is not named in camelCase.
          Open

              public function EditControl (QControl $objControl) {
                  $this->objCurrentControl = $objControl;
          
                  $this->Title = $objControl->Name . ' Edit';
          
          

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

              protected function ReadParams() {
                  $node = $this->objCurrentControl->LinkedNode;
                  if ($node) {
                      if ($node->_ParentNode) {
                          $strClassName = $node->_ParentNode->_ClassName;

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

              protected function WriteParams() {
                  $node = $this->objCurrentControl->LinkedNode;
                  if ($node) {
                      if ($node->_ParentNode) {
                          $strClassName = $node->_ParentNode->_ClassName;

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

              protected function CreateClassNameArray() {
                  // create the control array
                  $controls = array();
                  include (__QCUBED_CORE__ . '/control_registry.inc.php');
          
          

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

              public function dtg_ValueRender (QModelConnectorParam $objControlParam, QControl $objParent) {
                  $objControl = $objControlParam->GetControl ($objParent);
                  return $objControl->Render(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 SetupTabs is not named in camelCase.
          Open

              protected function SetupTabs() {
                  $strClassNames = $this->CreateClassNameArray();
                  $this->tabs->RemoveChildControls(true);
                  $this->categories = 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 dtgGeneralOptions_Bind is not named in camelCase.
          Open

              public function dtgGeneralOptions_Bind() {
                  $this->dtgGeneralOptions->DataSource = $this->generalOptions;
              }

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

              protected function UpdateControlInfo() {
                  $objParams = $this->generalOptions;
                  foreach ($objParams as $objParam) {
                      $objControl = $objParam->GetControl ($this->dtgGeneralOptions);
                      $strName = $objControl->Name;

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

              public function ButtonClick ($strFormId, $strControlId, $mixParam) {
                  if ($mixParam == 'save') {
                      $this->UpdateControlInfo();
                      $this->WriteParams();
                  } elseif ($mixParam == 'saveRefresh') {

          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