YetiForceCompany/YetiForceCRM

View on GitHub
modules/IStorages/IStorages.php

Summary

Maintainability
D
2 days
Test Coverage
F
0%

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

    public function getHierarchyData($id, $iStorageInfoBase, $iStorageId, &$listviewEntries, $getRawData = false, $getLinks = true)
    {
        \App\Log::trace('Entering getHierarchyData(' . $id . ',' . $iStorageId . ') method ...');

        $hasRecordViewAccess = \App\Privilege::isPermitted('IStorages', 'DetailView', $iStorageId);
Severity: Minor
Found in modules/IStorages/IStorages.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 getParentIStorages has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function getParentIStorages($id, &$parentIStorages, &$encounteredIStorages, $depthBase = 0)
    {
        \App\Log::trace('Entering getParentIStorages(' . $id . ') method ...');

        if ($depthBase === App\Config::module('IStorages', 'MAX_HIERARCHY_DEPTH')) {
Severity: Minor
Found in modules/IStorages/IStorages.php - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

    public function getParentIStorages($id, &$parentIStorages, &$encounteredIStorages, $depthBase = 0)
    {
        \App\Log::trace('Entering getParentIStorages(' . $id . ') method ...');

        if ($depthBase === App\Config::module('IStorages', 'MAX_HIERARCHY_DEPTH')) {
Severity: Minor
Found in modules/IStorages/IStorages.php - About 1 hr to fix

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

        public function getChildIStorages($id, &$childIStorages, $depthBase)
        {
            \App\Log::trace('Entering getChildIStorages(' . $id . ',' . $depthBase . ') method ...');
    
            if (empty($id) || $depthBase === App\Config::module('IStorages', 'MAX_HIERARCHY_DEPTH')) {
    Severity: Minor
    Found in modules/IStorages/IStorages.php - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method getChildIStorages has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getChildIStorages($id, &$childIStorages, $depthBase)
        {
            \App\Log::trace('Entering getChildIStorages(' . $id . ',' . $depthBase . ') method ...');
    
            if (empty($id) || $depthBase === App\Config::module('IStorages', 'MAX_HIERARCHY_DEPTH')) {
    Severity: Minor
    Found in modules/IStorages/IStorages.php - About 1 hr to fix

      Method getHierarchyData has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getHierarchyData($id, $iStorageInfoBase, $iStorageId, &$listviewEntries, $getRawData = false, $getLinks = true)
          {
              \App\Log::trace('Entering getHierarchyData(' . $id . ',' . $iStorageId . ') method ...');
      
              $hasRecordViewAccess = \App\Privilege::isPermitted('IStorages', 'DetailView', $iStorageId);
      Severity: Minor
      Found in modules/IStorages/IStorages.php - About 1 hr to fix

        Method getHierarchyData has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public function getHierarchyData($id, $iStorageInfoBase, $iStorageId, &$listviewEntries, $getRawData = false, $getLinks = true)
        Severity: Minor
        Found in modules/IStorages/IStorages.php - About 45 mins to fix

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

              public function getHierarchyData($id, $iStorageInfoBase, $iStorageId, &$listviewEntries, $getRawData = false, $getLinks = true)
              {
                  \App\Log::trace('Entering getHierarchyData(' . $id . ',' . $iStorageId . ') method ...');
          
                  $hasRecordViewAccess = \App\Privilege::isPermitted('IStorages', 'DetailView', $iStorageId);
          Severity: Minor
          Found in modules/IStorages/IStorages.php by phpmd

          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 getParentIStorages() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
          Open

              public function getParentIStorages($id, &$parentIStorages, &$encounteredIStorages, $depthBase = 0)
              {
                  \App\Log::trace('Entering getParentIStorages(' . $id . ') method ...');
          
                  if ($depthBase === App\Config::module('IStorages', 'MAX_HIERARCHY_DEPTH')) {
          Severity: Minor
          Found in modules/IStorages/IStorages.php by phpmd

          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

          Refactor this function to reduce its Cognitive Complexity from 29 to the 15 allowed.
          Open

              public function getHierarchyData($id, $iStorageInfoBase, $iStorageId, &$listviewEntries, $getRawData = false, $getLinks = true)
          Severity: Critical
          Found in modules/IStorages/IStorages.php by sonar-php

          Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

          See

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

                  $listviewEntries[$iStorageId] = $iStorageInfoData;
          Severity: Minor
          Found in modules/IStorages/IStorages.php by phpmd

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

                          $iStorageInfoData[] = $data;
          Severity: Minor
          Found in modules/IStorages/IStorages.php by phpmd

          UndefinedVariable

          Since: 2.8.0

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

          Example

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

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

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

                  $dataReader = (new App\Db\Query())->select([
          Severity: Minor
          Found in modules/IStorages/IStorages.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 getHierarchy has a boolean flag argument $getLinks, which is a certain sign of a Single Responsibility Principle violation.
          Open

              public function getHierarchy($id, $getRawData = false, $getLinks = true)
          Severity: Minor
          Found in modules/IStorages/IStorages.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

          The method getHierarchyData has a boolean flag argument $getRawData, which is a certain sign of a Single Responsibility Principle violation.
          Open

              public function getHierarchyData($id, $iStorageInfoBase, $iStorageId, &$listviewEntries, $getRawData = false, $getLinks = true)
          Severity: Minor
          Found in modules/IStorages/IStorages.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 '260', column '23').
          Open

                      'user_name' => new \yii\db\Expression("CASE when (vtiger_users.user_name not like '') THEN $userNameSql ELSE vtiger_groups.groupname END")
          Severity: Minor
          Found in modules/IStorages/IStorages.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 '191', column '23').
          Open

                      'user_name' => new \yii\db\Expression("CASE when (vtiger_users.user_name not like '') THEN $userNameSql ELSE vtiger_groups.groupname END")
          Severity: Minor
          Found in modules/IStorages/IStorages.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 getHierarchyData has a boolean flag argument $getLinks, which is a certain sign of a Single Responsibility Principle violation.
          Open

              public function getHierarchyData($id, $iStorageInfoBase, $iStorageId, &$listviewEntries, $getRawData = false, $getLinks = true)
          Severity: Minor
          Found in modules/IStorages/IStorages.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

          The method getHierarchy has a boolean flag argument $getRawData, which is a certain sign of a Single Responsibility Principle violation.
          Open

              public function getHierarchy($id, $getRawData = false, $getLinks = true)
          Severity: Minor
          Found in modules/IStorages/IStorages.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 '188', column '15').
          Open

                  $row = (new App\Db\Query())->select([
          Severity: Minor
          Found in modules/IStorages/IStorages.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 getHierarchyData uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
          Open

                                      } else {
                                          $data = '<span>' . $data . '&nbsp;<span class="fas fa-exclamation-circle"></span></span>';
                                      }
          Severity: Minor
          Found in modules/IStorages/IStorages.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 'App\Config' in method 'getChildIStorages'.
          Open

                  $listColumns = App\Config::module('IStorages', 'COLUMNS_IN_HIERARCHY');
          Severity: Minor
          Found in modules/IStorages/IStorages.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

          Avoid using static access to class '\App\Log' in method 'getHierarchy'.
          Open

                  \App\Log::trace('Entering getHierarchy(' . $id . ') method ...');
          Severity: Minor
          Found in modules/IStorages/IStorages.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

          Avoid using static access to class '\App\Log' in method 'getHierarchy'.
          Open

                  \App\Log::trace('Exiting getHierarchy method ...');
          Severity: Minor
          Found in modules/IStorages/IStorages.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

          Avoid using static access to class 'App\Config' in method 'getParentIStorages'.
          Open

                  if ($depthBase === App\Config::module('IStorages', 'MAX_HIERARCHY_DEPTH')) {
          Severity: Minor
          Found in modules/IStorages/IStorages.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

          Avoid using static access to class '\App\Log' in method 'getParentIStorages'.
          Open

                      \App\Log::error('Exiting getParentIStorages method ... - exceeded maximum depth of hierarchy');
          Severity: Minor
          Found in modules/IStorages/IStorages.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

          Avoid using static access to class 'App\Config' in method 'getHierarchyData'.
          Open

                  $listColumns = App\Config::module('IStorages', 'COLUMNS_IN_HIERARCHY');
          Severity: Minor
          Found in modules/IStorages/IStorages.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

          Avoid using static access to class 'App\Config' in method 'getParentIStorages'.
          Open

                      $listColumns = App\Config::module('IStorages', 'COLUMNS_IN_HIERARCHY');
          Severity: Minor
          Found in modules/IStorages/IStorages.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 getChildIStorages uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
          Open

                              } else {
                                  $childIStorageInfo[$columnname] = $row[$columnname];
                              }
          Severity: Minor
          Found in modules/IStorages/IStorages.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 '\vtlib\Deprecated' in method 'getChildIStorages'.
          Open

                  $userNameSql = \vtlib\Deprecated::getSqlForNameInDisplayFormat(['first_name' => 'vtiger_users.first_name', 'last_name' => 'vtiger_users.last_name'], 'Users');
          Severity: Minor
          Found in modules/IStorages/IStorages.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

          Avoid using static access to class '\App\Privilege' in method 'getHierarchyData'.
          Open

                  $hasRecordViewAccess = \App\Privilege::isPermitted('IStorages', 'DetailView', $iStorageId);
          Severity: Minor
          Found in modules/IStorages/IStorages.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

          Avoid using static access to class '\App\Log' in method 'getChildIStorages'.
          Open

                  \App\Log::trace('Exiting getChildIStorages method ...');
          Severity: Minor
          Found in modules/IStorages/IStorages.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

          Avoid using static access to class '\App\Purifier' in method 'getHierarchyData'.
          Open

                          $data = \App\Purifier::encodeHtml($iStorageInfoBase[$colname]);
          Severity: Minor
          Found in modules/IStorages/IStorages.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 getParentIStorages uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
          Open

                          } else {
                              $parentIStorageInfo[$columnname] = $row[$columnname];
                          }
          Severity: Minor
          Found in modules/IStorages/IStorages.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 '\App\Log' in method 'getChildIStorages'.
          Open

                      \App\Log::error('Exiting getChildIStorages method ... - exceeded maximum depth of hierarchy');
          Severity: Minor
          Found in modules/IStorages/IStorages.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 getHierarchyData uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
          Open

                              } else {
                                  $data = '<strong>' . $data . '</strong>';
                              }
          Severity: Minor
          Found in modules/IStorages/IStorages.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 'App\Config' in method 'getChildIStorages'.
          Open

                  if (empty($id) || $depthBase === App\Config::module('IStorages', 'MAX_HIERARCHY_DEPTH')) {
          Severity: Minor
          Found in modules/IStorages/IStorages.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

          Avoid using static access to class '\vtlib\Deprecated' in method 'getParentIStorages'.
          Open

                  $userNameSql = \vtlib\Deprecated::getSqlForNameInDisplayFormat(['first_name' => 'vtiger_users.first_name', 'last_name' => 'vtiger_users.last_name'], 'Users');
          Severity: Minor
          Found in modules/IStorages/IStorages.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

          Avoid using static access to class 'App\Config' in method 'getHierarchy'.
          Open

                  $listColumns = App\Config::module('IStorages', 'COLUMNS_IN_HIERARCHY');
          Severity: Minor
          Found in modules/IStorages/IStorages.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

          Avoid using static access to class '\App\Log' in method 'getHierarchyData'.
          Open

                  \App\Log::trace('Entering getHierarchyData(' . $id . ',' . $iStorageId . ') method ...');
          Severity: Minor
          Found in modules/IStorages/IStorages.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

          Avoid using static access to class '\App\Language' in method 'getHierarchy'.
          Open

                          $listviewHeader[] = \App\Language::translate($fieldname);
          Severity: Minor
          Found in modules/IStorages/IStorages.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

          Avoid using static access to class '\App\Log' in method 'getParentIStorages'.
          Open

                  \App\Log::trace('Entering getParentIStorages(' . $id . ') method ...');
          Severity: Minor
          Found in modules/IStorages/IStorages.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

          Avoid using static access to class '\App\Field' in method 'getHierarchy'.
          Open

                      if (\App\Field::getFieldPermission('IStorages', $colname)) {
          Severity: Minor
          Found in modules/IStorages/IStorages.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

          Avoid using static access to class '\App\Field' in method 'getHierarchyData'.
          Open

                      if (\App\Field::getFieldPermission('IStorages', $colname)) {
          Severity: Minor
          Found in modules/IStorages/IStorages.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

          Avoid using static access to class '\App\Log' in method 'getHierarchyData'.
          Open

                  \App\Log::trace('Exiting getHierarchyData method ...');
          Severity: Minor
          Found in modules/IStorages/IStorages.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

          Avoid using static access to class '\App\Log' in method 'getParentIStorages'.
          Open

                  \App\Log::trace('Exiting __getIStorafAccounts method ...');
          Severity: Minor
          Found in modules/IStorages/IStorages.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

          Avoid using static access to class '\App\Log' in method 'getChildIStorages'.
          Open

                  \App\Log::trace('Entering getChildIStorages(' . $id . ',' . $depthBase . ') method ...');
          Severity: Minor
          Found in modules/IStorages/IStorages.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

          Define a constant instead of duplicating this literal "vtiger_crmentity" 5 times.
          Open

              public $tab_name = ['vtiger_crmentity', 'u_yf_istorages', 'u_yf_istoragescf', 'u_yf_istorages_address'];
          Severity: Critical
          Found in modules/IStorages/IStorages.php by sonar-php

          Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

          On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

          Noncompliant Code Example

          With the default threshold of 3:

          function run() {
            prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
            execute('action1');
            release('action1');
          }
          

          Compliant Solution

          ACTION_1 = 'action1';
          
          function run() {
            prepare(ACTION_1);
            execute(ACTION_1);
            release(ACTION_1);
          }
          

          Exceptions

          To prevent generating some false-positives, literals having less than 5 characters are excluded.

          Define a constant instead of duplicating this literal "subject" 8 times.
          Open

                  'FL_SUBJECT' => 'subject',
          Severity: Critical
          Found in modules/IStorages/IStorages.php by sonar-php

          Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

          On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

          Noncompliant Code Example

          With the default threshold of 3:

          function run() {
            prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
            execute('action1');
            release('action1');
          }
          

          Compliant Solution

          ACTION_1 = 'action1';
          
          function run() {
            prepare(ACTION_1);
            execute(ACTION_1);
            release(ACTION_1);
          }
          

          Exceptions

          To prevent generating some false-positives, literals having less than 5 characters are excluded.

          Define a constant instead of duplicating this literal ") method ..." 4 times.
          Open

                  \App\Log::trace('Entering getHierarchy(' . $id . ') method ...');
          Severity: Critical
          Found in modules/IStorages/IStorages.php by sonar-php

          Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

          On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

          Noncompliant Code Example

          With the default threshold of 3:

          function run() {
            prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
            execute('action1');
            release('action1');
          }
          

          Compliant Solution

          ACTION_1 = 'action1';
          
          function run() {
            prepare(ACTION_1);
            execute(ACTION_1);
            release(ACTION_1);
          }
          

          Exceptions

          To prevent generating some false-positives, literals having less than 5 characters are excluded.

          Define a constant instead of duplicating this literal "IStorages" 9 times.
          Open

                  $listColumns = App\Config::module('IStorages', 'COLUMNS_IN_HIERARCHY');
          Severity: Critical
          Found in modules/IStorages/IStorages.php by sonar-php

          Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

          On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

          Noncompliant Code Example

          With the default threshold of 3:

          function run() {
            prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
            execute('action1');
            release('action1');
          }
          

          Compliant Solution

          ACTION_1 = 'action1';
          
          function run() {
            prepare(ACTION_1);
            execute(ACTION_1);
            release(ACTION_1);
          }
          

          Exceptions

          To prevent generating some false-positives, literals having less than 5 characters are excluded.

          Define a constant instead of duplicating this literal "depth" 5 times.
          Open

                  $iStoragesList[$baseId] = $this->getChildIStorages($baseId, $iStoragesList[$baseId], $iStoragesList[$baseId]['depth']);
          Severity: Critical
          Found in modules/IStorages/IStorages.php by sonar-php

          Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

          On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

          Noncompliant Code Example

          With the default threshold of 3:

          function run() {
            prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
            execute('action1');
            release('action1');
          }
          

          Compliant Solution

          ACTION_1 = 'action1';
          
          function run() {
            prepare(ACTION_1);
            execute(ACTION_1);
            release(ACTION_1);
          }
          

          Exceptions

          To prevent generating some false-positives, literals having less than 5 characters are excluded.

          Define a constant instead of duplicating this literal "istorageid" 5 times.
          Open

              public $table_index = 'istorageid';
          Severity: Critical
          Found in modules/IStorages/IStorages.php by sonar-php

          Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

          On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

          Noncompliant Code Example

          With the default threshold of 3:

          function run() {
            prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
            execute('action1');
            release('action1');
          }
          

          Compliant Solution

          ACTION_1 = 'action1';
          
          function run() {
            prepare(ACTION_1);
            execute(ACTION_1);
            release(ACTION_1);
          }
          

          Exceptions

          To prevent generating some false-positives, literals having less than 5 characters are excluded.

          Define a constant instead of duplicating this literal "user_name" 4 times.
          Open

                      'user_name' => new \yii\db\Expression("CASE when (vtiger_users.user_name not like '') THEN $userNameSql ELSE vtiger_groups.groupname END")
          Severity: Critical
          Found in modules/IStorages/IStorages.php by sonar-php

          Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

          On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

          Noncompliant Code Example

          With the default threshold of 3:

          function run() {
            prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
            execute('action1');
            release('action1');
          }
          

          Compliant Solution

          ACTION_1 = 'action1';
          
          function run() {
            prepare(ACTION_1);
            execute(ACTION_1);
            release(ACTION_1);
          }
          

          Exceptions

          To prevent generating some false-positives, literals having less than 5 characters are excluded.

          Define a constant instead of duplicating this literal "u_yf_istorages" 3 times.
          Open

              public $table_name = 'u_yf_istorages';
          Severity: Critical
          Found in modules/IStorages/IStorages.php by sonar-php

          Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

          On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

          Noncompliant Code Example

          With the default threshold of 3:

          function run() {
            prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
            execute('action1');
            release('action1');
          }
          

          Compliant Solution

          ACTION_1 = 'action1';
          
          function run() {
            prepare(ACTION_1);
            execute(ACTION_1);
            release(ACTION_1);
          }
          

          Exceptions

          To prevent generating some false-positives, literals having less than 5 characters are excluded.

          Define a constant instead of duplicating this literal "COLUMNS_IN_HIERARCHY" 4 times.
          Open

                  $listColumns = App\Config::module('IStorages', 'COLUMNS_IN_HIERARCHY');
          Severity: Critical
          Found in modules/IStorages/IStorages.php by sonar-php

          Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

          On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

          Noncompliant Code Example

          With the default threshold of 3:

          function run() {
            prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
            execute('action1');
            release('action1');
          }
          

          Compliant Solution

          ACTION_1 = 'action1';
          
          function run() {
            prepare(ACTION_1);
            execute(ACTION_1);
            release(ACTION_1);
          }
          

          Exceptions

          To prevent generating some false-positives, literals having less than 5 characters are excluded.

          Define a constant instead of duplicating this literal "assigned_user_id" 5 times.
          Open

                  'Assigned To' => 'assigned_user_id',
          Severity: Critical
          Found in modules/IStorages/IStorages.php by sonar-php

          Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

          On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

          Noncompliant Code Example

          With the default threshold of 3:

          function run() {
            prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
            execute('action1');
            release('action1');
          }
          

          Compliant Solution

          ACTION_1 = 'action1';
          
          function run() {
            prepare(ACTION_1);
            execute(ACTION_1);
            release(ACTION_1);
          }
          

          Exceptions

          To prevent generating some false-positives, literals having less than 5 characters are excluded.

          Define a constant instead of duplicating this literal "u_yf_istoragescf" 3 times.
          Open

              public $customFieldTable = ['u_yf_istoragescf', 'istorageid'];
          Severity: Critical
          Found in modules/IStorages/IStorages.php by sonar-php

          Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

          On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

          Noncompliant Code Example

          With the default threshold of 3:

          function run() {
            prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
            execute('action1');
            release('action1');
          }
          

          Compliant Solution

          ACTION_1 = 'action1';
          
          function run() {
            prepare(ACTION_1);
            execute(ACTION_1);
            release(ACTION_1);
          }
          

          Exceptions

          To prevent generating some false-positives, literals having less than 5 characters are excluded.

          Variable $iStorageInfoData was undeclared, but array fields are being added to it.
          Open

                          $iStorageInfoData[] = $data;
          Severity: Info
          Found in modules/IStorages/IStorages.php by phan

          Call to method error from undeclared class \App\Log
          Open

                      \App\Log::error('Exiting getParentIStorages method ... - exceeded maximum depth of hierarchy');
          Severity: Critical
          Found in modules/IStorages/IStorages.php by phan

          Call to method trace from undeclared class \App\Log
          Open

                  \App\Log::trace('Entering getParentIStorages(' . $id . ') method ...');
          Severity: Critical
          Found in modules/IStorages/IStorages.php by phan

          Saw an @param annotation for depth, but it was not found in the param list of function getChildIStorages(int $id, array &$childIStorages, mixed $depthBase)
          Open

               * @param int   $depth          - Depth at which the particular storage has to be placed in the hierarchy
          Severity: Info
          Found in modules/IStorages/IStorages.php by phan

          Call to method error from undeclared class \App\Log
          Open

                      \App\Log::error('Exiting getChildIStorages method ... - exceeded maximum depth of hierarchy');
          Severity: Critical
          Found in modules/IStorages/IStorages.php by phan

          Call to method __construct from undeclared class \yii\db\Expression
          Open

                      'user_name' => new \yii\db\Expression("CASE when (vtiger_users.user_name not like '') THEN $userNameSql ELSE vtiger_groups.groupname END")
          Severity: Critical
          Found in modules/IStorages/IStorages.php by phan

          Call to method trace from undeclared class \App\Log
          Open

                  \App\Log::trace('Entering getHierarchy(' . $id . ') method ...');
          Severity: Critical
          Found in modules/IStorages/IStorages.php by phan

          Call to method trace from undeclared class \App\Log
          Open

                  \App\Log::trace('Exiting __getIStorafAccounts method ...');
          Severity: Critical
          Found in modules/IStorages/IStorages.php by phan

          Call to method __construct from undeclared class \yii\db\Expression
          Open

                      'user_name' => new \yii\db\Expression("CASE when (vtiger_users.user_name not like '') THEN $userNameSql ELSE vtiger_groups.groupname END")
          Severity: Critical
          Found in modules/IStorages/IStorages.php by phan

          Call to method trace from undeclared class \App\Log
          Open

                  \App\Log::trace('Exiting getHierarchyData method ...');
          Severity: Critical
          Found in modules/IStorages/IStorages.php by phan

          Call to method trace from undeclared class \App\Log
          Open

                  \App\Log::trace('Entering getChildIStorages(' . $id . ',' . $depthBase . ') method ...');
          Severity: Critical
          Found in modules/IStorages/IStorages.php by phan

          Call to method trace from undeclared class \App\Log
          Open

                  \App\Log::trace('Exiting getHierarchy method ...');
          Severity: Critical
          Found in modules/IStorages/IStorages.php by phan

          Call to undeclared method \App\Db\Query::select
          Open

                  $row = (new App\Db\Query())->select([
          Severity: Critical
          Found in modules/IStorages/IStorages.php by phan

          Call to method trace from undeclared class \App\Log
          Open

                  \App\Log::trace('Entering getHierarchyData(' . $id . ',' . $iStorageId . ') method ...');
          Severity: Critical
          Found in modules/IStorages/IStorages.php by phan

          Call to undeclared method \App\Db\Query::select
          Open

                  $dataReader = (new App\Db\Query())->select([
          Severity: Critical
          Found in modules/IStorages/IStorages.php by phan

          Call to method trace from undeclared class \App\Log
          Open

                  \App\Log::trace('Exiting getChildIStorages method ...');
          Severity: Critical
          Found in modules/IStorages/IStorages.php by phan

          Similar blocks of code found in 4 locations. Consider refactoring.
          Open

                  foreach ($listColumns as $colname) {
                      // Permission to view storage is restricted, avoid showing field values (except storage name)
                      if (\App\Field::getFieldPermission('IStorages', $colname)) {
                          $data = \App\Purifier::encodeHtml($iStorageInfoBase[$colname]);
                          if (false === $getRawData && 'subject' === $colname) {
          Severity: Major
          Found in modules/IStorages/IStorages.php and 3 other locations - About 4 hrs to fix
          modules/HelpDesk/models/Module.php on lines 111..131
          modules/MultiCompany/MultiCompany.php on lines 125..147
          modules/Project/Project.php on lines 187..207

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 178.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                      while ($row = $dataReader->read()) {
                          $childAccId = $row['istorageid'];
                          $childIStorageInfo = [];
                          $childIStorageInfo['depth'] = $depth;
          
          
          Severity: Major
          Found in modules/IStorages/IStorages.php and 1 other location - About 1 hr to fix
          modules/Partners/Partners.php on lines 286..299

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 119.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                  $row = (new App\Db\Query())->select([
                      'u_#__istorages.*',
                      'u_#__istorages_address.*',
                      'user_name' => new \yii\db\Expression("CASE when (vtiger_users.user_name not like '') THEN $userNameSql ELSE vtiger_groups.groupname END")
                  ])
          Severity: Minor
          Found in modules/IStorages/IStorages.php and 1 other location - About 45 mins to fix
          modules/IStorages/IStorages.php on lines 257..268

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 96.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                  $dataReader = (new App\Db\Query())->select([
                      'u_#__istorages.*',
                      'u_#__istorages_address.*',
                      'user_name' => new \yii\db\Expression("CASE when (vtiger_users.user_name not like '') THEN $userNameSql ELSE vtiger_groups.groupname END")
                  ])
          Severity: Minor
          Found in modules/IStorages/IStorages.php and 1 other location - About 45 mins to fix
          modules/IStorages/IStorages.php on lines 188..199

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 96.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

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

              public $def_detailview_recname = 'subject';
          Severity: Minor
          Found in modules/IStorages/IStorages.php by phpmd

          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

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

          class IStorages extends Vtiger_CRMEntity

          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 11 and the first side effect is on line 9.
          Open

          <?php

          The property $search_fields_name is not named in camelCase.
          Open

          class IStorages extends Vtiger_CRMEntity
          {
              public $table_name = 'u_yf_istorages';
              public $table_index = 'istorageid';
          
          
          Severity: Minor
          Found in modules/IStorages/IStorages.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 property $table_name is not named in camelCase.
          Open

          class IStorages extends Vtiger_CRMEntity
          {
              public $table_name = 'u_yf_istorages';
              public $table_index = 'istorageid';
          
          
          Severity: Minor
          Found in modules/IStorages/IStorages.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 property $table_index is not named in camelCase.
          Open

          class IStorages extends Vtiger_CRMEntity
          {
              public $table_name = 'u_yf_istorages';
              public $table_index = 'istorageid';
          
          
          Severity: Minor
          Found in modules/IStorages/IStorages.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 property $list_fields_name is not named in camelCase.
          Open

          class IStorages extends Vtiger_CRMEntity
          {
              public $table_name = 'u_yf_istorages';
              public $table_index = 'istorageid';
          
          
          Severity: Minor
          Found in modules/IStorages/IStorages.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 property $default_order_by is not named in camelCase.
          Open

          class IStorages extends Vtiger_CRMEntity
          {
              public $table_name = 'u_yf_istorages';
              public $table_index = 'istorageid';
          
          
          Severity: Minor
          Found in modules/IStorages/IStorages.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

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

              public function getChildIStorages($id, &$childIStorages, $depthBase)
          Severity: Minor
          Found in modules/IStorages/IStorages.php by phpmd

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

          class IStorages extends Vtiger_CRMEntity
          {
              public $table_name = 'u_yf_istorages';
              public $table_index = 'istorageid';
          
          
          Severity: Minor
          Found in modules/IStorages/IStorages.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

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

              public function getHierarchyData($id, $iStorageInfoBase, $iStorageId, &$listviewEntries, $getRawData = false, $getLinks = true)
          Severity: Minor
          Found in modules/IStorages/IStorages.php by phpmd

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

          class IStorages extends Vtiger_CRMEntity
          {
              public $table_name = 'u_yf_istorages';
              public $table_index = 'istorageid';
          
          
          Severity: Minor
          Found in modules/IStorages/IStorages.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 property $def_basicsearch_col is not named in camelCase.
          Open

          class IStorages extends Vtiger_CRMEntity
          {
              public $table_name = 'u_yf_istorages';
              public $table_index = 'istorageid';
          
          
          Severity: Minor
          Found in modules/IStorages/IStorages.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 property $tab_name_index is not named in camelCase.
          Open

          class IStorages extends Vtiger_CRMEntity
          {
              public $table_name = 'u_yf_istorages';
              public $table_index = 'istorageid';
          
          
          Severity: Minor
          Found in modules/IStorages/IStorages.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 property $mandatory_fields is not named in camelCase.
          Open

          class IStorages extends Vtiger_CRMEntity
          {
              public $table_name = 'u_yf_istorages';
              public $table_index = 'istorageid';
          
          
          Severity: Minor
          Found in modules/IStorages/IStorages.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 property $def_detailview_recname is not named in camelCase.
          Open

          class IStorages extends Vtiger_CRMEntity
          {
              public $table_name = 'u_yf_istorages';
              public $table_index = 'istorageid';
          
          
          Severity: Minor
          Found in modules/IStorages/IStorages.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

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

              public function getParentIStorages($id, &$parentIStorages, &$encounteredIStorages, $depthBase = 0)
          Severity: Minor
          Found in modules/IStorages/IStorages.php by phpmd

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

          class IStorages extends Vtiger_CRMEntity
          {
              public $table_name = 'u_yf_istorages';
              public $table_index = 'istorageid';
          
          
          Severity: Minor
          Found in modules/IStorages/IStorages.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 property $default_sort_order is not named in camelCase.
          Open

          class IStorages extends Vtiger_CRMEntity
          {
              public $table_name = 'u_yf_istorages';
              public $table_index = 'istorageid';
          
          
          Severity: Minor
          Found in modules/IStorages/IStorages.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

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

              public function getHierarchy($id, $getRawData = false, $getLinks = true)
          Severity: Minor
          Found in modules/IStorages/IStorages.php by phpmd

          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

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * Mandatory for Saving, Include tablename and tablekey columnname here.

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  'vtiger_crmentity' => 'crmid',

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * Function to get storages hierarchy of the given Storage.

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @param bool $getRawData

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  if (empty($listColumns)) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      $listColumns = $this->list_fields_name;

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $encounteredIStorages = [$id];

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $hasRecordViewAccess = \App\Privilege::isPermitted('IStorages', 'DetailView', $iStorageId);

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public $table_name = 'u_yf_istorages';

          Spaces must be used to indent lines; tabs are not allowed
          Open

              // For Popup listview and UI type support

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  'subject' => ['istorages', 'subject'],

          Spaces must be used to indent lines; tabs are not allowed
          Open

              // Column value to use on detail view record text display

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  // Get the iStorages hierarchy (list of child iStorages) based on the current iStorage

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  // Create array of all the iStorages in the hierarchy

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * Function to create array of all the storages in the hierarchy.

          Spaces must be used to indent lines; tabs are not allowed
          Open

               */

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $listColumns = App\Config::module('IStorages', 'COLUMNS_IN_HIERARCHY');

          Spaces must be used to indent lines; tabs are not allowed
          Open

              /**

          Spaces must be used to indent lines; tabs are not allowed
          Open

               *                         returns Storage hierarchy in array format

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $iStoragesList[$baseId] = $this->getChildIStorages($baseId, $iStoragesList[$baseId], $iStoragesList[$baseId]['depth']);

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  \App\Log::trace('Exiting getHierarchy method ...');

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      $listColumns = $this->list_fields_name;

          Spaces must be used to indent lines; tabs are not allowed
          Open

               */

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  'FL_SUBJECT' => 'subject',

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public $relationFields = [];

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public $search_fields = [

          Spaces must be used to indent lines; tabs are not allowed
          Open

               */

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $iStorageHierarchy = ['header' => $listviewHeader, 'entries' => $listviewEntries];

          Spaces must be used to indent lines; tabs are not allowed
          Open

               *

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * Mandatory table for supporting custom fields.

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  'u_yf_istorages_address' => 'istorageaddressid',

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  // Format: Field Label => fieldname

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @var string[] List of fields in the RelationListView

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      if (\App\Field::getFieldPermission('IStorages', $colname)) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $iStoragesList = $this->getParentIStorages($id, $iStoragesList, $encounteredIStorages);

          Line exceeds 120 characters; contains 127 characters
          Open

                  $iStoragesList[$baseId] = $this->getChildIStorages($baseId, $iStoragesList[$baseId], $iStoragesList[$baseId]['depth']);

          Spaces must be used to indent lines; tabs are not allowed
          Open

               *                                returns All the parent storages of the given Storage in array format

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public function getHierarchyData($id, $iStorageInfoBase, $iStorageId, &$listviewEntries, $getRawData = false, $getLinks = true)

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  foreach ($listColumns as $colname) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

              /**

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  'u_yf_istorages' => 'istorageid',

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  \App\Log::trace('Entering getHierarchy(' . $id . ') method ...');

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  }

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  foreach ($listColumns as $fieldname => $colname) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $iStoragesList = [];

          Spaces must be used to indent lines; tabs are not allowed
          Open

              }

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @param int   $id               - Id of the record highest in hierarchy

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @param bool  $getRawData

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @param bool  $getLinks

          Spaces must be used to indent lines; tabs are not allowed
          Open

              // For Alphabetical search

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public $def_detailview_recname = 'subject';

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $listviewHeader = [];

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $listColumns = App\Config::module('IStorages', 'COLUMNS_IN_HIERARCHY');

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $iStoragesList = [$baseId => $iStoragesList[$baseId]];

          Spaces must be used to indent lines; tabs are not allowed
          Open

               */

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public $tab_name_index = [

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  'u_yf_istoragescf' => 'istorageid',

          Spaces must be used to indent lines; tabs are not allowed
          Open

              ];

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public $default_sort_order = 'ASC';

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  }

          Line exceeds 120 characters; contains 137 characters
          Open

                  // Get the iStorages hierarchy from the top most iStorage in the hierarch of the current iStorage, including the current iStorage

          Spaces must be used to indent lines; tabs are not allowed
          Open

              /**

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  \App\Log::trace('Entering getHierarchyData(' . $id . ',' . $iStorageId . ') method ...');

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public $customFieldTable = ['u_yf_istoragescf', 'istorageid'];

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * Mandatory for Saving, Include tables related to this module.

          Spaces must be used to indent lines; tabs are not allowed
          Open

               */

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public $popup_fields = ['subject'];

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @param bool $getLinks

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public function getHierarchy($id, $getRawData = false, $getLinks = true)

          Spaces must be used to indent lines; tabs are not allowed
          Open

              {

          Spaces must be used to indent lines; tabs are not allowed
          Open

              {

          Spaces must be used to indent lines; tabs are not allowed
          Open

              // Used when enabling/disabling the mandatory fields for the module.

          Spaces must be used to indent lines; tabs are not allowed
          Open

              /**

          Spaces must be used to indent lines; tabs are not allowed
          Open

               *

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @param int  $id         - istorageid

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $baseId = current(array_keys($iStoragesList));

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  }

          Spaces must be used to indent lines; tabs are not allowed
          Open

              /**

          Spaces must be used to indent lines; tabs are not allowed
          Open

              /**

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  'Assigned To' => 'assigned_user_id',

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  'Assigned To' => ['vtiger_crmentity', 'assigned_user_id'],

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public $def_basicsearch_col = 'subject';

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public $mandatory_fields = ['subject', 'assigned_user_id'];

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @param array $listviewEntries

          Line exceeds 120 characters; contains 131 characters
          Open

              public function getHierarchyData($id, $iStorageInfoBase, $iStorageId, &$listviewEntries, $getRawData = false, $getLinks = true)

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  // Format: Field Label => Array(tablename, columnname)

          Spaces must be used to indent lines; tabs are not allowed
          Open

              ];

          Spaces must be used to indent lines; tabs are not allowed
          Open

              ];

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public $list_fields_name = [

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  // tablename should not have prefix 'vtiger_'

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $listviewEntries = [];

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  return $iStorageHierarchy;

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @param array $iStorageInfoBase

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public $table_index = 'istorageid';

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public $tab_name = ['vtiger_crmentity', 'u_yf_istorages', 'u_yf_istoragescf', 'u_yf_istorages_address'];

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public $default_order_by = '';

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  // Get the iStorages hierarchy from the top most iStorage in the hierarch of the current iStorage, including the current iStorage

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @param int   $iStorageId       - istorageid

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      // Permission to view storage is restricted, avoid showing field values (except storage name)

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      if (\App\Field::getFieldPermission('IStorages', $colname)) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

               */

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      }

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $this->getHierarchyData($id, $iStoragesList[$baseId], $baseId, $listviewEntries, $getRawData, $getLinks);

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  if (empty($listColumns)) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public $search_fields_name = [];

          Spaces must be used to indent lines; tabs are not allowed
          Open

              // For Popup window record selection

          Spaces must be used to indent lines; tabs are not allowed
          Open

              // Refers to vtiger_field.fieldname values.

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          $listviewHeader[] = \App\Language::translate($fieldname);

          Spaces must be used to indent lines; tabs are not allowed
          Open

                              }

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  if ($depthBase === App\Config::module('IStorages', 'MAX_HIERARCHY_DEPTH')) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      ->from('u_#__istorages')

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      if (empty($listColumns)) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          $childIStorageInfo['depth'] = $depth;

          Spaces must be used to indent lines; tabs are not allowed
          Open

                              // - to show the hierarchy of the Storages

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          $iStorageInfoData[] = $data;

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @param int   $depthBase

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      ->leftJoin('vtiger_groups', 'vtiger_groups.groupid = vtiger_crmentity.smownerid')

          Spaces must be used to indent lines; tabs are not allowed
          Open

                              $parentIStorageInfo[$columnname] = $row['user_name'];

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      'u_#__istorages.*',

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  if ($dataReader->count() > 0) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                              if ('assigned_user_id' === $columnname) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          }

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          $data = \App\Purifier::encodeHtml($iStorageInfoBase[$colname]);

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @param array $parentIStorages      - Array of all the parent storages

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      ->innerJoin('vtiger_crmentity', 'vtiger_crmentity.crmid = u_#__istorages.istorageid')

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          } else {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                              $parentIStorageInfo[$columnname] = $row[$columnname];

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  \App\Log::trace('Exiting __getIStorafAccounts method ...');

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      return $childIStorages;

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      ->innerJoin('u_#__istorages_address', 'u_#__istorages.istorageid = u_#__istorages_address.istorageaddressid')

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  }

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  foreach ($iStorageInfoBase as $accId => $iStorageInfo) {

          Line exceeds 120 characters; contains 129 characters
          Open

                          $listviewEntries = $this->getHierarchyData($id, $iStorageInfo, $accId, $listviewEntries, $getRawData, $getLinks);

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  }

          Spaces must be used to indent lines; tabs are not allowed
          Open

              {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  ])

          Spaces must be used to indent lines; tabs are not allowed
          Open

                                          $data = '<span>' . $data . '&nbsp;<span class="fas fa-exclamation-circle"></span></span>';

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      ->one();

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      }

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @param int   $id             - istorageid

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  \App\Log::trace('Entering getChildIStorages(' . $id . ',' . $depthBase . ') method ...');

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  }

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $dataReader = (new App\Db\Query())->select([

          Line exceeds 120 characters; contains 150 characters
          Open

                      'user_name' => new \yii\db\Expression("CASE when (vtiger_users.user_name not like '') THEN $userNameSql ELSE vtiger_groups.groupname END")

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      ->from('u_#__istorages')

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      ->createCommand()->query();

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  if (empty($listColumns)) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                                  $childIStorageInfo[$columnname] = $row[$columnname];

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  }

          Line exceeds 120 characters; contains 142 characters
          Open

                                          $data = '<a href="index.php?module=IStorages&action=DetailView&record=' . $iStorageId . '">' . $data . '</a>';

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public function getParentIStorages($id, &$parentIStorages, &$encounteredIStorages, $depthBase = 0)

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      \App\Log::error('Exiting getParentIStorages method ... - exceeded maximum depth of hierarchy');

          Spaces must be used to indent lines; tabs are not allowed
          Open

              }

          Spaces must be used to indent lines; tabs are not allowed
          Open

               */

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      $depth = $depthBase + 1;

          Spaces must be used to indent lines; tabs are not allowed
          Open

                              }

          Line exceeds 120 characters; contains 122 characters
          Open

                                          $data = '<span>' . $data . '&nbsp;<span class="fas fa-exclamation-circle"></span></span>';

          Spaces must be used to indent lines; tabs are not allowed
          Open

                                  $data = '<strong>' . $data . '</strong>';

          Spaces must be used to indent lines; tabs are not allowed
          Open

                              $iStorageDepth = str_repeat(' .. ', $iStorageInfoBase['depth']);

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          }

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $listviewEntries[$iStorageId] = $iStorageInfoData;

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          $listviewEntries = $this->getHierarchyData($id, $iStorageInfo, $accId, $listviewEntries, $getRawData, $getLinks);

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $userNameSql = \vtlib\Deprecated::getSqlForNameInDisplayFormat(['first_name' => 'vtiger_users.first_name', 'last_name' => 'vtiger_users.last_name'], 'Users');

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      'u_#__istorages_address.*',

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  ])

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          $this->getParentIStorages($parentid, $parentIStorages, $encounteredIStorages, $depthBase + 1);

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      }

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      $parentIStorages[$id] = $parentIStorageInfo;

          Spaces must be used to indent lines; tabs are not allowed
          Open

              /**

          Line exceeds 120 characters; contains 166 characters
          Open

                  $userNameSql = \vtlib\Deprecated::getSqlForNameInDisplayFormat(['first_name' => 'vtiger_users.first_name', 'last_name' => 'vtiger_users.last_name'], 'Users');

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      ->leftJoin('vtiger_groups', 'vtiger_groups.groupid = vtiger_crmentity.smownerid')

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          $childIStorages[$childAccId] = $childIStorageInfo;

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  return $childIStorages;

          Spaces must be used to indent lines; tabs are not allowed
          Open

              }

          Spaces must be used to indent lines; tabs are not allowed
          Open

              /**

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @param int   $depth          - Depth at which the particular storage has to be placed in the hierarchy

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @param mixed $depthBase

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $listColumns = App\Config::module('IStorages', 'COLUMNS_IN_HIERARCHY');

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      while ($row = $dataReader->read()) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          $childAccId = $row['istorageid'];

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          foreach ($listColumns as $columnname) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      }

          Spaces must be used to indent lines; tabs are not allowed
          Open

                                          $data = '<a href="index.php?module=IStorages&action=DetailView&record=' . $iStorageId . '">' . $data . '</a>';

          Spaces must be used to indent lines; tabs are not allowed
          Open

                                      } else {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  return $listviewEntries;

          Spaces must be used to indent lines; tabs are not allowed
          Open

               */

          Line exceeds 120 characters; contains 121 characters
          Open

                      ->innerJoin('u_#__istorages_address', 'u_#__istorages.istorageid = u_#__istorages_address.istorageaddressid')

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      $parentIStorageInfo = [];

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      $depth = 0;

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      $listColumns = App\Config::module('IStorages', 'COLUMNS_IN_HIERARCHY');

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          }

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public function getChildIStorages($id, &$childIStorages, $depthBase)

          Spaces must be used to indent lines; tabs are not allowed
          Open

                                      if ($hasRecordViewAccess) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      }

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  \App\Log::trace('Exiting getHierarchyData method ...');

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          $listColumns = $this->list_fields_name;

          Line exceeds 120 characters; contains 121 characters
          Open

                      ->innerJoin('u_#__istorages_address', 'u_#__istorages.istorageid = u_#__istorages_address.istorageaddressid')

          Spaces must be used to indent lines; tabs are not allowed
          Open

                                  $childIStorageInfo[$columnname] = $row['user_name'];

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      if (\is_array($iStorageInfo) && (int) $accId) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

               *

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @param int   $id                   - istorageid

          Spaces must be used to indent lines; tabs are not allowed
          Open

               *                                    returns All the parent Storages of the given istorageid in array format

          Spaces must be used to indent lines; tabs are not allowed
          Open

              {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      $parentid = $row['parentid'];

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      }

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  return $parentIStorages;

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * Function to Recursively get all the child storages of a given Storage.

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @param array $childIStorages - Array of all the child storages

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  if (empty($id) || $depthBase === App\Config::module('IStorages', 'MAX_HIERARCHY_DEPTH')) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      \App\Log::error('Exiting getChildIStorages method ... - exceeded maximum depth of hierarchy');

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $userNameSql = \vtlib\Deprecated::getSqlForNameInDisplayFormat(['first_name' => 'vtiger_users.first_name', 'last_name' => 'vtiger_users.last_name'], 'Users');

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      'u_#__istorages_address.*',

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      ->innerJoin('vtiger_crmentity', 'vtiger_crmentity.crmid = u_#__istorages.istorageid')

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      $listColumns = $this->list_fields_name;

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  }

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  \App\Log::trace('Entering getParentIStorages(' . $id . ') method ...');

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      ->innerJoin('u_#__istorages_address', 'u_#__istorages.istorageid = u_#__istorages_address.istorageaddressid')

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      ->leftJoin('vtiger_users', 'vtiger_users.id = vtiger_crmentity.smownerid')

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          $encounteredIStorages[] = $parentid;

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      foreach ($listColumns as $columnname) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                              if ($iStorageId != $id) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                                  if ($getLinks) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                                      }

          Spaces must be used to indent lines; tabs are not allowed
          Open

                              } else {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      }

          Spaces must be used to indent lines; tabs are not allowed
          Open

              }

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * Function to Recursively get all the upper storages of a given Storage.

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      return $parentIStorages;

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  }

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $row = (new App\Db\Query())->select([

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      if ('' != $parentid && 0 != $parentid && !\in_array($parentid, $encounteredIStorages)) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      if (isset($parentIStorages[$parentid])) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          if (false === $getRawData && 'subject' === $colname) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          if ('assigned_user_id' === $columnname) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      'user_name' => new \yii\db\Expression("CASE when (vtiger_users.user_name not like '') THEN $userNameSql ELSE vtiger_groups.groupname END")

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @param array $encounteredIStorages

          Line exceeds 120 characters; contains 166 characters
          Open

                  $userNameSql = \vtlib\Deprecated::getSqlForNameInDisplayFormat(['first_name' => 'vtiger_users.first_name', 'last_name' => 'vtiger_users.last_name'], 'Users');

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      'user_name' => new \yii\db\Expression("CASE when (vtiger_users.user_name not like '') THEN $userNameSql ELSE vtiger_groups.groupname END")

          Line exceeds 120 characters; contains 150 characters
          Open

                      'user_name' => new \yii\db\Expression("CASE when (vtiger_users.user_name not like '') THEN $userNameSql ELSE vtiger_groups.groupname END")

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      ->where(['vtiger_crmentity.deleted' => 0, 'u_#__istorages.istorageid' => $id])

          Spaces must be used to indent lines; tabs are not allowed
          Open

               *                              returns All the child storages of the given istorageid in array format

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      ->leftJoin('vtiger_users', 'vtiger_users.id = vtiger_crmentity.smownerid')

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          $childIStorageInfo = [];

          Spaces must be used to indent lines; tabs are not allowed
          Open

                              } else {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          $this->getChildIStorages($childAccId, $childIStorages[$childAccId], $depth);

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  \App\Log::trace('Exiting getChildIStorages method ...');

          Spaces must be used to indent lines; tabs are not allowed
          Open

                                  }

          Spaces must be used to indent lines; tabs are not allowed
          Open

                              $data = $iStorageDepth . $data;

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      'u_#__istorages.*',

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          $depth = $parentIStorages[$parentid]['depth'] + 1;

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      ->where(['vtiger_crmentity.deleted' => 0, 'parentid' => $id])

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  }

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  if ($row) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      }

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      $parentIStorageInfo['depth'] = $depth;

          Spaces must be used to indent lines; tabs are not allowed
          Open

               *

          There are no issues that match your filters.

          Category
          Status