YetiForceCompany/YetiForceCRM

View on GitHub
modules/Settings/Picklist/actions/SaveAjax.php

Summary

Maintainability
C
7 hrs
Test Coverage
F
0%

import accesses the super-global variable $_FILES.
Open

    public function import(App\Request $request): void
    {
        if (empty($_FILES['file']['name'])) {
            throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406);
        }

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

import accesses the super-global variable $_FILES.
Open

    public function import(App\Request $request): void
    {
        if (empty($_FILES['file']['name'])) {
            throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406);
        }

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

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

    public function import(App\Request $request): void
    {
        if (empty($_FILES['file']['name'])) {
            throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406);
        }
Severity: Minor
Found in modules/Settings/Picklist/actions/SaveAjax.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 import has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function import(App\Request $request): void
    {
        if (empty($_FILES['file']['name'])) {
            throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406);
        }
Severity: Major
Found in modules/Settings/Picklist/actions/SaveAjax.php - About 2 hrs to fix

    Function getItemModelFromRequest has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function getItemModelFromRequest(App\Request $request): App\Fields\Picklist\Item
        {
            $moduleName = $request->getByType('source_module', \App\Purifier::ALNUM);
            $pickListFieldName = $request->getByType('picklistName', \App\Purifier::ALNUM);
            $moduleModel = Vtiger_Module_Model::getInstance($moduleName);
    Severity: Minor
    Found in modules/Settings/Picklist/actions/SaveAjax.php - About 1 hr to fix

    Cognitive Complexity

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

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

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

    Further reading

    Method getItemModelFromRequest has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function getItemModelFromRequest(App\Request $request): App\Fields\Picklist\Item
        {
            $moduleName = $request->getByType('source_module', \App\Purifier::ALNUM);
            $pickListFieldName = $request->getByType('picklistName', \App\Purifier::ALNUM);
            $moduleModel = Vtiger_Module_Model::getInstance($moduleName);
    Severity: Minor
    Found in modules/Settings/Picklist/actions/SaveAjax.php - About 1 hr to fix

      The method import() has an NPath complexity of 960. The configured NPath complexity threshold is 200.
      Open

          public function import(App\Request $request): void
          {
              if (empty($_FILES['file']['name'])) {
                  throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406);
              }

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

          public function import(App\Request $request): void
          {
              if (empty($_FILES['file']['name'])) {
                  throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406);
              }

      CyclomaticComplexity

      Since: 0.1

      Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

      Example

      // Cyclomatic Complexity = 11
      class Foo {
      1   public function example() {
      2       if ($a == $b) {
      3           if ($a1 == $b1) {
                      fiddle();
      4           } elseif ($a2 == $b2) {
                      fiddle();
                  } else {
                      fiddle();
                  }
      5       } elseif ($c == $d) {
      6           while ($c == $d) {
                      fiddle();
                  }
      7        } elseif ($e == $f) {
      8           for ($n = 0; $n < $h; $n++) {
                      fiddle();
                  }
              } else {
                  switch ($z) {
      9               case 1:
                          fiddle();
                          break;
      10              case 2:
                          fiddle();
                          break;
      11              case 3:
                          fiddle();
                          break;
                      default:
                          fiddle();
                          break;
                  }
              }
          }
      }

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

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

          public function import(App\Request $request): void

      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_Picklist_SaveAjax_Action has a coupling between objects value of 18. Consider to reduce the number of dependencies under 13.
      Open

      class Settings_Picklist_SaveAjax_Action extends Settings_Vtiger_Basic_Action
      {
          use \App\Controller\ExposeMethod;
      
          /**

      CouplingBetweenObjects

      Since: 1.1.0

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

      Example

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

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

      Missing class import via use statement (line '56', column '14').
      Open

                  throw new \App\Exceptions\NoPermittedForAdmin('LBL_PERMISSION_DENIED');

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

              $response = new Vtiger_Response();

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

                  throw new \App\Exceptions\NoPermittedForAdmin('LBL_PERMISSION_DENIED');

      MissingImport

      Since: 2.7.0

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

      Example

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

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

      Missing class import via use statement (line '50', column '14').
      Open

                  throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 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 '176', column '19').
      Open

              $response = new Vtiger_Response();

      MissingImport

      Since: 2.7.0

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

      Example

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

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

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

              $moduleModel = new Settings_Picklist_Module_Model();

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

              $response = new Vtiger_Response();

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

              $response = new Vtiger_Response();

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

                  throw new \App\Exceptions\NoPermittedForAdmin('LBL_PERMISSION_DENIED');

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

              $response = new Vtiger_Response();

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

              $moduleModel = new Settings_Picklist_Module_Model();

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

              $csv = new \ParseCsv\Csv();

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

              $response = new Vtiger_Response();

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

                  throw new \App\Exceptions\NoPermittedForAdmin('LBL_PERMISSION_DENIED');

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

                  throw new \App\Exceptions\NoPermittedForAdmin('LBL_PERMISSION_DENIED');

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

              $response = new Vtiger_Response();

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

              $moduleModel = new Settings_Picklist_Module_Model();

      MissingImport

      Since: 2.7.0

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

      Example

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

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

      Missing class import via use statement (line '61', column '14').
      Open

                  throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 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

      Avoid using static access to class 'Vtiger_Module_Model' in method 'enableOrDisable'.
      Open

              $fieldModel = Settings_Picklist_Field_Model::getInstance($pickListFieldName, Vtiger_Module_Model::getInstance($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 'Settings_Roles_Record_Model' in method 'import'.
      Open

              $rolesSelected = $fieldModel->isRoleBased() ? array_keys(Settings_Roles_Record_Model::getAll()) : [];

      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 'Settings_Picklist_Field_Model' in method 'enableOrDisable'.
      Open

              $fieldModel = Settings_Picklist_Field_Model::getInstance($pickListFieldName, Vtiger_Module_Model::getInstance($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\Fields\Picklist' in method 'remove'.
      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 'Settings_Vtiger_Tracker_Model' in method '__construct'.
      Open

              Settings_Vtiger_Tracker_Model::setRecordId($recordId);

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

              if (\App\Request::_has('picklistName')) {

      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 'Settings_Roles_Record_Model' in method 'getItemModelFromRequest'.
      Open

                              $roleIdList = array_keys(Settings_Roles_Record_Model::getAll());

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

                      } else {
                          $value = $request->getByType($fieldName, $fieldModel->get('purifyType'));
                          $fieldUITypeModel = $fieldModel->getUITypeModel();
                          $fieldUITypeModel->validate($value, true);
                          $value = $fieldModel->getDBValue($value);

      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 'Settings_Vtiger_Tracker_Model' in method 'edit'.
      Open

              Settings_Vtiger_Tracker_Model::addDetail($itemModel->getPreviousValue(), $valueId ? array_intersect_key($itemModel->getData(), $itemModel->getPreviousValue()) : $itemModel->getData());

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

              Settings_Vtiger_Tracker_Model::addBasic('save');

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

              if (!$fileInstance->validate() || 'csv' !== $fileInstance->getExtension() || $fileInstance->getSize() > \App\Config::getMaxUploadSize()) {

      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\Fields\File' in method 'import'.
      Open

              $fileInstance = \App\Fields\File::loadFromRequest($_FILES['file']);

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

              if ($fileInstance->getEncoding(['UTF-8', 'ISO-8859-1']) !== \App\Config::main('default_charset', 'UTF-8')) {

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

                  $csv->encoding($fileInstance->getEncoding(), \App\Config::main('default_charset', 'UTF-8'));

      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_Module_Model' in method 'import'.
      Open

              $moduleModel = Vtiger_Module_Model::getInstance($request->getByType('source_module', \App\Purifier::ALNUM));

      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\Colors' in method 'edit'.
      Open

              \App\Colors::generate('picklist');

      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 'Settings_Roles_Record_Model' in method 'assignValueToRole'.
      Open

                  $roleIdList = array_keys(Settings_Roles_Record_Model::getAll());

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

                  $request = \App\Request::init();

      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 'Settings_Picklist_Field_Model' in method 'getItemModelFromRequest'.
      Open

              $fieldModel = Settings_Picklist_Field_Model::getInstance($pickListFieldName, $moduleModel);

      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 'Settings_Picklist_Field_Model' in method 'import'.
      Open

              $fieldModel = Settings_Picklist_Field_Model::getInstance($request->getForSql('picklistName'), $moduleModel);

      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 'Settings_Vtiger_Tracker_Model' in method 'remove'.
      Open

              Settings_Vtiger_Tracker_Model::addDetail(['name' => $itemModel->get('name')], ['name' => $picklisValue]);

      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_Module_Model' in method 'getItemModelFromRequest'.
      Open

              $moduleModel = Vtiger_Module_Model::getInstance($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\Colors' in method 'remove'.
      Open

              \App\Colors::generate('picklist');

      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 'Settings_Picklist_Field_Model' in method 'assignValueToRole'.
      Open

              $fieldModel = Settings_Picklist_Field_Model::getInstance($pickListFieldName, Vtiger_Module_Model::getInstance($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_Module_Model' in method 'assignValueToRole'.
      Open

              $fieldModel = Settings_Picklist_Field_Model::getInstance($pickListFieldName, Vtiger_Module_Model::getInstance($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

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

                  $moduleName = $request->getByType('source_module', \App\Purifier::ALNUM);

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

              if ($fileInstance->getEncoding(['UTF-8', 'ISO-8859-1']) !== \App\Config::main('default_charset', 'UTF-8')) {

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

                  'success' => $successCounter,

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

              if (\App\Request::_has('picklistName')) {

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

                  throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406);

      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.

      Call to method set from undeclared class \App\Fields\Picklist\Item
      Open

                              $itemModel->set($property, $row[$key]);

      Call to method getId from undeclared class \App\Fields\Picklist\Item
      Open

              $valueId = $itemModel->getId();

      Call to method getPreviousValue from undeclared class \App\Fields\Picklist\Item
      Open

              Settings_Vtiger_Tracker_Model::addDetail($itemModel->getPreviousValue(), $valueId ? array_intersect_key($itemModel->getData(), $itemModel->getPreviousValue()) : $itemModel->getData());

      Call to method save from undeclared class \App\Fields\Picklist\Item
      Open

                      $itemModel->save();

      Call to method encoding from undeclared class \ParseCsv\Csv
      Open

                  $csv->encoding($fileInstance->getEncoding(), \App\Config::main('default_charset', 'UTF-8'));

      Call to method getData from undeclared class \App\Fields\Picklist\Item
      Open

              Settings_Vtiger_Tracker_Model::addDetail($itemModel->getPreviousValue(), $valueId ? array_intersect_key($itemModel->getData(), $itemModel->getPreviousValue()) : $itemModel->getData());

      Call to method delete from undeclared class \App\Fields\Picklist\Item
      Open

              $itemModel->delete($replaceId);

      Call to method __construct from undeclared class \ParseCsv\Csv
      Open

              $csv = new \ParseCsv\Csv();

      Call to method getEditFields from undeclared class \App\Fields\Picklist\Item
      Open

              foreach ($itemModel->getEditFields() as $fieldName => $fieldModel) {

      Call to method isDeletable from undeclared class \App\Fields\Picklist\Item
      Open

              if (!$itemModel->isDeletable() || !$request->getInteger('replace_value', 0)) {

      Reference to instance property use_mb_convert_encoding from undeclared class \ParseCsv\Csv
      Open

              $csv->use_mb_convert_encoding = true;

      Return type of getItemModelFromRequest() is undeclared type \App\Fields\Picklist\Item
      Open

          protected function getItemModelFromRequest(App\Request $request): App\Fields\Picklist\Item

      Call to method get from undeclared class \App\Fields\Picklist\Item
      Open

              Settings_Vtiger_Tracker_Model::addDetail(['name' => $itemModel->get('name')], ['name' => $picklisValue]);

      Call to method set from undeclared class \App\Fields\Picklist\Item
      Open

                          $itemModel->set($fieldName, $roleIdList);

      Call to method set from undeclared class \App\Fields\Picklist\Item
      Open

                          $itemModel->set('roles', $rolesSelected);

      Reference to instance property heading from undeclared class \ParseCsv\Csv
      Open

              $csv->heading = false;

      Call to method auto from undeclared class \ParseCsv\Csv
      Open

              $csv->auto($fileInstance->getPath());

      Call to method validate from undeclared class \App\Fields\Picklist\Item
      Open

              $response->setResult($itemModel->validate());

      Call to method getFieldModel from undeclared class \App\Fields\Picklist\Item
      Open

              $picklisValue = \App\Fields\Picklist::getValues($itemModel->getFieldModel()->getName())[$replaceId]['picklistValue'] ?? '';

      Call to method save from undeclared class \App\Fields\Picklist\Item
      Open

              $result = $itemModel->save();

      Call to method validateValue from undeclared class \App\Fields\Picklist\Item
      Open

                              $itemModel->validateValue($property, $row[$key]);

      Reference to instance property data from undeclared class \ParseCsv\Csv
      Open

              foreach ($csv->data as $lineNo => $row) {

      Call to method set from undeclared class \App\Fields\Picklist\Item
      Open

                          $itemModel->set($fieldName, $value);

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

      class Settings_Picklist_SaveAjax_Action extends Settings_Vtiger_Basic_Action

      The class Settings_Picklist_SaveAjax_Action is not named in CamelCase.
      Open

      class Settings_Picklist_SaveAjax_Action extends Settings_Vtiger_Basic_Action
      {
          use \App\Controller\ExposeMethod;
      
          /**

      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 $id. Configured minimum length is 3.
      Open

              $id = $request->getInteger('primaryKeyId', 0);

      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

              $this->exposeMethod('remove');

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

              if (\App\Request::_has('picklistName')) {

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

                  $recordId = Vtiger_Module_Model::getInstance($moduleName)->getFieldByName($pickListFieldName)->getId();

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

          {

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

              $this->exposeMethod('import');

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

              $this->exposeMethod('edit');

      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 __construct()

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

              }

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

              parent::__construct();

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

           * Constructor.

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

              $this->exposeMethod('assignValueToRole');

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

          {

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

              $moduleModel = Vtiger_Module_Model::getInstance($request->getByType('source_module', \App\Purifier::ALNUM));

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

                  $csv->encoding($fileInstance->getEncoding(), \App\Config::main('default_charset', 'UTF-8'));

      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

                  'success' => $successCounter,

      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 (!$id && !$fieldModel->isEditable()) {

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

                      if ('roles' === $fieldName) {

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

                          $value = $fieldModel->getDBValue($value);

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

              }

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

          use \App\Controller\ExposeMethod;

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

          /**

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

                  $request = \App\Request::init();

      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

              $moduleModel = Vtiger_Module_Model::getInstance($moduleName);

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

              $fieldModel = Settings_Picklist_Field_Model::getInstance($pickListFieldName, $moduleModel);

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

                  if ($request->has($fieldName) && !$fieldModel->isEditableReadOnly()) {

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

                          $fieldUITypeModel = $fieldModel->getUITypeModel();

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

                          $fieldUITypeModel->validate($value, true);

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

              return $itemModel;

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

              \App\Colors::generate('picklist');

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

           * Action to remove element.

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

                          $itemModel->set('roles', $rolesSelected);

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

              }

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

              $pickListFieldName = $request->getByType('picklistName', \App\Purifier::ALNUM);

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

           * Edit picklist value 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

              $valueId = $itemModel->getId();

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

           * @param \App\Request $request

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

                  $moduleName = $request->getByType('source_module', \App\Purifier::ALNUM);

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

              Settings_Vtiger_Tracker_Model::addBasic('save');

      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($_FILES['file']['name'])) {

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

                      }

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

                      $itemModel->save();

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

                      ++$successCounter;

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

                  'errors' => $errorsCounter,

      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 the picklist value model based on the request parameters.

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

           * @param \App\Request $request

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

              $itemModel = $fieldModel->getItemModel($id);

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

                              $roleIdList = array_keys(Settings_Roles_Record_Model::getAll());

      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 edit(App\Request $request)

      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 function import(App\Request $request): void

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

                  throw new \App\Exceptions\NoPermittedForAdmin('LBL_PERMISSION_DENIED');

      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

              foreach ($itemModel->getEditFields() as $fieldName => $fieldModel) {

      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

              $itemModel = $this->getItemModelFromRequest($request);

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

              if (!$fieldModel->isEditable()) {

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

              $allCounter = $successCounter = $errorsCounter = 0;

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

                              $itemModel->set($property, $row[$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

          }

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

                  throw new \App\Exceptions\NoPermittedForAdmin('LBL_PERMISSION_DENIED');

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

              Settings_Vtiger_Tracker_Model::setRecordId($recordId);

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

              foreach ($csv->data as $lineNo => $row) {

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

                      foreach (['name' => 0, 'description' => 1, 'prefix' => 2] as $property => $key) {

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

          protected function getItemModelFromRequest(App\Request $request): App\Fields\Picklist\Item

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

              $itemModel = $this->getItemModelFromRequest($request);

      Line exceeds 120 characters; contains 192 characters
      Open

              Settings_Vtiger_Tracker_Model::addDetail($itemModel->getPreviousValue(), $valueId ? array_intersect_key($itemModel->getData(), $itemModel->getPreviousValue()) : $itemModel->getData());

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

              $response->emit();

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

              $recordId = 0;

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

                  $pickListFieldName = $request->getByType('picklistName', \App\Purifier::ALNUM);

      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

              if (!$fileInstance->validate() || 'csv' !== $fileInstance->getExtension() || $fileInstance->getSize() > \App\Config::getMaxUploadSize()) {

      Line exceeds 120 characters; contains 146 characters
      Open

              if (!$fileInstance->validate() || 'csv' !== $fileInstance->getExtension() || $fileInstance->getSize() > \App\Config::getMaxUploadSize()) {

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

              $csv = new \ParseCsv\Csv();

      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 void

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

              $moduleName = $request->getByType('source_module', \App\Purifier::ALNUM);

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

              }

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

              $response->setResult(['success' => $result]);

      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 void

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

              $csv->heading = false;

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

              $rolesSelected = $fieldModel->isRoleBased() ? array_keys(Settings_Roles_Record_Model::getAll()) : [];

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

                      $error .= "[$lineNo] '{$row[0]}': {$th->getMessage()}\n";

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

              ]);

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

              $response->emit();

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

           * @return \App\Fields\Picklist\Item

      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 remove(App\Request $request)

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

              $itemModel->delete($replaceId);

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

                  throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406);

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

                  throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406);

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

                  if ('' === $row[0]) {

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

                      if ($rolesSelected) {

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

                      ++$errorsCounter;

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

                  throw new \App\Exceptions\NoPermittedForAdmin('LBL_PERMISSION_DENIED');

      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

              $fileInstance = \App\Fields\File::loadFromRequest($_FILES['file']);

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

              if ($fileInstance->getEncoding(['UTF-8', 'ISO-8859-1']) !== \App\Config::main('default_charset', 'UTF-8')) {

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

                  } catch (\Throwable $th) {

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

                  'all' => $allCounter,

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

              $response->emit();

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

           * @param \App\Request $request

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

           * Import Picklist.

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

           * @param App\Request $request

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

              }

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

              $csv->auto($fileInstance->getPath());

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

                  ++$allCounter;

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

                      $itemModel = $fieldModel->getItemModel();

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

              $itemModel = $this->getItemModelFromRequest($request);

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

              $response->setResult($itemModel->validate());

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

              if (!$itemModel->isDeletable() || !$request->getInteger('replace_value', 0)) {

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

              $this->exposeMethod('saveOrder');

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

              $fieldModel = Settings_Picklist_Field_Model::getInstance($request->getForSql('picklistName'), $moduleModel);

      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

              $id = $request->getInteger('primaryKeyId', 0);

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

              Settings_Vtiger_Tracker_Model::addDetail($itemModel->getPreviousValue(), $valueId ? array_intersect_key($itemModel->getData(), $itemModel->getPreviousValue()) : $itemModel->getData());

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

              $response = new Vtiger_Response();

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

              $this->exposeMethod('enableOrDisable');

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

          }

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

              $csv->use_mb_convert_encoding = true;

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

                              $itemModel->validateValue($property, $row[$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

              $response = new Vtiger_Response();

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

          /**

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

                          $value = $request->getByType($fieldName, $fieldModel->get('purifyType'));

      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

              $replaceId = $request->getInteger('replace_value');

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

              $this->exposeMethod('preSaveValidation');

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

              $error = '';

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

                      continue;

      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

                          $roleIdList = $request->getArray($fieldName, \App\Purifier::ALNUM);

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

                          }

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

              $result = $itemModel->save();

      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

              $moduleName = $request->getByType('source_module', \App\Purifier::ALNUM);

      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 void

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

                  $response->setException($e);

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

              \App\Colors::generate('picklist');

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

                  $moduleModel->enableOrDisableValuesForRole(

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

                  $response->setException($e);

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

              $moduleModel = new Settings_Picklist_Module_Model();

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

              } catch (Exception $e) {

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

                      $request->getByType('picklistName', \App\Purifier::ALNUM),

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

          public function assignValueToRole(App\Request $request)

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

                  $response->setResult(['success', true]);

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

              } catch (Exception $e) {

      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 saveOrder(App\Request $request)

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

              $response = new Vtiger_Response();

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

              $response->emit();

      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 131 characters
      Open

              $picklisValue = \App\Fields\Picklist::getValues($itemModel->getFieldModel()->getName())[$replaceId]['picklistValue'] ?? '';

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

          /**

      Line exceeds 120 characters; contains 132 characters
      Open

              $fieldModel = Settings_Picklist_Field_Model::getInstance($pickListFieldName, Vtiger_Module_Model::getInstance($moduleName));

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

                  $moduleModel->updateSequence($request->getForSql('picklistName'), $request->getArray('seq', \App\Purifier::INTEGER, [], \App\Purifier::INTEGER));

      Line exceeds 120 characters; contains 157 characters
      Open

                  $moduleModel->updateSequence($request->getForSql('picklistName'), $request->getArray('seq', \App\Purifier::INTEGER, [], \App\Purifier::INTEGER));

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

                  $response->setException($e);

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

           *

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

              $fieldModel = Settings_Picklist_Field_Model::getInstance($pickListFieldName, Vtiger_Module_Model::getInstance($moduleName));

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

                      $request->getArray('disabled_values', \App\Purifier::INTEGER),

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

              $fieldModel = Settings_Picklist_Field_Model::getInstance($pickListFieldName, Vtiger_Module_Model::getInstance($moduleName));

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

              if (\in_array('all', $roleIdList)) {

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

                  $roleIdList = array_keys(Settings_Roles_Record_Model::getAll());

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

              $response = new Vtiger_Response();

      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

              if (!$fieldModel->isEditable()) {

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

                  throw new \App\Exceptions\NoPermittedForAdmin('LBL_PERMISSION_DENIED');

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

              }

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

                      $roleIdList);

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

              $response->emit();

      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

                  try {

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

                          if (isset($row[$key])) {

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

              $response = new Vtiger_Response();

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

              $response->setResult([

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

                  'errorMessage' => $error,

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

           * PreSave validation function.

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

           * @param App\Request $request

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

          public function preSaveValidation(App\Request $request)

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

                          if (\in_array('all', $roleIdList)) {

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

                          $itemModel->set($fieldName, $roleIdList);

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

                          $itemModel->set($fieldName, $value);

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

              $response->setResult(['success' => true]);

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

           * Save picklist values order.

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

                  $response->setResult(['success', true]);

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

           * @return void

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

              }

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

              $response = new Vtiger_Response();

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

              $picklisValue = \App\Fields\Picklist::getValues($itemModel->getFieldModel()->getName())[$replaceId]['picklistValue'] ?? '';

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

           * @param \App\Request $request

      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

           * @param App\Request $request

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

              $response = new Vtiger_Response();

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

                  $response->setResult(['success', true]);

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

              Settings_Vtiger_Tracker_Model::addDetail(['name' => $itemModel->get('name')], ['name' => $picklisValue]);

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

                      [],

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

              try {

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

                  throw new \App\Exceptions\NoPermittedForAdmin('LBL_PERMISSION_DENIED');

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

              $moduleModel = new Settings_Picklist_Module_Model();

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

          {

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

              $roleIdList = $request->getArray('rolesSelected', \App\Purifier::ALNUM);

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

                      $request->getArray('assign_values', \App\Purifier::INTEGER),

      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

              $moduleName = $request->getByType('source_module', \App\Purifier::ALNUM);

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

              $pickListFieldName = $request->getByType('picklistName', \App\Purifier::ALNUM);

      Line exceeds 120 characters; contains 132 characters
      Open

              $fieldModel = Settings_Picklist_Field_Model::getInstance($pickListFieldName, Vtiger_Module_Model::getInstance($moduleName));

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

              try {

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

              $pickListFieldName = $request->getByType('picklistName', \App\Purifier::ALNUM);

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

           * Change state of picklist values permissions.

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

                  $moduleModel->enableOrDisableValuesForRole(

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

              try {

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

                      $pickListFieldName,

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

           */

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

                      $request->getArray('rolesSelected', \App\Purifier::ALNUM));

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

              } catch (Exception $e) {

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

              $moduleModel = new Settings_Picklist_Module_Model();

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

          public function enableOrDisable(App\Request $request)

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

          }

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

              $response->emit();

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

           * Function which will assign existing values to the roles.

      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 (!$fieldModel->isEditable()) {

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

           * @param App\Request $request

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

                      $request->getArray('enabled_values', \App\Purifier::INTEGER),

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

              $response->emit();

      Class name "Settings_Picklist_SaveAjax_Action" is not in camel caps format
      Open

      class Settings_Picklist_SaveAjax_Action extends Settings_Vtiger_Basic_Action

      Multi-line function call not indented correctly; expected 12 spaces but found 16
      Open

                      $roleIdList);

      Multi-line function call not indented correctly; expected 12 spaces but found 16
      Open

                      $request->getArray('rolesSelected', \App\Purifier::ALNUM));

      Closing parenthesis of a multi-line function call must be on a line by itself
      Open

                      $roleIdList);

      Closing parenthesis of a multi-line function call must be on a line by itself
      Open

                      $request->getArray('rolesSelected', \App\Purifier::ALNUM));

      There are no issues that match your filters.

      Category
      Status