YetiForceCompany/YetiForceCRM

View on GitHub
modules/Settings/Magento/models/Record.php

Summary

Maintainability
B
4 hrs
Test Coverage
F
0%

Method getFieldInstanceByName has 58 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getFieldInstanceByName($name)
    {
        $moduleName = $this->getModule()->getName(true);
        $fields = $this->getModule()->getFormFields();
        $params = ['label' => 'LBL_' . \strtoupper($name), 'fieldvalue' => $this->get($name) ?? $fields[$name]['default'] ?? '', 'typeofdata' => 'V'];
Severity: Major
Found in modules/Settings/Magento/models/Record.php - About 2 hrs to fix

    Method getRecordLinks has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getRecordLinks(): array
        {
            $links = [];
            $recordLinks = [
                [
    Severity: Minor
    Found in modules/Settings/Magento/models/Record.php - About 1 hr to fix

      Function getFieldInstanceByName has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getFieldInstanceByName($name)
          {
              $moduleName = $this->getModule()->getName(true);
              $fields = $this->getModule()->getFormFields();
              $params = ['label' => 'LBL_' . \strtoupper($name), 'fieldvalue' => $this->get($name) ?? $fields[$name]['default'] ?? '', 'typeofdata' => 'V'];
      Severity: Minor
      Found in modules/Settings/Magento/models/Record.php - About 55 mins 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 setDataFromRequest has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public function setDataFromRequest(App\Request $request)
          {
              foreach ($this->getModule()->getFormFields() as $fieldName => $fieldInfo) {
                  switch ($fieldName) {
                      case 'password':
      Severity: Minor
      Found in modules/Settings/Magento/models/Record.php - About 35 mins 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

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

          public function getFieldInstanceByName($name)
          {
              $moduleName = $this->getModule()->getName(true);
              $fields = $this->getModule()->getFormFields();
              $params = ['label' => 'LBL_' . \strtoupper($name), 'fieldvalue' => $this->get($name) ?? $fields[$name]['default'] ?? '', 'typeofdata' => 'V'];

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

      class Settings_Magento_Record_Model extends Settings_Vtiger_Record_Model
      {
          /**
           * Record ID.
           *

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

                      throw new \App\Exceptions\IllegalValue('ERR_NO_VALUE||' . \App\Language::translate('LBL_' . \strtoupper($fieldName), $this->getModule()->getName(true)), 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_Link_Model' in method 'getRecordLinks'.
      Open

                  $links[] = Vtiger_Link_Model::getInstanceFromValues($recordLink);

      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\Integrations\Magento\Config' in method 'getInstanceById'.
      Open

              if ($row = \App\Integrations\Magento\Config::getServer($id)) {

      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 assigning values to variables in if clauses and the like (line '123', column '7').
      Open

          public static function getInstanceById(int $id)
          {
              $instance = false;
              if ($row = \App\Integrations\Magento\Config::getServer($id)) {
                  $instance = new self();

      IfStatementAssignment

      Since: 2.7.0

      Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

      Example

      class Foo
      {
          public function bar($flag)
          {
              if ($foo = 'bar') { // possible typo
                  // ...
              }
              if ($baz = 0) { // always false
                  // ...
              }
          }
      }

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

      The method save uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
      Open

              } else {
                  $db->createCommand()->insert('i_#__magento_servers', $params)->execute();
                  $this->set('id', $db->getLastInsertID('i_#__magento_servers_id_seq'));
              }

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

              \App\Cache::delete('Magento|getAllServers', '');

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

                          'None' => \App\Language::translate('None'),

      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_Field_Model' in method 'getFieldInstanceByName'.
      Open

              return \Vtiger_Field_Model::init($moduleName, $params, $name);

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

              \App\Cache::delete('Magento|getAllServers', '');

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

                  $this->module = Settings_Vtiger_Module_Model::getInstance('Settings:Magento');

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

                          'IStorages' => \App\Language::translate('SINGLE_IStorages', 'IStorages'),

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

                      $value = \App\Purifier::encodeHtml($value);

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

                          'Products' => \App\Language::translate('SINGLE_Products', 'Products'),

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

              $moduleInstance = Settings_Vtiger_Module_Model::getInstance('Settings:Magento');

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

                      $value = \App\Language::translate(1 == $value ? 'LBL_ACTIVE' : 'LBL_INACTIVE', 'Settings:Magento');

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

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

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

                      throw new \App\Exceptions\IllegalValue('ERR_NO_VALUE||' . \App\Language::translate('LBL_' . \strtoupper($fieldName), $this->getModule()->getName(true)), 406);

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

                      'linkclass' => 'btn btn-sm btn-info',

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

                      'linktype' => 'LISTVIEWRECORD',

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

                      'linkurl' => $this->getEditViewUrl(),

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

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

      Noncompliant Code Example

      With the default threshold of 3:

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

      Compliant Solution

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

      Exceptions

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

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

                      $params['referenceList'] = ['IStorages'];

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

                  ->delete('i_#__magento_servers', ['id' => $this->getId()])

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

                      'linkicon' => 'yfi yfi-full-editing-view',

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

                      'linklabel' => 'BTN_RECORD_EDIT',

      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.

      Add a "case default" clause to this "switch" statement.
      Open

              switch ($name) {

      The requirement for a final case default clause is defensive programming. The clause should either take appropriate action, or contain a suitable comment as to why no action is taken. Even when the switch covers all current values of an enum, a default case should still be used because there is no guarantee that the enum won't be extended.

      Noncompliant Code Example

      switch ($param) {  //missing default clause
        case 0:
          do_something();
          break;
        case 1:
          do_something_else();
          break;
      }
      
      switch ($param) {
        default: // default clause should be the last one
          error();
          break;
        case 0:
          do_something();
          break;
        case 1:
          do_something_else();
          break;
      }
      

      Compliant Solution

      switch ($param) {
        case 0:
          do_something();
          break;
        case 1:
          do_something_else();
          break;
        default:
          error();
          break;
      }
      

      See

      • MISRA C:2004, 15.0 - The MISRA C switch syntax shall be used.
      • MISRA C:2004, 15.3 - The final clause of a switch statement shall be the default clause
      • MISRA C++:2008, 6-4-3 - A switch statement shall be a well-formed switch statement.
      • MISRA C++:2008, 6-4-6 - The final clause of a switch statement shall be the default-clause
      • MISRA C:2012, 16.1 - All switch statements shall be well-formed
      • MISRA C:2012, 16.4 - Every switch statement shall have a default label
      • MISRA C:2012, 16.5 - A default label shall appear as either the first or the last switch label of a switch statement
      • MITRE, CWE-478 - Missing Default Case in Switch Statement
      • CERT, MSC01-C. - Strive for logical completeness
      • CERT, MSC01-CPP. - Strive for logical completeness

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

                      $params['maximumlength'] = '16777215';

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

              $moduleInstance = Settings_Vtiger_Module_Model::getInstance('Settings:Magento');

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

                      'linktype' => 'LISTVIEWRECORD',

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

              $params = ['label' => 'LBL_' . \strtoupper($name), 'fieldvalue' => $this->get($name) ?? $fields[$name]['default'] ?? '', 'typeofdata' => 'V'];

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

                      $params['uitype'] = 7;

      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.

      Return type of getCleanInstance() is undeclared type \self
      Open

          public static function getCleanInstance()

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

                  $db->createCommand()->insert('i_#__magento_servers', $params)->execute();
      Severity: Critical
      Found in modules/Settings/Magento/models/Record.php by phan

      Reference to undeclared property \Settings_Magento_Record_Model->module
      Open

              $instance->module = $moduleInstance;

      Return type of getInstanceById() is undeclared type \self
      Open

          public static function getInstanceById(int $id)

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

              \App\Db::getInstance('admin')->createCommand()
      Severity: Critical
      Found in modules/Settings/Magento/models/Record.php by phan

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

                  $db->createCommand()->update('i_#__magento_servers', $params, ['id' => $this->getId()])->execute();
      Severity: Critical
      Found in modules/Settings/Magento/models/Record.php by phan

      Reference to undeclared property \Settings_Magento_Record_Model->module
      Open

              if (!isset($this->module)) {

      Saw an @param annotation for type, but the param list of function getCleanInstance() : \Settings_Magento_Record_Model|\self is empty
      Open

           * @param string $type

      Reference to undeclared property \Settings_Magento_Record_Model->module
      Open

                  $this->module = Settings_Vtiger_Module_Model::getInstance('Settings:Magento');

      Reference to undeclared property \Settings_Magento_Record_Model->module
      Open

              return $this->module;

      Call to method getInstance from undeclared class \App\Encryption (Did you mean class \Tests\App\Encryption)
      Open

                          $value = \App\Encryption::getInstance()->encrypt($request->getRaw($fieldName));
      Severity: Critical
      Found in modules/Settings/Magento/models/Record.php by phan

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

      class Settings_Magento_Record_Model extends Settings_Vtiger_Record_Model

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

          public static function getInstanceById(int $id)

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

      class Settings_Magento_Record_Model extends Settings_Vtiger_Record_Model
      {
          /**
           * Record ID.
           *

      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('admin');

      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

          }

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

          {

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

                      'linkclass' => 'btn btn-sm btn-danger text-white',

      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

                      $params['isEditableReadOnly'] = false;

      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

                      break;

      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 URL

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

              return '?parent=Settings&module=Magento&action=SaveAjax&mode=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

              return $instance;

      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 $this->module;

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

              switch ($name) {

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

                      $params['typeofdata'] = 'I';

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

                      $params['isEditableReadOnly'] = false;

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

                  case 'url':

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

                      $params['uitype'] = 17;

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

                      $params['maximumlength'] = '250';

      Line exceeds 120 characters; contains 124 characters
      Open

                          $value = $request->isEmpty($fieldName) ? '' : $request->getByType($fieldName, $fieldInfo['purifyType']);

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

              return $this->get('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

          }

      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

              $recordLinks = [

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

                      'linkicon' => 'yfi yfi-full-editing-view',

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

                      'linkurl' => "javascript:Settings_Magento_List_Js.reload('{$this->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

           *

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

          public static function getCleanInstance()

      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

              $fields = $this->getModule()->getFormFields();

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

                      $params['typeofdata'] = 'I';

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

                  case 'customers_limit':

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

           * Record ID.

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

           * Function to get the Save Ajax.

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

           * @return string URL

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

          public function getRecordLinks(): 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

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

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

              \App\Cache::delete('Magento|getAllServers', '');

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

           * @param int $id

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

                  $instance = new self();

      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

                  $this->set('id', $db->getLastInsertID('i_#__magento_servers_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

           * @return Settings_Vtiger_Field_Model

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

          public function getFieldInstanceByName($name)

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

                      $params['maximumlength'] = '65535';

      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

                  default:

      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

                  switch ($fieldName) {

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

           */

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

           * Function to get the Detail Url.

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

          public function getEditViewUrl()

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

                      'linkclass' => 'btn btn-sm btn-info',

      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

                      'linklabel' => 'LBL_DELETE_RECORD',

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

                  $instance->setData($row);

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

              if ($this->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

              if (!isset($this->module)) {

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

                  case 'invoices_limit':

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

                      $params['referenceList'] = ['IStorages'];

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

                      $params['picklistValues'] = ['Token' => 'Token'];

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

                          'Products' => \App\Language::translate('SINGLE_Products', 'Products'),

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

                      $params['uitype'] = 56;

      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 $this->get('id');

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

          public function getName()

      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 \self

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

           */

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

              $instance = new self();

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

                  $db->createCommand()->update('i_#__magento_servers', $params, ['id' => $this->getId()])->execute();

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

                      $params['maximumlength'] = '16777215';

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

                      $params['uitype'] = 10;

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

                  case 'payment_paypal_service_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

              $value = $this->get($key);

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

          public function setDataFromRequest(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

           * @return string

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

          public function getDetailViewUrl()

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

              return 'index.php?parent=Settings&module=Magento&view=Edit&record=' . $this->getId();

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

                      'linklabel' => 'BTN_RECORD_EDIT',

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

                      'linktype' => 'LISTVIEWRECORD',

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

                      'linkicon' => 'fas fa-trash-alt',

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

                  ->delete('i_#__magento_servers', ['id' => $this->getId()])

      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

          /**

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

                  $this->module = Settings_Vtiger_Module_Model::getInstance('Settings:Magento');

      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 $name

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

                      $params['uitype'] = 7;

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

                      $params['uitype'] = 7;

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

                  case 'storage_id':

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

                  case 'sync_categories':

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

                  case '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

                  $this->set($fieldName, $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

          /**

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

              if ($row = \App\Integrations\Magento\Config::getServer($id)) {

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

           * Function to get the clean instance.

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

           * Function to save.

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

                  $params[$key] = $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

          public function getModule()

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

              $moduleName = $this->getModule()->getName(true);

      Line exceeds 120 characters; contains 150 characters
      Open

              $params = ['label' => 'LBL_' . \strtoupper($name), 'fieldvalue' => $this->get($name) ?? $fields[$name]['default'] ?? '', 'typeofdata' => 'V'];

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

                          'IStorages' => \App\Language::translate('SINGLE_IStorages', 'IStorages'),

      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

                  case 'sync_orders':

      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

                      'linkclass' => 'btn btn-sm btn-warning text-white',

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

                  $links[] = Vtiger_Link_Model::getInstanceFromValues($recordLink);

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

           * @return \self instance, if exists

      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('i_#__magento_servers', $params)->execute();

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

                  case 'sync_products':

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

                  case 'sync_invoices':

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

                      $value = \App\Purifier::encodeHtml($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

                      case 'password':

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

                  if ('' === $value && $fieldInfo['required']) {

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

          public function 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

          }

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

                      'linktype' => 'LISTVIEWRECORD',

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

                      'linkurl' => "javascript:Settings_Vtiger_List_Js.deleteById('{$this->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

           *

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

                  case 'store_id':

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

                  case 'products_limit':

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

              switch ($key) {

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

                          $value = $request->isEmpty($fieldName) ? '' : $request->getByType($fieldName, $fieldInfo['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

          /**

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

           * Function to get the Edit View Url.

      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 ($recordLinks as $recordLink) {

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

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

          {

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

              } else {

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

              $params = ['label' => 'LBL_' . \strtoupper($name), 'fieldvalue' => $this->get($name) ?? $fields[$name]['default'] ?? '', 'typeofdata' => 'V'];

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

                  case 'categories_limit':

      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

                  case 'sync_customers':

      Line exceeds 120 characters; contains 174 characters
      Open

                      throw new \App\Exceptions\IllegalValue('ERR_NO_VALUE||' . \App\Language::translate('LBL_' . \strtoupper($fieldName), $this->getModule()->getName(true)), 406);

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

                      'linklabel' => 'LBL_RELOAD_MAGENTO',

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

              return $links;

      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

           * Get field instance by 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

                      $params['referenceList'] = ['Services'];

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

                      $params['uitype'] = 16;

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

                      $params['picklistValues'] = [

      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

              $params['typeofdata'] .= $fields[$name]['required'] ? '~M' : '~O';

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

          public function getDisplayValue(string $key)

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

           * Sets data from 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

           * @return int

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

           * @return string URL

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

              return '?parent=Settings&module=Magento&view=Edit&record=' . $this->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

           *

      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 delete the current record model.

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

              return $instance;

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

          public function save()

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

              foreach ($this->getData() as $key => $value) {

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

              \App\Cache::delete('Magento|getAllServers', '');

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

           * Function to get Module instance.

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

          {

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

           * @throws ReflectionException

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

                  case 'orders_limit':

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

                      $params['uitype'] = 10;

      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

                      break;

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

              return $value;

      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

                      default:

      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

          }

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

              $links = [];

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

                      'linkicon' => 'mdi mdi-reload',

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

           */

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

              $instance = false;

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

           * @param string $type

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

              $moduleInstance = Settings_Vtiger_Module_Model::getInstance('Settings:Magento');

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

              $instance->module = $moduleInstance;

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

           * @return Settings_Magento_Module_Model

      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

                      break;

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

                  case 'shipping_service_id':

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

                  case 'connector':

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

                      $params['uitype'] = 16;

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

                  case 'sync_currency':

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

              return \Vtiger_Field_Model::init($moduleName, $params, $name);

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

                      $value = \App\Language::translate(1 == $value ? 'LBL_ACTIVE' : 'LBL_INACTIVE', 'Settings:Magento');

      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 ($this->getModule()->getFormFields() as $fieldName => $fieldInfo) {

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

                          $value = \App\Encryption::getInstance()->encrypt($request->getRaw($fieldName));

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

                      throw new \App\Exceptions\IllegalValue('ERR_NO_VALUE||' . \App\Language::translate('LBL_' . \strtoupper($fieldName), $this->getModule()->getName(true)), 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

          public function getSaveAjaxActionUrl()

      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

                      'linkurl' => $this->getEditViewUrl(),

      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

           * Function to get the instance of record 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

          /**

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

                          'None' => \App\Language::translate('None'),

      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

          {

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

          /**

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

           * Record name.

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

                      'linktype' => 'LISTVIEWRECORD',

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

          public static function getInstanceById(int $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 = App\Db::getInstance('admin');

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

              $params = [];

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

           */

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

                  case 'payment_cash_service_id':

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

                  case 'storage_quantity_location':

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

                  case '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

                          $fieldModel = $this->getFieldInstanceByName($fieldName)->getUITypeModel();

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

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

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

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

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

      class Settings_Magento_Record_Model extends Settings_Vtiger_Record_Model

      There are no issues that match your filters.

      Category
      Status