mambax7/myconference

View on GitHub
class/Common/choicebyletter.php

Summary

Maintainability
B
4 hrs
Test Coverage

render accesses the super-global variable $GLOBALS.
Open

    public function render()
    {
        $ret = '';
        //
        if (!$this->caseSensitive) {
Severity: Minor
Found in class/Common/choicebyletter.php by phpmd

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

render accesses the super-global variable $GLOBALS.
Open

    public function render()
    {
        $ret = '';
        //
        if (!$this->caseSensitive) {
Severity: Minor
Found in class/Common/choicebyletter.php by phpmd

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

render accesses the super-global variable $GLOBALS.
Open

    public function render()
    {
        $ret = '';
        //
        if (!$this->caseSensitive) {
Severity: Minor
Found in class/Common/choicebyletter.php by phpmd

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

render accesses the super-global variable $GLOBALS.
Open

    public function render()
    {
        $ret = '';
        //
        if (!$this->caseSensitive) {
Severity: Minor
Found in class/Common/choicebyletter.php by phpmd

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

__construct accesses the super-global variable $_SERVER.
Open

    public function __construct(
        $objHandler,
        $criteria = null,
        $field_name = null,
        $alphabet = [],
Severity: Minor
Found in class/Common/choicebyletter.php by phpmd

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

render accesses the super-global variable $GLOBALS.
Open

    public function render()
    {
        $ret = '';
        //
        if (!$this->caseSensitive) {
Severity: Minor
Found in class/Common/choicebyletter.php by phpmd

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 render has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function render()
    {
        $ret = '';
        //
        if (!$this->caseSensitive) {
Severity: Minor
Found in class/Common/choicebyletter.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

Method render has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function render()
    {
        $ret = '';
        //
        if (!$this->caseSensitive) {
Severity: Minor
Found in class/Common/choicebyletter.php - About 1 hr to fix

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

            $objHandler,
            $criteria = null,
            $field_name = null,
            $alphabet = [],
            $arg_name = 'letter',
    Severity: Major
    Found in class/Common/choicebyletter.php - About 1 hr to fix

      Missing class import via use statement (line '81', column '55').
      Open

              $this->criteria    = null === $criteria ? new \CriteriaCompo() : $criteria;
      Severity: Minor
      Found in class/Common/choicebyletter.php by phpmd

      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 '141', column '43').
      Open

              $choiceByLetterTpl          = new \XoopsTpl();
      Severity: Minor
      Found in class/Common/choicebyletter.php by phpmd

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

              $caseSensitive = false
      Severity: Minor
      Found in class/Common/choicebyletter.php by phpmd

      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 '138', column '39').
      Open

                  $GLOBALS['xoTheme'] = new \xos_opal_Theme();
      Severity: Minor
      Found in class/Common/choicebyletter.php by phpmd

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

                  } else {
                      if (isset($countsByLetters[$letter])) {
                          $letter_array['letter'] = $letter;
                          $letter_array['count']  = $countsByLetters[$letter];
                          $letter_array['url']    = $this->url . '?' . $this->arg_name . '=' . $letter . $this->extra;
      Severity: Minor
      Found in class/Common/choicebyletter.php by phpmd

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

                      } else {
                          $letter_array['letter'] = $letter;
                          $letter_array['count']  = 0;
                          $letter_array['url']    = '';
                      }
      Severity: Minor
      Found in class/Common/choicebyletter.php by phpmd

      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 'WfdownloadsWfdownloads' in method '__construct'.
      Open

              $this->wfdownloads = WfdownloadsWfdownloads::getInstance();
      Severity: Minor
      Found in class/Common/choicebyletter.php by phpmd

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

                      } else {
                          $letter_array['letter'] = $letter;
                          $letter_array['count']  = 0;
                          $letter_array['url']    = '';
                      }
      Severity: Minor
      Found in class/Common/choicebyletter.php by phpmd

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

              } else {
                  $this->criteria->setGroupBy('LEFT(' . $this->field_name . ',1)');
              }
      Severity: Minor
      Found in class/Common/choicebyletter.php by phpmd

      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

      Each class must be in a namespace of at least one level (a top-level vendor name)
      Open

      class WfdownloadsChoiceByLetter

      The parameter $arg_name is not named in camelCase.
      Open

          public function __construct(
              $objHandler,
              $criteria = null,
              $field_name = null,
              $alphabet = [],
      Severity: Minor
      Found in class/Common/choicebyletter.php by phpmd

      CamelCaseParameterName

      Since: 0.2

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

      Example

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

      Source

      The property $field_name is not named in camelCase.
      Open

      class WfdownloadsChoiceByLetter
      {
          /**
           * @var WfdownloadsWfdownloads
           * @access public
      Severity: Minor
      Found in class/Common/choicebyletter.php by phpmd

      CamelCasePropertyName

      Since: 0.2

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

      Example

      class ClassName {
          protected $property_name;
      }

      Source

      The parameter $field_name is not named in camelCase.
      Open

          public function __construct(
              $objHandler,
              $criteria = null,
              $field_name = null,
              $alphabet = [],
      Severity: Minor
      Found in class/Common/choicebyletter.php by phpmd

      CamelCaseParameterName

      Since: 0.2

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

      Example

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

      Source

      The parameter $extra_arg is not named in camelCase.
      Open

          public function __construct(
              $objHandler,
              $criteria = null,
              $field_name = null,
              $alphabet = [],
      Severity: Minor
      Found in class/Common/choicebyletter.php by phpmd

      CamelCaseParameterName

      Since: 0.2

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

      Example

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

      Source

      The property $arg_name is not named in camelCase.
      Open

      class WfdownloadsChoiceByLetter
      {
          /**
           * @var WfdownloadsWfdownloads
           * @access public
      Severity: Minor
      Found in class/Common/choicebyletter.php by phpmd

      CamelCasePropertyName

      Since: 0.2

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

      Example

      class ClassName {
          protected $property_name;
      }

      Source

      A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 31 and the first side effect is on line 25.
      Open

      <?php

      Line exceeds 120 characters; contains 124 characters
      Open

              $this->alphabet    = (count($alphabet) > 0) ? $alphabet : range('a', 'z'); // is there a way to get locale alphabet?

      The variable $field_name is not named in camelCase.
      Open

          public function __construct(
              $objHandler,
              $criteria = null,
              $field_name = null,
              $alphabet = [],
      Severity: Minor
      Found in class/Common/choicebyletter.php by phpmd

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

          public function __construct(
              $objHandler,
              $criteria = null,
              $field_name = null,
              $alphabet = [],
      Severity: Minor
      Found in class/Common/choicebyletter.php by phpmd

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

          public function __construct(
              $objHandler,
              $criteria = null,
              $field_name = null,
              $alphabet = [],
      Severity: Minor
      Found in class/Common/choicebyletter.php by phpmd

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

          public function render()
          {
              $ret = '';
              //
              if (!$this->caseSensitive) {
      Severity: Minor
      Found in class/Common/choicebyletter.php by phpmd

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

          public function render()
          {
              $ret = '';
              //
              if (!$this->caseSensitive) {
      Severity: Minor
      Found in class/Common/choicebyletter.php by phpmd

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

          public function render()
          {
              $ret = '';
              //
              if (!$this->caseSensitive) {
      Severity: Minor
      Found in class/Common/choicebyletter.php by phpmd

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

          public function render()
          {
              $ret = '';
              //
              if (!$this->caseSensitive) {
      Severity: Minor
      Found in class/Common/choicebyletter.php by phpmd

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

          public function render()
          {
              $ret = '';
              //
              if (!$this->caseSensitive) {
      Severity: Minor
      Found in class/Common/choicebyletter.php by phpmd

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

          public function render()
          {
              $ret = '';
              //
              if (!$this->caseSensitive) {
      Severity: Minor
      Found in class/Common/choicebyletter.php by phpmd

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

          public function __construct(
              $objHandler,
              $criteria = null,
              $field_name = null,
              $alphabet = [],
      Severity: Minor
      Found in class/Common/choicebyletter.php by phpmd

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

          public function __construct(
              $objHandler,
              $criteria = null,
              $field_name = null,
              $alphabet = [],
      Severity: Minor
      Found in class/Common/choicebyletter.php by phpmd

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

          public function render()
          {
              $ret = '';
              //
              if (!$this->caseSensitive) {
      Severity: Minor
      Found in class/Common/choicebyletter.php by phpmd

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

          public function render()
          {
              $ret = '';
              //
              if (!$this->caseSensitive) {
      Severity: Minor
      Found in class/Common/choicebyletter.php by phpmd

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

          public function render()
          {
              $ret = '';
              //
              if (!$this->caseSensitive) {
      Severity: Minor
      Found in class/Common/choicebyletter.php by phpmd

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

          public function render()
          {
              $ret = '';
              //
              if (!$this->caseSensitive) {
      Severity: Minor
      Found in class/Common/choicebyletter.php by phpmd

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

          public function render()
          {
              $ret = '';
              //
              if (!$this->caseSensitive) {
      Severity: Minor
      Found in class/Common/choicebyletter.php by phpmd

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

          public function render()
          {
              $ret = '';
              //
              if (!$this->caseSensitive) {
      Severity: Minor
      Found in class/Common/choicebyletter.php by phpmd

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

          public function render()
          {
              $ret = '';
              //
              if (!$this->caseSensitive) {
      Severity: Minor
      Found in class/Common/choicebyletter.php by phpmd

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

          public function render()
          {
              $ret = '';
              //
              if (!$this->caseSensitive) {
      Severity: Minor
      Found in class/Common/choicebyletter.php by phpmd

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

          public function __construct(
              $objHandler,
              $criteria = null,
              $field_name = null,
              $alphabet = [],
      Severity: Minor
      Found in class/Common/choicebyletter.php by phpmd

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

          public function render()
          {
              $ret = '';
              //
              if (!$this->caseSensitive) {
      Severity: Minor
      Found in class/Common/choicebyletter.php by phpmd

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

          public function render()
          {
              $ret = '';
              //
              if (!$this->caseSensitive) {
      Severity: Minor
      Found in class/Common/choicebyletter.php by phpmd

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

          public function render()
          {
              $ret = '';
              //
              if (!$this->caseSensitive) {
      Severity: Minor
      Found in class/Common/choicebyletter.php by phpmd

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

          public function __construct(
              $objHandler,
              $criteria = null,
              $field_name = null,
              $alphabet = [],
      Severity: Minor
      Found in class/Common/choicebyletter.php by phpmd

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

          public function render()
          {
              $ret = '';
              //
              if (!$this->caseSensitive) {
      Severity: Minor
      Found in class/Common/choicebyletter.php by phpmd

      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

      There are no issues that match your filters.

      Category
      Status