YetiForceCompany/YetiForceCRM

View on GitHub
modules/Settings/WidgetsManagement/models/Module.php

Summary

Maintainability
D
2 days
Test Coverage
F
12%

File Module.php has 410 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Settings OSSMailView index view class.
 *
 * @copyright YetiForce S.A.
Severity: Minor
Found in modules/Settings/WidgetsManagement/models/Module.php - About 5 hrs to fix

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

    class Settings_WidgetsManagement_Module_Model extends Settings_Vtiger_Module_Model
    {
        /** {@inheritdoc} */
        public $name = 'WidgetsManagement';
    
    

    Method addWidget has 81 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function addWidget($data, $moduleName, $addToUser = false)
        {
            \App\Log::trace('Entering Settings_WidgetsManagement_Module_Model::addWidget(' . $moduleName . ') method ...');
            $db = App\Db::getInstance();
            $status = false;
    Severity: Major
    Found in modules/Settings/WidgetsManagement/models/Module.php - About 3 hrs to fix

      Settings_WidgetsManagement_Module_Model has 27 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Settings_WidgetsManagement_Module_Model extends Settings_Vtiger_Module_Model
      {
          /** {@inheritdoc} */
          public $name = 'WidgetsManagement';
      
      
      Severity: Minor
      Found in modules/Settings/WidgetsManagement/models/Module.php - About 3 hrs to fix

        Function addWidget has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

            public function addWidget($data, $moduleName, $addToUser = false)
            {
                \App\Log::trace('Entering Settings_WidgetsManagement_Module_Model::addWidget(' . $moduleName . ') method ...');
                $db = App\Db::getInstance();
                $status = false;
        Severity: Minor
        Found in modules/Settings/WidgetsManagement/models/Module.php - About 2 hrs to fix

        Cognitive Complexity

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

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

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

        Further reading

        Function getDefaultUserId has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function getDefaultUserId($widgetModel, $moduleName = false, $owner = false)
            {
                \App\Log::trace('Entering ' . __METHOD__);
                $currentUser = \App\User::getCurrentUserModel();
                $user = '';
        Severity: Minor
        Found in modules/Settings/WidgetsManagement/models/Module.php - About 2 hrs to fix

        Cognitive Complexity

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

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

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

        Further reading

        Method getDefaultUserId has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function getDefaultUserId($widgetModel, $moduleName = false, $owner = false)
            {
                \App\Log::trace('Entering ' . __METHOD__);
                $currentUser = \App\User::getCurrentUserModel();
                $user = '';
        Severity: Minor
        Found in modules/Settings/WidgetsManagement/models/Module.php - About 1 hr to fix

          The method getDefaultUserId() has an NPath complexity of 1344. The configured NPath complexity threshold is 200.
          Open

              public static function getDefaultUserId($widgetModel, $moduleName = false, $owner = false)
              {
                  \App\Log::trace('Entering ' . __METHOD__);
                  $currentUser = \App\User::getCurrentUserModel();
                  $user = '';

          NPathComplexity

          Since: 0.1

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

          Example

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

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

          The method addWidget() has an NPath complexity of 11340. The configured NPath complexity threshold is 200.
          Open

              public function addWidget($data, $moduleName, $addToUser = false)
              {
                  \App\Log::trace('Entering Settings_WidgetsManagement_Module_Model::addWidget(' . $moduleName . ') method ...');
                  $db = App\Db::getInstance();
                  $status = false;

          NPathComplexity

          Since: 0.1

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

          Example

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

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

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

              public static function getDefaultUserId($widgetModel, $moduleName = false, $owner = false)
              {
                  \App\Log::trace('Entering ' . __METHOD__);
                  $currentUser = \App\User::getCurrentUserModel();
                  $user = '';

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

              public function addWidget($data, $moduleName, $addToUser = false)
              {
                  \App\Log::trace('Entering Settings_WidgetsManagement_Module_Model::addWidget(' . $moduleName . ') method ...');
                  $db = App\Db::getInstance();
                  $status = false;

          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

          Class "Settings_WidgetsManagement_Module_Model" has 27 methods, which is greater than 20 authorized. Split it into smaller classes.
          Open

          class Settings_WidgetsManagement_Module_Model extends Settings_Vtiger_Module_Model

          A class that grows too much tends to aggregate too many responsibilities and inevitably becomes harder to understand and therefore to maintain. Above a specific threshold, it is strongly advised to refactor the class into smaller ones which focus on well defined topics.

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

              public function addWidget($data, $moduleName, $addToUser = false)

          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

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

              public static function getDefaultUserId($widgetModel, $moduleName = false, $owner = false)

          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

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

          class Settings_WidgetsManagement_Module_Model extends Settings_Vtiger_Module_Model
          {
              /** {@inheritdoc} */
              public $name = 'WidgetsManagement';
          
          

          CouplingBetweenObjects

          Since: 1.1.0

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

          Example

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

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

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

              public function addWidget($data, $moduleName, $addToUser = false)

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

                  $dataReader = (new \App\Db\Query())->from('vtiger_links')

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

                  $dataReader = (new \App\Db\Query())->from('vtiger_links')

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

              public static function getDefaultUserId($widgetModel, $moduleName = false, $owner = false)

          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 '450', column '17').
          Open

                  $query = (new \App\Db\Query())->from('vtiger_links')

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

                          throw new App\Exceptions\IllegalValue("ERR_VALUE_IS_TOO_LONG||filterid||{$moduleName}||" . implode(',', $filters), 406);

          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 '405', column '17').
          Open

                      ->union((new App\Db\Query())->select(['vtiger_module_dashboard_blocks.*', 'rolename' => 'w_#__servers.name'])->from('vtiger_module_dashboard_blocks')

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

                  return (new App\Db\Query())->from('u_#__dashboard_type')

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

              public static function getDefaultUserId($widgetModel, $moduleName = false, $owner = false)

          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 '126', column '17').
          Open

                  $types = (new App\Db\Query())->from('u_#__dashboard_type')->indexBy('dashboard_id')->all();

          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 '431', column '17').
          Open

                  $query = (new \App\Db\Query())

          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 '168', column '18').
          Open

                  $blocks = (new App\Db\Query())->select(['id'])->from('vtiger_module_dashboard_blocks')

          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 '261', column '20').
          Open

                  $subQuery = (new \App\Db\Query())->from('vtiger_module_dashboard')->select(['vtiger_links.linkid'])

          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 '339', column '14').
          Open

                      throw new App\Exceptions\IllegalValue('ERR_VALUE_IS_TOO_LONG||additionalFiltersFields||' . implode(',', $data['data']['additionalFiltersFields']), 406);

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

                  $dataReader = (new App\Db\Query())->select(['vtiger_module_dashboard_blocks.*', 'vtiger_role.rolename'])

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

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

          MissingImport

          Since: 2.7.0

          Importing all external classes in a file through use statements makes them clearly visible.

          Example

          function make() {
              return new \stdClass();
          }

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

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

                  \App\Log::trace('Entering Settings_WidgetsManagement_Module_Model::addWidget(' . $moduleName . ') method ...');

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

                  \App\Log::trace('Entering Settings_WidgetsManagement_Module_Model::getBlocksId() method ...');

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

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

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

                  \App\Log::trace('Exiting ' . __METHOD__);

          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\Link' in method 'addWidget'.
          Open

          }

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

                  $data['data'] = App\Json::decode(\App\Purifier::decodeHtml($data['data'] ?? ''));

          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\Json' in method 'addWidget'.
          Open

                  $size = \App\Json::encode([
                      'width' => $data['width'],
                      'height' => $data['height'],
                  ]);

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

                  \App\Log::trace('getBlocksFromModule(' . $moduleName . ', ' . $authorized . ') method ...');

          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\Module' in method 'addWidget'.
          Open

                          'module' => \vtlib\Link::getLinkData($data['linkid'])['tabid'] ?? \App\Module::getModuleId($moduleName),

          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 'Vtiger_Widget_Model' in method 'getDashboardForModule'.
          Open

                      $data[$row['blockid']][] = Vtiger_Widget_Model::getInstanceFromValues($row);

          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\Cache' in method 'getDashboardTypes'.
          Open

                  App\Cache::save('WidgetsDashboard', 'AllTypes', $types);

          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\User' in method 'getDefaultUserId'.
          Open

                  $currentUser = \App\User::getCurrentUserModel();

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

                      if (\count($filters) > \App\Config::performance('CHART_MULTI_FILTER_LIMIT')) {

          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\Json' in method 'addWidget'.
          Open

                  $data['data'] = App\Json::decode(\App\Purifier::decodeHtml($data['data'] ?? ''));

          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\Module' in method 'getBlocksId'.
          Open

                      $moduleName = \App\Module::getModuleName($tabId);

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

                  \App\Log::trace('Entering Settings_WidgetsManagement_Module_Model::getDashboardForModule(' . $moduleName . ') method ...');

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

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

          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\Cache' in method 'saveDashboard'.
          Open

                  App\Cache::delete('WidgetsDashboard', 'AllTypes');

          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\Json' in method 'addWidget'.
          Open

                  $owners = \App\Json::encode([
                      'default' => $data['default_owner'] ?? '',
                      'available' => $data['owners_all'] ?? '',
                  ]);

          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 'Vtiger_Widget_Model' in method 'getSpecialWidgets'.
          Open

                      $widgets[$row['linklabel']] = Vtiger_Widget_Model::getInstanceFromValues($row);

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

                  \App\Log::trace("Entering Settings_WidgetsManagement_Module_Model::removeBlock({$data['blockid']}) method ...");

          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\Module' in method 'getSelectableDashboard'.
          Open

                      $moduleName = \App\Module::getModuleName($row['tabid']);

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

                  return ['success' => true, 'id' => $templateId, 'wid' => $widgetId ?? '', 'status' => $status, 'text' => \App\Language::translate('LBL_WIDGET_ADDED', 'Settings::WidgetsManagement')];

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

                  } else {
                      App\Db::getInstance()->createCommand()
                          ->update('u_#__dashboard_type', ['name' => $dashboardName], ['dashboard_id' => $dashboardId])
                          ->execute();
                  }

          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 'Vtiger_Widget_Model' in method 'getSelectableDashboard'.
          Open

                      $widgets[$moduleName][] = Vtiger_Widget_Model::getInstanceFromValues($row);

          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\Cache' in method 'getDashboardTypes'.
          Open

                  if (App\Cache::has('WidgetsDashboard', 'AllTypes')) {

          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 'Vtiger_Widget_Model' in method 'getPredefinedWidgetsByBlock'.
          Open

                      $widgets[] = Vtiger_Widget_Model::getInstanceFromValues($row);

          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\Db' in method 'addWidget'.
          Open

                  $db = App\Db::getInstance();

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

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

          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\Module' in method 'getBlocksFromModule'.
          Open

                  $tabId = \App\Module::getModuleId($moduleName);

          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\Db' in method 'addBlock'.
          Open

                  $db = App\Db::getInstance();

          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\Module' in method 'getSpecialWidgets'.
          Open

                  $tabId = \App\Module::getModuleId($moduleName);

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

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

          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\Module' in method 'getDashboardForModule'.
          Open

                  $tabId = \App\Module::getModuleId($moduleName);

          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\Db' in method 'removeBlock'.
          Open

                  $db = App\Db::getInstance();

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

                  } else {
                      $accessibleUsers = \App\Fields\Owner::getInstance(false, $currentUser)->getAccessibleUsers();
                      $accessibleGroups = \App\Fields\Owner::getInstance(false, $currentUser)->getAccessibleGroups();
                  }

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

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

          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\Cache' in method 'getDashboardTypes'.
          Open

                      return App\Cache::get('WidgetsDashboard', 'AllTypes');

          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\Db' in method 'deleteDashboard'.
          Open

                  $db = App\Db::getInstance();

          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\Cache' in method 'deleteDashboard'.
          Open

                  App\Cache::delete('WidgetsDashboard', 'AllTypes');

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

                  \App\Log::trace('Entering ' . __METHOD__);

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

                  if (!empty($data['data']['additionalFiltersFields']) && \count($data['data']['additionalFiltersFields']) > \App\Config::performance('CHART_ADDITIONAL_FILTERS_LIMIT')) {

          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\Json' in method 'addWidget'.
          Open

                  $data['data'] = App\Json::encode($data['data']);

          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\User' in method 'addWidget'.
          Open

                          'userid' => \App\User::getCurrentUserId(),

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

                  \App\Log::trace("Entering Settings_WidgetsManagement_Module_Model::getSpecialWidgets($moduleName) method ...");

          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\Module' in method 'addBlock'.
          Open

                  $tabId = \App\Module::getModuleId($moduleName);

          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\Json' in method 'getDefaultUserId'.
          Open

                  $owners = \App\Json::decode(html_entity_decode($widgetModel->get('owners')));

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

                  } else {
                      $timeStart = date('Y-m-d', strtotime('-1 month'));
                  }

          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

          Define a constant instead of duplicating this literal "Leads by Status Converted" 3 times.
          Open

                      'Leads by Industry', 'Leads by Source', 'Leads by Status Converted', 'Employees Time Control', 'LBL_ALL_TIME_CONTROL',

          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 "height" 4 times.
          Open

                  return ['width' => $width, 'height' => $height];

          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 "vtiger_module_dashboard" 5 times.
          Open

                  $db->createCommand()->delete('vtiger_module_dashboard', ['blockid' => $blocks])->execute();

          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 "cache" 4 times.
          Open

                      'cache' => $data['cache'] ?? null,

          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 "AllTypes" 5 times.
          Open

                  if (App\Cache::has('WidgetsDashboard', 'AllTypes')) {

          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 "vtiger_links" 5 times.
          Open

                  $dataReader = (new \App\Db\Query())->from('vtiger_links')

          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 "filterid" 9 times.
          Open

                  if (!empty($data['filterid'])) {

          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 "success" 4 times.
          Open

                      'success' => true,

          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 "isdefault" 9 times.
          Open

                  if (empty($data['isdefault']) || 1 != $data['isdefault'] || '1' != $data['isdefault']) {

          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 "available" 12 times.
          Open

                      if (('all' !== $owner && !isset($accessibleUsers[$owner]) && !isset($accessibleGroups[$owner])) || ('all' === $owner && !\in_array($owner, $owners['available']))) {

          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 "width" 4 times.
          Open

                  return ['width' => $width, 'height' => $height];

          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 "Leads by Industry" 3 times.
          Open

                      'Leads by Industry', 'Leads by Source', 'Leads by Status Converted', 'Employees Time Control', 'LBL_ALL_TIME_CONTROL',

          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 "LBL_ALL_TIME_CONTROL" 3 times.
          Open

                      'Leads by Industry', 'Leads by Source', 'Leads by Status Converted', 'Employees Time Control', 'LBL_ALL_TIME_CONTROL',

          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 "authorized" 5 times.
          Open

                          'authorized' => $data['authorized'],

          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_#__dashboard_type" 5 times.
          Open

                  $types = (new App\Db\Query())->from('u_#__dashboard_type')->indexBy('dashboard_id')->all();

          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 "LBL_CLOSED_TICKETS_BY_PRIORITY" 3 times.
          Open

                      'LBL_CLOSED_TICKETS_BY_PRIORITY', 'LBL_CLOSED_TICKETS_BY_USER', 'LBL_ACCOUNTS_BY_INDUSTRY'

          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 "WidgetsDashboard" 5 times.
          Open

                  if (App\Cache::has('WidgetsDashboard', 'AllTypes')) {

          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 "title" 4 times.
          Open

                      'title' => $data['title'] ?? '',

          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 "Y-m-d" 4 times.
          Open

                      $timeStart = date('Y-m-d');

          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 "limit" 6 times.
          Open

                  if ($status && empty($data['limit'])) {

          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 "linklabel" 4 times.
          Open

                      ->where(['blockid' => $blockId])->andWhere(['not', ['linklabel' => ['Multifilter', 'Upcoming events']]]);

          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 "Leads by Status" 3 times.
          Open

                      'LBL_NOTIFICATION_BY_SENDER', 'LBL_NOTIFICATION_BY_RECIPIENT', 'DW_SUMMATION_BY_USER', 'Leads by Status',

          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 "vtiger_module_dashboard_blocks" 8 times.
          Open

                  $blocks = (new App\Db\Query())->select(['id'])->from('vtiger_module_dashboard_blocks')

          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 "owners" 3 times.
          Open

                  $owners = \App\Json::decode(html_entity_decode($widgetModel->get('owners')));

          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 "LBL_ACCOUNTS_BY_INDUSTRY" 3 times.
          Open

                      'LBL_CLOSED_TICKETS_BY_PRIORITY', 'LBL_CLOSED_TICKETS_BY_USER', 'LBL_ACCOUNTS_BY_INDUSTRY'

          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 "dashboard_id" 9 times.
          Open

                  $types = (new App\Db\Query())->from('u_#__dashboard_type')->indexBy('dashboard_id')->all();

          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 "linkid" 5 times.
          Open

                      'linkid' => $data['linkid'],

          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 "blockid" 10 times.
          Open

                  $db->createCommand()->delete('vtiger_module_dashboard', ['blockid' => $blocks])->execute();

          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 "Leads by Source" 3 times.
          Open

                      'Leads by Industry', 'Leads by Source', 'Leads by Status Converted', 'Employees Time Control', 'LBL_ALL_TIME_CONTROL',

          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 "tabid" 6 times.
          Open

                      $moduleName = \App\Module::getModuleName($row['tabid']);

          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 "additionalFiltersFields" 3 times.
          Open

                  if (!empty($data['data']['additionalFiltersFields']) && \count($data['data']['additionalFiltersFields']) > \App\Config::performance('CHART_ADDITIONAL_FILTERS_LIMIT')) {

          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 "dashboardId" 3 times.
          Open

                          'dashboard_id' => $data['dashboardId'],

          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 ..." 3 times.
          Open

                  \App\Log::trace('Entering Settings_WidgetsManagement_Module_Model::addWidget(' . $moduleName . ') method ...');

          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.

          Avoid unused parameters such as '$addToUser'.
          Open

              public function addBlock($data, $moduleName, $addToUser)

          UnusedFormalParameter

          Since: 0.2

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

          Example

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

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

          Parameter $widgetModel has undeclared type \Vtiger_Widget_Model
          Open

              public static function getDefaultDateRange($widgetModel)

          Call to method get from undeclared class \Vtiger_Widget_Model
          Open

                  $defaultDate = $widgetModel->get('date');

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

                  $types = (new App\Db\Query())->from('u_#__dashboard_type')->indexBy('dashboard_id')->all();

          Default value for string $moduleName can't be false
          Open

              public static function getDefaultUserId($widgetModel, $moduleName = false, $owner = false)

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

                  return (new App\Db\Query())->from('u_#__dashboard_type')

          Call to method getCurrentUserModel from undeclared class \App\User (Did you mean class \Tests\App\User)
          Open

                  $currentUser = \App\User::getCurrentUserModel();

          Call to method getInstance from undeclared class \App\Fields\Owner
          Open

                      $accessibleGroups = \App\Fields\Owner::getInstance($moduleName, $currentUser)->getAccessibleGroupForModule();

          Call to undeclared method \App\Db::createCommand
          Open

                      App\Db::getInstance()->createCommand()

          Call to undeclared method \App\Db::createCommand
          Open

                  $db->createCommand()->delete('vtiger_module_dashboard', ['blockid' => $blocks])->execute();

          Call to undeclared method \App\Db::createCommand
          Open

                  $db->createCommand()->delete('u_#__dashboard_type', ['dashboard_id' => $dashboardId])->execute();

          Call to undeclared method \App\Db::createCommand
          Open

                      App\Db::getInstance()->createCommand()

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

                  $dataReader = (new \App\Db\Query())->from('vtiger_links')

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

                  $blocks = (new App\Db\Query())->select(['id'])->from('vtiger_module_dashboard_blocks')

          Parameter $widgetModel has undeclared type \Vtiger_Widget_Model
          Open

              public static function getDefaultUserId($widgetModel, $moduleName = false, $owner = false)

          Call to method getInstance from undeclared class \App\Fields\Owner
          Open

                      $accessibleUsers = \App\Fields\Owner::getInstance(false, $currentUser)->getAccessibleUsers();

          Call to method getInstance from undeclared class \App\Fields\Owner
          Open

                      $accessibleUsers = \App\Fields\Owner::getInstance($moduleName, $currentUser)->getAccessibleUsersForModule();

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

                  \App\Log::trace('Exiting ' . __METHOD__);

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

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

          Call to undeclared method \App\Db::createCommand
          Open

                  $db->createCommand()->delete('vtiger_module_dashboard_blocks', ['dashboard_id' => $dashboardId])->execute();

          Call to undeclared method \App\Db::createCommand
          Open

                  $db->createCommand()->delete('vtiger_module_dashboard_widgets', ['dashboardid' => $dashboardId])->execute();

          Call to method getInstance from undeclared class \App\Fields\Owner
          Open

                      $accessibleGroups = \App\Fields\Owner::getInstance(false, $currentUser)->getAccessibleGroups();

          Call to method get from undeclared class \Vtiger_Widget_Model
          Open

                  $owners = \App\Json::decode(html_entity_decode($widgetModel->get('owners')));

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

                  $query = (new \App\Db\Query())

          Call to method getInstanceFromValues from undeclared class \Vtiger_Widget_Model
          Open

                      $widgets[$row['linklabel']] = Vtiger_Widget_Model::getInstanceFromValues($row);

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

                  \App\Log::trace('Entering ' . __METHOD__);

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

                  $dataReader = (new App\Db\Query())->select(['vtiger_module_dashboard_blocks.*', 'vtiger_role.rolename'])

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

                      ->union((new App\Db\Query())->select(['vtiger_module_dashboard_blocks.*', 'rolename' => 'w_#__servers.name'])->from('vtiger_module_dashboard_blocks')

          Call to undeclared method \App\Db::createCommand
          Open

                  $db->createCommand()->delete('vtiger_module_dashboard', ['blockid' => $data['blockid']])->execute();

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

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

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

                  \App\Log::trace('getBlocksFromModule(' . $moduleName . ', ' . $authorized . ') method ...');

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

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

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

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

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

                  \App\Log::trace('Entering Settings_WidgetsManagement_Module_Model::addWidget(' . $moduleName . ') method ...');

          Call to undeclared method \App\Db::createCommand
          Open

                  $db->createCommand()->insert('vtiger_module_dashboard', [

          Call to undeclared method \App\Db::createCommand
          Open

                      $db->createCommand()->insert('vtiger_module_dashboard_widgets', [

          Call to method getCurrentUserId from undeclared class \App\User (Did you mean class \Tests\App\User)
          Open

                          'userid' => \App\User::getCurrentUserId(),

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

                  $subQuery = (new \App\Db\Query())->from('vtiger_module_dashboard')->select(['vtiger_links.linkid'])

          Call to method getInstanceFromValues from undeclared class \Vtiger_Widget_Model
          Open

                      $widgets[$moduleName][] = Vtiger_Widget_Model::getInstanceFromValues($row);

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

                  \App\Log::trace("Entering Settings_WidgetsManagement_Module_Model::getSpecialWidgets($moduleName) method ...");

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

                  \App\Log::trace('Entering Settings_WidgetsManagement_Module_Model::getDashboardForModule(' . $moduleName . ') method ...');

          Call to undeclared method \App\Db::createCommand
          Open

                  \App\Db::getInstance()->createCommand()

          Call to undeclared method \App\Db::createCommand
          Open

                  $db->createCommand()->delete('vtiger_module_dashboard_blocks', ['id' => $data['blockid']])->execute();

          Call to method getInstanceFromValues from undeclared class \Vtiger_Widget_Model
          Open

                      $widgets[] = Vtiger_Widget_Model::getInstanceFromValues($row);

          Call to undeclared method \App\Db::createCommand
          Open

                  $db->createCommand()

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

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

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

                  \App\Log::trace("Entering Settings_WidgetsManagement_Module_Model::removeBlock({$data['blockid']}) method ...");

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

                  $query = (new \App\Db\Query())->from('vtiger_links')

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

                  $dataReader = (new \App\Db\Query())->from('vtiger_links')

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

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

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

                  \App\Log::trace('Entering Settings_WidgetsManagement_Module_Model::getBlocksId() method ...');

          Call to method getInstanceFromValues from undeclared class \Vtiger_Widget_Model
          Open

                      $data[$row['blockid']][] = Vtiger_Widget_Model::getInstanceFromValues($row);

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

          class Settings_WidgetsManagement_Module_Model extends Settings_Vtiger_Module_Model

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

                  $db = App\Db::getInstance();

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

          class Settings_WidgetsManagement_Module_Model extends Settings_Vtiger_Module_Model
          {
              /** {@inheritdoc} */
              public $name = 'WidgetsManagement';
          
          

          CamelCaseClassName

          Since: 0.2

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

          Example

          class class_name {
          }

          Source

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

                  $db = App\Db::getInstance();

          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

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

                  $db = App\Db::getInstance();

          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

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

                  $db = App\Db::getInstance();

          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

                      'LBL_NEW_ACCOUNTS', 'LBL_NEGLECTED_ACCOUNTS', 'LBL_UPDATES',

          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

              public static function getDashboardTypes()

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

                  App\Cache::save('WidgetsDashboard', 'AllTypes', $types);

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

               */

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

                  }

          Line exceeds 120 characters; contains 135 characters
          Open

                  return ['History', 'Upcoming Activities', 'Overdue Activities', 'Delegated project tasks', 'Delegated (overdue) project tasks',

          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 static function getDateSelectDefault(): array

          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 get available filters.

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

                      'LBL_NOTIFICATION_BY_SENDER', 'LBL_NOTIFICATION_BY_RECIPIENT', 'DW_SUMMATION_BY_USER', 'Leads by Status',

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

               *

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

                  $dashboardId = 0;

          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

               * @return string[]

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

                  return ['width' => $width, 'height' => $height];

          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 int

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

                      'LBL_EXPIRING_SOLD_PRODUCTS',

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

                      'Leads by Industry', 'Leads by Source', 'Leads by Status Converted', 'Employees Time Control', 'LBL_ALL_TIME_CONTROL',

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

                      'year' => 'PLL_CURRENT_YEAR',

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

                  return ['LBL_MINE' => 'mine', 'LBL_ALL' => 'all', 'LBL_USERS' => 'users', 'LBL_GROUPS' => 'groups', 'LBL_GROUP_USERS' => 'groupUsers', 'LBL_ROLE_USERS' => 'roleUsers', 'LBL_ROLE_AND_SUBORDINATES_USERS' => 'rsUsers'];

          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

                  $height = [3, 4, 5, 6, 7, 8, 9, 10, 11, 12];

          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

                  ];

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

                  ];

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

                  $defaultDate = $widgetModel->get('date');

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

                      $timeStart = date('Y-m-d');

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

                  } elseif ('year' === $defaultDate) {

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

               *

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

                  $types = (new App\Db\Query())->from('u_#__dashboard_type')->indexBy('dashboard_id')->all();

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

                  $allTypes = self::getDashboardTypes();

          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 $name = 'WidgetsManagement';

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

                      'day' => 'PLL_CURRENT_DAY',

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

              public static function getDataKeys(): array

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

                      $timeStart = date('Y-m-01');

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

                      $timeStart = date('Y-01-01');

          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

              /** {@inheritdoc} */

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

              /**

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

                          $dashboardId = $dashboard['dashboard_id'];

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

                  return [

          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 ['LBL_MINE' => 'mine', 'LBL_ALL' => 'all'];

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

                  return [

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

                      'LBL_TOTAL_ESTIMATED_VALUE_BY_STATUS', 'LBL_UPCOMING_PROJECT_TASKS', 'LBL_COMPLETED_PROJECT_TASKS', 'LBL_UPDATES', 'DW_TEAMS_ESTIMATED_SALES', 'DW_ACTUAL_SALES_OF_TEAM',

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

                  return ['width' => 4, 'height' => 4];

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

              public static function getDefaultDateRange($widgetModel)

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

                  return $types;

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

                  return $dashboardId;

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

                      App\Db::getInstance()->createCommand()

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

                  return ['History', 'Upcoming Activities', 'Overdue Activities', 'Delegated project tasks', 'Delegated (overdue) project tasks',

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

              public function getWidgetsWithFilterUsers(): array

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

              public function getDefaultValues(): array

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

              }

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

                      $timeStart = date('Y-m-d', strtotime('-1 month'));

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

                      return App\Cache::get('WidgetsDashboard', 'AllTypes');

          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 (1 === (int) $dashboard['system']) {

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

              public static function saveDashboard($dashboardId, $dashboardName)

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

                      'LBL_NOTIFICATION_BY_SENDER', 'LBL_NOTIFICATION_BY_RECIPIENT', 'DW_SUMMATION_BY_USER', 'Leads by Status',

          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

              }

          Line exceeds 120 characters; contains 130 characters
          Open

                      'Leads by Industry', 'Leads by Source', 'Leads by Status Converted', 'Employees Time Control', 'LBL_ALL_TIME_CONTROL',

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

                  ];

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

                      'Leads by Status Converted', 'Graf', 'Tickets by Status', 'Leads by Industry',

          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 array

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

              public static function getDefaultDashboard()

          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 getWidgetsWithLimit(): array

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

                      'week' => 'PLL_CURRENT_WEEK',

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

                  return ['skip_year', 'date_fields'];

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

              public function getWidgetsWithDate(): array

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

              public function getSize(): array

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

                  $width = [3, 4, 5, 6, 7, 8, 9, 10, 11, 12];

          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

                  if (empty($dashboardId)) {

          Line exceeds 120 characters; contains 130 characters
          Open

                      'Leads by Industry', 'Leads by Source', 'Leads by Status Converted', 'Employees Time Control', 'LBL_ALL_TIME_CONTROL',

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

                  return ['Mini List', 'Notebook', 'Chart', 'ChartFilter', 'Rss'];

          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

                      'LBL_NEW_ACCOUNTS', 'LBL_NEGLECTED_ACCOUNTS', 'LBL_CLOSED_TICKETS_BY_PRIORITY', 'LBL_ACCOUNTS_BY_INDUSTRY',

          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 get all dashboard.

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

               *

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

                          break;

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

                      'LBL_CLOSED_TICKETS_BY_PRIORITY', 'LBL_CLOSED_TICKETS_BY_USER', 'LBL_ACCOUNTS_BY_INDUSTRY'

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

              {

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

                      'LBL_CLOSED_TICKETS_BY_PRIORITY', 'LBL_CLOSED_TICKETS_BY_USER', 'LBL_ACCOUNTS_BY_INDUSTRY'

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

              }

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

                      'Delegated project tasks', 'Delegated (overdue) project tasks',

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

                      'LBL_ALL_TIME_CONTROL',

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

                  } elseif ('month' === $defaultDate) {

          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 (App\Cache::has('WidgetsDashboard', 'AllTypes')) {

          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 ($allTypes as $dashboard) {

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

              {

          Line exceeds 120 characters; contains 224 characters
          Open

                  return ['LBL_MINE' => 'mine', 'LBL_ALL' => 'all', 'LBL_USERS' => 'users', 'LBL_GROUPS' => 'groups', 'LBL_GROUP_USERS' => 'groupUsers', 'LBL_ROLE_USERS' => 'roleUsers', 'LBL_ROLE_AND_SUBORDINATES_USERS' => 'rsUsers'];

          Line exceeds 120 characters; contains 181 characters
          Open

                      'LBL_TOTAL_ESTIMATED_VALUE_BY_STATUS', 'LBL_UPCOMING_PROJECT_TASKS', 'LBL_COMPLETED_PROJECT_TASKS', 'LBL_UPDATES', 'DW_TEAMS_ESTIMATED_SALES', 'DW_ACTUAL_SALES_OF_TEAM',

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

               * Get default date range.

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

                      $timeStart = date('Y-m-d', strtotime('last Monday'));

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

              public static function getWidgetSpecial(): array

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

              public function getFilterSelect(): array

          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 getFilterSelectDefault(): array

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

                  return [

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

                      'Leads by Industry', 'Leads by Source', 'Leads by Status Converted', 'Employees Time Control', 'LBL_ALL_TIME_CONTROL',

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

                      'Leads by Source', 'Leads by Status', 'Funnel', 'Upcoming Activities', 'Overdue Activities',

          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 Vtiger_Widget_Model $widgetModel

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

               * @return array range ['2018-03-02','2018-03-04']

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

              {

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

                  } elseif ('week' === $defaultDate) {

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

               * Function to get id of default dashboard.

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

              }

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

                      'month' => 'PLL_CURRENT_MONTH',

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

                  if ('day' === $defaultDate) {

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

                  return [$timeStart, date('Y-m-d', mktime(23, 59, 59, (int) date('n'), (int) date('j'), (int) date('Y')))];

          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

                  $blocks = (new App\Db\Query())->select(['id'])->from('vtiger_module_dashboard_blocks')

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

                  $db->createCommand()->delete('vtiger_module_dashboard_blocks', ['dashboard_id' => $dashboardId])->execute();

          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 (empty($user) && $owners['available']) {

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

                  if (empty($user)) {

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

                  \App\Log::trace('Exiting ' . __METHOD__);

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

                      $moduleName = \App\Module::getModuleName($row['tabid']);

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

              public function addBlock($data, $moduleName, $addToUser)

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

                  $db = App\Db::getInstance();

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

                  return [

          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

              {

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

                      $accessibleGroups = \App\Fields\Owner::getInstance(false, $currentUser)->getAccessibleGroups();

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

                  $dataReader->close();

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

                          'dashboard_id' => $data['dashboardId'],

          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 mixed

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

                          return false;

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

                  } elseif (\in_array('users', $owners['available'])) {

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

                      $user = key($accessibleGroups);

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

                      $user = current($owners['available']);

          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->close();

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

                      ->innerJoin('vtiger_links', 'vtiger_module_dashboard.linkid = vtiger_links.linkid')

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

                      ->where(['vtiger_module_dashboard_blocks.id' => $blockId, 'linktype' => 'DASHBOARDWIDGET', 'vtiger_tab.presence' => 0])

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

                  $tabId = \App\Module::getModuleId($moduleName);

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

                      $status = 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

                  if ($owner) {

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

                  $defaultSelected = $owners['default'];

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

                  } elseif (\in_array('groups', $owners['available'])) {

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

                  $dataReader = (new \App\Db\Query())->from('vtiger_links')

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

                      ->andWhere(['not', ['or', ['linklabel' => self::getWidgetSpecial()], ['vtiger_links.linkid' => $subQuery]]])

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

                      $widgets[] = Vtiger_Widget_Model::getInstanceFromValues($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

              }

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

               * @param mixed               $owner

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

                          next($accessibleUsers);

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

                      $user = false;

          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\Cache::delete('WidgetsDashboard', 'AllTypes');

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

                  $db->createCommand()->delete('u_#__dashboard_type', ['dashboard_id' => $dashboardId])->execute();

          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

                      }

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

                  }

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

                      ->where(['linktype' => 'DASHBOARDWIDGET', 'vtiger_tab.presence' => 0])

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

                      'id' => $db->getLastInsertID('vtiger_module_dashboard_blocks_id_seq'),

          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 (!empty($data['name']) && \in_array($data['name'], $widgetWithLimit)) {

          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 Settings_WidgetsManagement_Module_Model::addWidget(' . $moduleName . ') method ...');

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

                      ->where(['dashboard_id' => $dashboardId])->createCommand()->queryColumn();

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

                  $db->createCommand()->delete('vtiger_module_dashboard_widgets', ['dashboardid' => $dashboardId])->execute();

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

                  return (new App\Db\Query())->from('u_#__dashboard_type')

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

               */

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

                  $currentUser = \App\User::getCurrentUserModel();

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

                      $accessibleGroups = \App\Fields\Owner::getInstance($moduleName, $currentUser)->getAccessibleGroupForModule();

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

                  $owners = \App\Json::decode(html_entity_decode($widgetModel->get('owners')));

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

                      $user = key($accessibleUsers);

          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

                  $subQuery = (new \App\Db\Query())->from('vtiger_module_dashboard')->select(['vtiger_links.linkid'])

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

                      ->select(['vtiger_links.*', 'blockid' => 'vtiger_module_dashboard_blocks.id'])

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

                      ->innerJoin('vtiger_module_dashboard_blocks', 'vtiger_tab.tabid = vtiger_module_dashboard_blocks.tabid')

          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

                  }

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

                      ->insert('vtiger_module_dashboard_blocks', [

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

               * @param string $moduleName

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

                          ->insert('u_#__dashboard_type', ['name' => $dashboardName])

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

                  $db->createCommand()->delete('vtiger_module_dashboard', ['blockid' => $blocks])->execute();

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

                  App\Cache::delete('WidgetsDashboard', 'AllTypes');

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

                      ->where(['dashboard_id' => (int) $dashboardId])

          Line exceeds 120 characters; contains 121 characters
          Open

                      $accessibleGroups = \App\Fields\Owner::getInstance($moduleName, $currentUser)->getAccessibleGroupForModule();

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

                  } elseif ('all' == $defaultSelected && \in_array($defaultSelected, $owners['available'])) {

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

              }

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

                      ->where(['blockid' => $blockId])->andWhere(['not', ['linklabel' => ['Multifilter', 'Upcoming events']]]);

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

                  $db->createCommand()

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

              public function addWidget($data, $moduleName, $addToUser = false)

          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

              /**

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

               * @param array  $data

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

               * @return array

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

              {

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

                  $db = App\Db::getInstance();

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

                          ->execute();

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

              public static function deleteDashboard($dashboardId)

          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

                      $accessibleUsers = \App\Fields\Owner::getInstance(false, $currentUser)->getAccessibleUsers();

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

                      $user = $currentUser->getId();

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

                      $user = $defaultSelected;

          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

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

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

              }

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

                  $status = false;

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

                      if (('all' !== $owner && !isset($accessibleUsers[$owner]) && !isset($accessibleGroups[$owner])) || ('all' === $owner && !\in_array($owner, $owners['available']))) {

          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 $widgets;

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

                  return $widgets;

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

                      ])->execute();

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

                  if ($status && empty($data['limit'])) {

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

                          ->execute();

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

                      App\Db::getInstance()->createCommand()

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

                  $db = App\Db::getInstance();

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

                  $user = '';

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

                  $dataReader = (new \App\Db\Query())->from('vtiger_links')

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

                      $widgets[$moduleName][] = Vtiger_Widget_Model::getInstanceFromValues($row);

          Line exceeds 120 characters; contains 131 characters
          Open

                      ->where(['vtiger_module_dashboard_blocks.id' => $blockId, 'linktype' => 'DASHBOARDWIDGET', 'vtiger_tab.presence' => 0])

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

                  $widgets = [];

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

                  }

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

                          ->update('u_#__dashboard_type', ['name' => $dashboardName], ['dashboard_id' => $dashboardId])

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

               * Function appoints the proper owner.

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

                  if (!\is_array($owners['available'])) {

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

              {

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

                  $widgets = [];

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

                      'success' => true,

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

                  $widgetWithLimit = $this->getWidgetsWithLimit();

          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

               * @param Vtiger_Widget_Model $widgetModel

          Line exceeds 120 characters; contains 176 characters
          Open

                      if (('all' !== $owner && !isset($accessibleUsers[$owner]) && !isset($accessibleGroups[$owner])) || ('all' === $owner && !\in_array($owner, $owners['available']))) {

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

                      return $owner;

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

                  if ('mine' == $defaultSelected && \in_array($defaultSelected, $owners['available'])) {

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

                      reset($owners['available']);

          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

              public function getPredefinedWidgetsByBlock(int $blockId)

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

                          'authorized' => $data['authorized'],

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

                          'tabid' => $tabId,

          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 string              $moduleName

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

                  \App\Log::trace('Entering ' . __METHOD__);

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

                      $accessibleUsers = \App\Fields\Owner::getInstance($moduleName, $currentUser)->getAccessibleUsersForModule();

          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 $user;

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

              public function getSelectableDashboard()

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

                      ->innerJoin('vtiger_tab', 'vtiger_links.tabid = vtiger_tab.tabid')

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

               * @param bool   $addToUser

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

                  if (!empty($data['filterid'])) {

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

                  }

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

                      'default' => $data['default_owner'] ?? '',

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

                  return ['success' => true, 'id' => $templateId, 'wid' => $widgetId ?? '', 'status' => $status, 'text' => \App\Language::translate('LBL_WIDGET_ADDED', 'Settings::WidgetsManagement')];

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

                      ->innerJoin('vtiger_role', 'vtiger_module_dashboard_blocks.authorized = vtiger_role.roleid')

          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

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

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

                      ->where(['tabid' => $tabId, 'dashboard_id' => $dashboard]);

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

                      ->where(['tabid' => $tabId, 'linklabel' => self::getWidgetSpecial()]);

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

                      if (\is_string($data['filterid'])) {

          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' => $data['data'],

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

                  if ($addToUser) {

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

               * @param int $dashboard

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

              public static function getBlocksFromModule($moduleName, $authorized, $dashboard)

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

                      $dashboard = null;

          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->close();

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

                      throw new App\Exceptions\IllegalValue('ERR_VALUE_IS_TOO_LONG||additionalFiltersFields||' . implode(',', $data['data']['additionalFiltersFields']), 406);

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

                  }

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

                      'title' => $data['title'] ?? '',

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

                      'isdefault' => $data['isdefault'],

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

                  return $data;

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

               * @param string $moduleName

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

              public static function getDashboardInfo($dashboardId)

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

              public static function getDefaultUserId($widgetModel, $moduleName = false, $owner = false)

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

                  if ($moduleName) {

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

                      $owners['available'] = [$owners['available']];

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

                      if (key($accessibleUsers) == $currentUser->getId()) {

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

                      ->innerJoin('vtiger_tab', 'vtiger_links.tabid = vtiger_tab.tabid')

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

                  ];

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

               * Add widget.

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

                  $owners = \App\Json::encode([

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

                          'data' => $data['data'],

          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

                  $query = (new \App\Db\Query())->from('vtiger_links')

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

                  $widgets = [];

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

                      $data['isdefault'] = 0;

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

                          $data['data'][$key] = $data[$key];

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

                  if (!empty($data['data']['additionalFiltersFields']) && \count($data['data']['additionalFiltersFields']) > \App\Config::performance('CHART_ADDITIONAL_FILTERS_LIMIT')) {

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

                      'linkid' => $data['linkid'],

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

                      'blockid' => $data['blockid'],

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

                      $active = 0;

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

                          'userid' => \App\User::getCurrentUserId(),

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

                      ->from('vtiger_module_dashboard_blocks')

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

                      $blockId = $row['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

                  $query = (new \App\Db\Query())

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

                  $dataReader->close();

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

                  $dataReader = $query->createCommand()->query();

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

                      if (\count($filters) > \App\Config::performance('CHART_MULTI_FILTER_LIMIT')) {

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

                  $size = \App\Json::encode([

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

                      $db->createCommand()->insert('vtiger_module_dashboard_widgets', [

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

                          'filterid' => $data['filterid'],

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

                          'size' => $size, 'limit' => $data['limit'] ?? null,

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

                          'owners' => $owners,

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

                          'module' => \vtlib\Link::getLinkData($data['linkid'])['tabid'] ?? \App\Module::getModuleId($moduleName),

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

                          'date' => $data['default_date'] ?? null,

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

              }

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

                      $moduleName = \App\Module::getModuleName($tabId);

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

                  \App\Log::trace('getBlocksFromModule(' . $moduleName . ', ' . $authorized . ') method ...');

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

                  return $data;

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

                          unset($data[$key]);

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

                      'size' => $size,

          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 = [];

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

                      $query->andWhere(['authorized' => $authorized]);

          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

                      $widgets[$row['linklabel']] = Vtiger_Widget_Model::getInstanceFromValues($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

                      }

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

                      'date' => $data['default_date'] ?? null,

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

                  \App\Log::trace('Entering Settings_WidgetsManagement_Module_Model::getBlocksId() method ...');

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

                      ->where(['vtiger_module_dashboard_blocks.dashboard_id' => $dashboard])

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

                  if ($authorized) {

          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 (isset($data[$key])) {

          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['data'] = App\Json::encode($data['data']);

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

                      'height' => $data['height'],

          Line exceeds 120 characters; contains 190 characters
          Open

                  return ['success' => true, 'id' => $templateId, 'wid' => $widgetId ?? '', 'status' => $status, 'text' => \App\Language::translate('LBL_WIDGET_ADDED', 'Settings::WidgetsManagement')];

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

                      ->innerJoin('w_#__servers', 'vtiger_module_dashboard_blocks.authorized = w_#__servers.id')

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

                      $data[$moduleName][$blockId]['code'] = $row['authorized'];

          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 = $query->createCommand()->query();

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

                      }

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

                  $db->createCommand()->insert('vtiger_module_dashboard', [

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

                          'active' => $active,

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

                          'cache' => $data['cache'] ?? null,

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

                      $widgetId = $db->getLastInsertID('vtiger_module_dashboard_widgets_id_seq');

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

               * Gets blocks.

          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 Settings_WidgetsManagement_Module_Model::getSpecialWidgets() method ...');

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

                      $data['limit'] = 10;

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

                          throw new App\Exceptions\IllegalValue("ERR_VALUE_IS_TOO_LONG||filterid||{$moduleName}||" . implode(',', $filters), 406);

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

                  foreach (self::getDataKeys() as $key) {

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

                          'linkid' => $data['linkid'],

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

               */

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

              {

          Line exceeds 120 characters; contains 161 characters
          Open

                      ->union((new App\Db\Query())->select(['vtiger_module_dashboard_blocks.*', 'rolename' => 'w_#__servers.name'])->from('vtiger_module_dashboard_blocks')

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

                  return $widgets;

          Line exceeds 120 characters; contains 164 characters
          Open

                      throw new App\Exceptions\IllegalValue('ERR_VALUE_IS_TOO_LONG||additionalFiltersFields||' . implode(',', $data['data']['additionalFiltersFields']), 406);

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

                      'width' => $data['width'],

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

                      'available' => $data['owners_all'] ?? '',

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

                      'filterid' => $data['filterid'] ?? '',

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

                      'cache' => $data['cache'] ?? null,

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

                      if ($data['isdefault']) {

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

                      }

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

                      ])->execute();

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

               *

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

                      ->union((new App\Db\Query())->select(['vtiger_module_dashboard_blocks.*', 'rolename' => 'w_#__servers.name'])->from('vtiger_module_dashboard_blocks')

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

                  if (false === $dashboard) {

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

                          $filters = explode(',', $data['filterid']);

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

                      } elseif (\is_array($data['filterid'])) {

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

                      'limit' => $data['limit'] ?? null,

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

                  ])->execute();

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

                  \App\Log::trace('Exiting Settings_WidgetsManagement_Module_Model::addWidget() 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[$row['authorized']] = $row['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

                  $tabId = \App\Module::getModuleId($moduleName);

          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

                  $data['data'] = App\Json::decode(\App\Purifier::decodeHtml($data['data'] ?? ''));

          Line exceeds 120 characters; contains 176 characters
          Open

                  if (!empty($data['data']['additionalFiltersFields']) && \count($data['data']['additionalFiltersFields']) > \App\Config::performance('CHART_ADDITIONAL_FILTERS_LIMIT')) {

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

                  $templateId = $db->getLastInsertID('vtiger_module_dashboard_id_seq');

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

                          'title' => $data['title'],

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

                  $dataReader->close();

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

                      ->from('vtiger_module_dashboard_blocks')

          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 Settings_WidgetsManagement_Module_Model::getSpecialWidgets($moduleName) 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

              /**

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

               * Gets all id widgets for the module.

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

                          $filters = $data['filterid'];

          Line exceeds 120 characters; contains 136 characters
          Open

                          throw new App\Exceptions\IllegalValue("ERR_VALUE_IS_TOO_LONG||filterid||{$moduleName}||" . implode(',', $filters), 406);

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

                      }

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

                      'owners' => $owners,

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

                          $active = 1;

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

                          'templateid' => $templateId,

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

                          'isdefault' => $data['isdefault'],

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

                          'dashboardid' => empty($data['dashboardId']) ? self::getDefaultDashboard() : $data['dashboardId'],

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

               *

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

                      'mdw.blockid', 'mdw.data', 'mdw.title', 'mdw.filterid', 'mdw.id',

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

                      ->innerJoin('vtiger_links', 'mdw.linkid = vtiger_links.linkid')

          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

                      ->execute();

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

                  if (empty($data['isdefault']) || 1 != $data['isdefault'] || '1' != $data['isdefault']) {

          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

               * @return array

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

              public function getBlocksId(int $dashboard): array

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

                  $dataReader = (new App\Db\Query())->select(['vtiger_module_dashboard_blocks.*', 'vtiger_role.rolename'])

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

                      ->where(['vtiger_module_dashboard_blocks.dashboard_id' => $dashboard])

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

                  $data = [];

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

               *

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

                      $tabId = $row['tabid'];

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

                      ->innerJoin('vtiger_module_dashboard_blocks AS mdb', 'mdw.blockid = mdb.id AND vtiger_links.tabid = mdb.tabid')

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

                      $data[$moduleName][$blockId]['name'] = $row['rolename'];

          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 Settings_WidgetsManagement_Module_Model::getDashboardForModule(' . $moduleName . ') method ...');

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

                  $tabId = \App\Module::getModuleId($moduleName);

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

                      ->delete('vtiger_module_dashboard', ['vtiger_module_dashboard.id' => $data['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

                  $db->createCommand()->delete('vtiger_module_dashboard', ['blockid' => $data['blockid']])->execute();

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

              public static function getSpecialWidgets($moduleName)

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

                  \App\Db::getInstance()->createCommand()

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

                  return ['success' => 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

               * Remove widget.

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

                      'mdw.size', 'mdw.limit', 'mdw.isdefault', 'mdw.owners', 'mdw.cache', 'mdw.date',

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

                  $dataReader->close();

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

               * @return array

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

               * @return array

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

              public function getDashboardForModule($moduleName)

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

                      'vtiger_links.*', 'mdb.authorized',

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

                  }

          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

                  $db = App\Db::getInstance();

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

                  $data = [];

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

              public function removeWidget($data)

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

                  return ['success' => true];

          Line exceeds 120 characters; contains 131 characters
          Open

                  \App\Log::trace('Entering Settings_WidgetsManagement_Module_Model::getDashboardForModule(' . $moduleName . ') 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

              {

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

               * Remove block.

          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 $data;

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

               * @param array $data

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

              public function removeBlock($data)

          Line exceeds 120 characters; contains 123 characters
          Open

                      ->innerJoin('vtiger_module_dashboard_blocks AS mdb', 'mdw.blockid = mdb.id AND vtiger_links.tabid = mdb.tabid')

          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 array

          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

                  \App\Log::trace("Entering Settings_WidgetsManagement_Module_Model::removeBlock({$data['blockid']}) method ...");

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

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

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

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

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

                      ->where(['vtiger_links.tabid' => $tabId])

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

               * @param array $data

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

              {

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

                  $tabId = \App\Module::getModuleId($moduleName);

          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 Settings_WidgetsManagement_Module_Model::getDashboardForModule() 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

              /**

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

              {

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

                  $db->createCommand()->delete('vtiger_module_dashboard_blocks', ['id' => $data['blockid']])->execute();

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

                      ->from('vtiger_module_dashboard AS mdw')

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

                      $data[$row['blockid']][] = Vtiger_Widget_Model::getInstanceFromValues($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

               */

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

               *

          Class name "Settings_WidgetsManagement_Module_Model" is not in camel caps format
          Open

          class Settings_WidgetsManagement_Module_Model extends Settings_Vtiger_Module_Model

          Expected 0 spaces before closing bracket; newline found
          Open

                      ->union((new App\Db\Query())->select(['vtiger_module_dashboard_blocks.*', 'rolename' => 'w_#__servers.name'])->from('vtiger_module_dashboard_blocks')

          There are no issues that match your filters.

          Category
          Status