YetiForceCompany/YetiForceCRM

View on GitHub
modules/Settings/AdminAccess/actions/GetData.php

Summary

Maintainability
C
1 day
Test Coverage
F
0%

Method access has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function access(App\Request $request)
    {
        $rows = $columns = $userData = [];
        foreach ($request->getArray('columns') as $key => $value) {
            $columns[$key] = $value['name'];
Severity: Minor
Found in modules/Settings/AdminAccess/actions/GetData.php - About 2 hrs to fix

    Function access has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        public function access(App\Request $request)
        {
            $rows = $columns = $userData = [];
            foreach ($request->getArray('columns') as $key => $value) {
                $columns[$key] = $value['name'];
    Severity: Minor
    Found in modules/Settings/AdminAccess/actions/GetData.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 historyVisitPurpose has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function historyVisitPurpose(App\Request $request)
        {
            $rows = $columns = [];
            foreach ($request->getArray('columns') as $key => $value) {
                $columns[$key] = $value['name'];
    Severity: Minor
    Found in modules/Settings/AdminAccess/actions/GetData.php - About 1 hr to fix

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

          public function historyVisitPurpose(App\Request $request)
          {
              $rows = $columns = [];
              foreach ($request->getArray('columns') as $key => $value) {
                  $columns[$key] = $value['name'];
      Severity: Minor
      Found in modules/Settings/AdminAccess/actions/GetData.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

      The method access() has an NPath complexity of 240. The configured NPath complexity threshold is 200.
      Open

          public function access(App\Request $request)
          {
              $rows = $columns = $userData = [];
              foreach ($request->getArray('columns') as $key => $value) {
                  $columns[$key] = $value['name'];

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

          public function historyVisitPurpose(App\Request $request)
          {
              $rows = $columns = [];
              foreach ($request->getArray('columns') as $key => $value) {
                  $columns[$key] = $value['name'];

      CyclomaticComplexity

      Since: 0.1

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

      Example

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

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

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

          public function access(App\Request $request)
          {
              $rows = $columns = $userData = [];
              foreach ($request->getArray('columns') as $key => $value) {
                  $columns[$key] = $value['name'];

      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 17 to the 15 allowed.
      Open

          public function historyVisitPurpose(App\Request $request)

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

      See

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

          public function access(App\Request $request)

      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

      Missing class import via use statement (line '70', column '21').
      Open

                  $userData = (new \App\Db\Query())->from(\App\Security\AdminAccess::ACCESS_TABLE_NAME)

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

              $query = (new \App\Db\Query())->from($table);

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

                          $value = (new \App\Db\Query())->select(['module_id'])->from($fieldModel->getTableName())->where([$fieldModel->getColumnName() => $value]);

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

              $query = (new \App\Db\Query())->from($table);

      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 'Settings_Vtiger_Module_Model' in method 'access'.
      Open

              $moduleModel = Settings_Vtiger_Module_Model::getInstance($request->getModule(false));

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

                      } else {
                          $conditions[] = [$fieldModel->getColumnName() => $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_Module_Model' in method 'historyVisitPurpose'.
      Open

              $moduleModel = Settings_Vtiger_Module_Model::getInstance($request->getModule(false));

      StaticAccess

      Since: 1.4.0

      Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

      Example

      class Foo
      {
          public function bar()
          {
              Bar::baz();
          }
      }

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

      Avoid using static access to class '\App\Json' in method 'historyVisitPurpose'.
      Open

              echo \App\Json::encode($result);

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

                  $data[] = '<button type="button" class="btn btn-primary btn-sm js-show-modal" data-id="' . $row['id'] . '" title="' . \App\Language::translate('LBL_EDIT') . '" data-url="' . $moduleModel->getEditViewUrl($row['id']) . '"><span class="yfi yfi-full-editing-view"></span></button>';

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

                      } else {
                          $conditions[$fieldModel->getColumnName()] = $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 '\App\Db' in method 'historyVisitPurpose'.
      Open

              $dataReader = $query->indexBy('id')->createCommand(\App\Db::getInstance('log'))->query();

      StaticAccess

      Since: 1.4.0

      Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

      Example

      class Foo
      {
          public function bar()
          {
              Bar::baz();
          }
      }

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

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

              echo \App\Json::encode($result);

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

                          $value = (new \App\Db\Query())->select(['module_id'])->from($fieldModel->getTableName())->where([$fieldModel->getColumnName() => $value]);

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

              if ($order && isset($columns[$order['column']], $fields[$columns[$order['column']]])) {

      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 undeclared method \App\Base::getName
      Open

                      $value = $moduleModel->getValueFromRequest($fieldModel->getName(), $request);

      Call to undeclared method \App\Base::getName
      Open

                      $data[] = $moduleModel->getDisplayValue($fieldModel->getName(), $row[$fieldModel->getColumnName()]);

      Call to undeclared method \App\Base::getColumnName
      Open

                          $conditions[$fieldModel->getColumnName()] = $value;

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

              $query = (new \App\Db\Query())->from($table);

      Call to undeclared method \App\Base::getTableName
      Open

                      if ($fieldModel->getTableName() !== $table) {

      Call to undeclared method \App\Base::getColumnName
      Open

                      $data[] = $moduleModel->getDisplayValue($fieldModel->getName(), $row[$fieldModel->getColumnName()]);

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

              $query = (new \App\Db\Query())->from($table);

      Call to undeclared method \Settings_Vtiger_Module_Model::getStructure
      Open

              $fields = $moduleModel->getStructure('visitPurpose');

      Call to undeclared method \Settings_Vtiger_Module_Model::getValueFromRequest
      Open

                      $value = $moduleModel->getValueFromRequest($fieldModel->getName(), $request);

      Call to undeclared method \App\Base::getColumnName
      Open

                  $query->orderBy([$field->getColumnName() => \App\Db::ASC === strtoupper($order['dir']) ? \SORT_ASC : \SORT_DESC]);

      Call to undeclared method \Settings_Vtiger_Module_Model::getDisplayValue
      Open

                      $data[] = $moduleModel->getDisplayValue($fieldModel->getName(), $row[$fieldModel->getColumnName()]);

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

                  $userData = (new \App\Db\Query())->from(\App\Security\AdminAccess::ACCESS_TABLE_NAME)

      Call to undeclared method \Settings_Vtiger_Module_Model::getEditViewUrl
      Open

                  $data[] = '<button type="button" class="btn btn-primary btn-sm js-show-modal" data-id="' . $row['id'] . '" title="' . \App\Language::translate('LBL_EDIT') . '" data-url="' . $moduleModel->getEditViewUrl($row['id']) . '"><span class="yfi yfi-full-editing-view"></span></button>';

      Call to undeclared method \App\Base::getName
      Open

                  if ($request->has($fieldModel->getName()) && '' !== $request->get($fieldModel->getName())) {

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

                          $value = (new \App\Db\Query())->select(['module_id'])->from($fieldModel->getTableName())->where([$fieldModel->getColumnName() => $value]);

      Call to undeclared method \Settings_Vtiger_Module_Model::getValueFromRequest
      Open

                      $value = $moduleModel->getValueFromRequest($fieldModel->getName(), $request);

      Call to undeclared method \App\Base::getColumnName
      Open

                          $value = (new \App\Db\Query())->select(['module_id'])->from($fieldModel->getTableName())->where([$fieldModel->getColumnName() => $value]);

      Call to undeclared method \Settings_Vtiger_Module_Model::getDisplayValue
      Open

                      $data[] = $moduleModel->getDisplayValue($fieldModel->getName(), $row[$fieldModel->getColumnName()]);

      Call to undeclared method \App\Base::getTableName
      Open

                          $value = (new \App\Db\Query())->select(['module_id'])->from($fieldModel->getTableName())->where([$fieldModel->getColumnName() => $value]);

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

              if ($order && isset($columns[$order['column']], $fields[$columns[$order['column']]])) {
                  $field = $fields[$columns[$order['column']]];
                  $query->orderBy([$field->getColumnName() => \App\Db::ASC === strtoupper($order['dir']) ? \SORT_ASC : \SORT_DESC]);
              }
      Severity: Minor
      Found in modules/Settings/AdminAccess/actions/GetData.php and 1 other location - About 55 mins to fix
      modules/Settings/AdminAccess/actions/GetData.php on lines 129..132

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 99.

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

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

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

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

      Refactorings

      Further Reading

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

              if ($order && isset($columns[$order['column']], $fields[$columns[$order['column']]])) {
                  $field = $fields[$columns[$order['column']]];
                  $query->orderBy([$field->getColumnName() => \App\Db::ASC === strtoupper($order['dir']) ? \SORT_ASC : \SORT_DESC]);
              }
      Severity: Minor
      Found in modules/Settings/AdminAccess/actions/GetData.php and 1 other location - About 55 mins to fix
      modules/Settings/AdminAccess/actions/GetData.php on lines 63..66

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 99.

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

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

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

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

      Refactorings

      Further Reading

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

      class Settings_AdminAccess_GetData_Action extends \App\Controller\Action

      The class Settings_AdminAccess_GetData_Action is not named in CamelCase.
      Open

      class Settings_AdminAccess_GetData_Action extends \App\Controller\Action
      {
          use \App\Controller\ExposeMethod;
          use \App\Controller\Traits\SettingsPermission;
      
      

      CamelCaseClassName

      Since: 0.2

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

      Example

      class class_name {
      }

      Source

      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

           * @param App\Request $request

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

                  if ($request->has($fieldModel->getName()) && '' !== $request->get($fieldModel->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

          /**

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

           * Gets access configuration.

      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

              $moduleModel = Settings_Vtiger_Module_Model::getInstance($request->getModule(false));

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

                  }

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

              $query->where($conditions);

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

                  $field = $fields[$columns[$order['column']]];

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

                  $query->orderBy([$field->getColumnName() => \App\Db::ASC === strtoupper($order['dir']) ? \SORT_ASC : \SORT_DESC]);

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

              $order = current($request->getArray('order', 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

                          $value = (new \App\Db\Query())->select(['module_id'])->from($fieldModel->getTableName())->where([$fieldModel->getColumnName() => $value]);

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

              if ($resultData) {

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

                      ->where(['module_id' => array_keys($resultData)])->createCommand()->queryAllByGroup(2);

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

          {

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

                          $conditions[$moduleModel->getBaseIndex()] = $value;

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

                  foreach ($fields as $fieldModel) {

      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

           */

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

              $query = (new \App\Db\Query())->from($table);

      Line exceeds 120 characters; contains 126 characters
      Open

                  $query->orderBy([$field->getColumnName() => \App\Db::ASC === strtoupper($order['dir']) ? \SORT_ASC : \SORT_DESC]);

      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

                  $field = $fields[$columns[$order['column']]];

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

              header('content-type: text/json; charset=UTF-8');

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

              $this->exposeMethod('access');

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

              foreach ($request->getArray('columns') as $key => $value) {

      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

              echo \App\Json::encode($result);

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

              $rows = $columns = $userData = [];

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

                      $value = $moduleModel->getValueFromRequest($fieldModel->getName(), $request);

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

              $filter = $query->count('id');

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

              $query->limit($request->getInteger('length'))->offset($request->getInteger('start'));

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

                  $row['user'] = $userData[$key] ?? [];

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

              $fields = $moduleModel->getStructure('visitPurpose');

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

              $this->exposeMethod('historyVisitPurpose');

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

                  $columns[$key] = $value['name'];

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

                      if ($fieldModel->getTableName() !== $table) {

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

              if ($order && isset($columns[$order['column']], $fields[$columns[$order['column']]])) {

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

              $resultData = $query->indexBy('id')->all();

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

                      ->select(['module_id', 'user'])

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

              $rows = $columns = [];

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

                  if ($request->has($fieldModel->getName()) && '' !== $request->get($fieldModel->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

                  $columns[$key] = $value['name'];

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

              foreach ($fields as $fieldModel) {

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

              $dataReader = $query->indexBy('id')->createCommand(\App\Db::getInstance('log'))->query();

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

                  }

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

                  $rows[] = $data;

      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

          }

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

              $fields = $moduleModel->getListFields();

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

              $conditions = [];

      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

              $moduleModel = Settings_Vtiger_Module_Model::getInstance($request->getModule(false));

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

                          $conditions[] = [$fieldModel->getColumnName() => $value];

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

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

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

              if ($order && isset($columns[$order['column']], $fields[$columns[$order['column']]])) {

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

              foreach ($fields as $fieldModel) {

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

                          $conditions[$fieldModel->getColumnName()] = $value;

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

              foreach ($resultData as $key => $row) {

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

                  }

      Line exceeds 120 characters; contains 290 characters
      Open

                  $data[] = '<button type="button" class="btn btn-primary btn-sm js-show-modal" data-id="' . $row['id'] . '" title="' . \App\Language::translate('LBL_EDIT') . '" data-url="' . $moduleModel->getEditViewUrl($row['id']) . '"><span class="yfi yfi-full-editing-view"></span></button>';

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

              }

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

           * Gets visits purpose.

      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 ($request->getArray('columns') as $key => $value) {

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

                      $value = $moduleModel->getValueFromRequest($fieldModel->getName(), $request);

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

                      if ('datetime' === $fieldModel->getFieldDataType()) {

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

              }

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

                  $data = [];

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

                  'iTotalDisplayRecords' => $filter,

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

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

                  $rows[] = $data;

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

                  'aaData' => $rows

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

              $conditions = ['and'];

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

                          $conditions[] = ['between', $fieldModel->getColumnName(), $value[0], $value[1]];

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

              }

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

                  $data[] = '<button type="button" class="btn btn-primary btn-sm js-show-modal" data-id="' . $row['id'] . '" title="' . \App\Language::translate('LBL_EDIT') . '" data-url="' . $moduleModel->getEditViewUrl($row['id']) . '"><span class="yfi yfi-full-editing-view"></span></button>';

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

                  'draw' => $request->getInteger('draw'),

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

              header('content-type: text/json; charset=UTF-8');

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

              echo \App\Json::encode($result);

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

              $table = 'l_#__users_login_purpose';

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

                      } elseif ('text' === $fieldModel->getFieldDataType()) {

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

                          $conditions[] = ['like', $fieldModel->getColumnName(), $value];

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

              $filter = $query->count('id');

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

                  foreach ($fields as $fieldModel) {

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

          {

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

              $table = \App\Security\AdminAccess::MODULES_TABLE_NAME;

      Line exceeds 120 characters; contains 158 characters
      Open

                          $value = (new \App\Db\Query())->select(['module_id'])->from($fieldModel->getTableName())->where([$fieldModel->getColumnName() => $value]);

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

                  $userData = (new \App\Db\Query())->from(\App\Security\AdminAccess::ACCESS_TABLE_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

           * @param App\Request $request

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

              $query = (new \App\Db\Query())->from($table);

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

                  }

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

                  'iTotalDisplayRecords' => $filter,

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

              $query->limit($request->getInteger('length'))->offset($request->getInteger('start'));

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

                  $query->orderBy([$field->getColumnName() => \App\Db::ASC === strtoupper($order['dir']) ? \SORT_ASC : \SORT_DESC]);

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

                  'draw' => $request->getInteger('draw'),

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

          use \App\Controller\Traits\SettingsPermission;

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

                      } else {

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

              }

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

                  $data = [];

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

              $result = [

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

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

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

              $result = [

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

                          $value = explode(',', $value);

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

              $query->where($conditions);

      Line exceeds 120 characters; contains 126 characters
      Open

                  $query->orderBy([$field->getColumnName() => \App\Db::ASC === strtoupper($order['dir']) ? \SORT_ASC : \SORT_DESC]);

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

                  'aaData' => $rows

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

                      $data[] = $moduleModel->getDisplayValue($fieldModel->getName(), $row[$fieldModel->getColumnName()]);

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

          public function historyVisitPurpose(App\Request $request)

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

                      $data[] = $moduleModel->getDisplayValue($fieldModel->getName(), $row[$fieldModel->getColumnName()]);

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

              ];

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

      class Settings_AdminAccess_GetData_Action extends \App\Controller\Action

      There are no issues that match your filters.

      Category
      Status