YetiForceCompany/YetiForceCRM

View on GitHub
modules/SMSNotifier/actions/MassSMS.php

Summary

Maintainability
C
1 day
Test Coverage
F
0%

Method getQuery has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function getQuery(App\Request $request)
    {
        $moduleName = $request->getByType('source_module', \App\Purifier::ALNUM);
        $sourceModule = $request->getModule();
        $cvId = $request->isEmpty('viewname') ? '' : $request->getByType('viewname', \App\Purifier::ALNUM);
Severity: Minor
Found in modules/SMSNotifier/actions/MassSMS.php - About 1 hr to fix

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

        public static function getQuery(App\Request $request)
        {
            $moduleName = $request->getByType('source_module', \App\Purifier::ALNUM);
            $sourceModule = $request->getModule();
            $cvId = $request->isEmpty('viewname') ? '' : $request->getByType('viewname', \App\Purifier::ALNUM);
    Severity: Minor
    Found in modules/SMSNotifier/actions/MassSMS.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 process has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function process(App\Request $request)
        {
            $queryGenerator = $this->getQuery($request);
            $count = 0;
            $moduleName = $request->getModule();
    Severity: Minor
    Found in modules/SMSNotifier/actions/MassSMS.php - About 1 hr to fix

      Function process has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public function process(App\Request $request)
          {
              $queryGenerator = $this->getQuery($request);
              $count = 0;
              $moduleName = $request->getModule();
      Severity: Minor
      Found in modules/SMSNotifier/actions/MassSMS.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 getQuery() has an NPath complexity of 1040. The configured NPath complexity threshold is 200.
      Open

          public static function getQuery(App\Request $request)
          {
              $moduleName = $request->getByType('source_module', \App\Purifier::ALNUM);
              $sourceModule = $request->getModule();
              $cvId = $request->isEmpty('viewname') ? '' : $request->getByType('viewname', \App\Purifier::ALNUM);

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

          public static function getQuery(App\Request $request)
          {
              $moduleName = $request->getByType('source_module', \App\Purifier::ALNUM);
              $sourceModule = $request->getModule();
              $cvId = $request->isEmpty('viewname') ? '' : $request->getByType('viewname', \App\Purifier::ALNUM);

      CyclomaticComplexity

      Since: 0.1

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

      Example

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

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

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

          public static function getQuery(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

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

      class SMSNotifier_MassSMS_Action extends Vtiger_Mass_Action
      {
          /** {@inheritdoc} */
          public function checkPermission(App\Request $request)
          {

      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 '85', column '26').
      Open

                  $queryGenerator = new App\QueryGenerator($moduleName);

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

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

      MissingImport

      Since: 2.7.0

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

      Example

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

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

      Missing class import via use statement (line '62', column '19').
      Open

              $response = new \Vtiger_Response();

      MissingImport

      Since: 2.7.0

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

      Example

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

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

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

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

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

              } else {
                  if (!$request->isEmpty('operator')) {
                      $operator = $request->getByType('operator');
                      $searchKey = $request->getByType('search_key', 'Alnum');
                      $customViewModel->set('operator', $operator);

      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 'Users_Privileges_Model' in method 'checkPermission'.
      Open

              $userPrivilegesModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();

      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_Record_Model' in method 'process'.
      Open

              $recordModelTemp = \Vtiger_Record_Model::getCleanInstance($moduleName);

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

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

              $queryGenerator->setLimit(\App\Config::module($request->getModule(), 'maxMassSentSMS', 1));

      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\Condition' in method 'getQuery'.
      Open

                  $customViewModel->set('search_params', App\Condition::validSearchParams($moduleName, $request->getArray('search_params')));

      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 '102', column '8').
      Open

          public static function getQuery(App\Request $request)
          {
              $moduleName = $request->getByType('source_module', \App\Purifier::ALNUM);
              $sourceModule = $request->getModule();
              $cvId = $request->isEmpty('viewname') ? '' : $request->getByType('viewname', \App\Purifier::ALNUM);

      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

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

              $response->setResult(['message' => \App\Language::translate('LBL_MASS_SEND_SMS_QUEUE_INFO', $request->getModule()), 'count' => $count]);

      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\Condition' in method 'getQuery'.
      Open

                      $customViewModel->set('advancedConditions', \App\Condition::validAdvancedConditions($advancedConditions));

      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\SMSProvider' in method 'checkPermission'.
      Open

              if (!$moduleModel->isPermitted('CreateView') || !\in_array($sourceModule, $moduleModel->getFieldByName('related_to')->getReferenceList()) || !$userPrivilegesModel->hasModuleActionPermission($sourceModule, 'MassSendSMS') || !\App\Integrations\SMSProvider::isActiveProvider()) {

      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 'CustomView_Record_Model' in method 'getQuery'.
      Open

              $customViewModel = CustomView_Record_Model::getInstanceById((int) $cvId);

      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\Condition' in method 'getQuery'.
      Open

                      $customViewModel->set('search_value', App\Condition::validSearchValue($request->getByType('search_value', 'Text'), $moduleName, $searchKey, $operator));

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

                  if ($request->getBoolean('isSortActive') && !$request->isEmpty('orderby')) {

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

                  $queryGenerator->setStateCondition($request->getByType('entityState'));

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

                  if (!$request->isEmpty('operator')) {

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

                  if ($advancedConditions = $request->has('advancedConditions') ? $request->getArray('advancedConditions') : []) {

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

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

      Noncompliant Code Example

      With the default threshold of 3:

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

      Compliant Solution

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

      Exceptions

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

      Call to method clearFields from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
      Open

              $queryGenerator->clearFields()->setFields($fields);
      Severity: Critical
      Found in modules/SMSNotifier/actions/MassSMS.php by phan

      Call to method initForCustomViewById from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
      Open

                  $queryGenerator->initForCustomViewById($cvId, $empty);
      Severity: Critical
      Found in modules/SMSNotifier/actions/MassSMS.php by phan

      Call to method __construct from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
      Open

                  $queryGenerator = new App\QueryGenerator($moduleName);
      Severity: Critical
      Found in modules/SMSNotifier/actions/MassSMS.php by phan

      Call to method setLimit from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
      Open

              $queryGenerator->setLimit(\App\Config::module($request->getModule(), 'maxMassSentSMS', 1));
      Severity: Critical
      Found in modules/SMSNotifier/actions/MassSMS.php by phan

      Call to method addCondition from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
      Open

                  $queryGenerator->addCondition('id', $selectedIds, 'e');
      Severity: Critical
      Found in modules/SMSNotifier/actions/MassSMS.php by phan

      Call to method addCondition from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
      Open

                  $queryGenerator->addCondition($phoneField, '', 'ny', false);
      Severity: Critical
      Found in modules/SMSNotifier/actions/MassSMS.php by phan

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

                      $recordModel->set('phone', $phoneNumber)
      Severity: Critical
      Found in modules/SMSNotifier/actions/MassSMS.php by phan

      Return type of getQuery() is undeclared type \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
      Open

          public static function getQuery(App\Request $request)

      Call to method createQuery from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
      Open

              $dataReader = $queryGenerator->createQuery()->createCommand()->query();
      Severity: Critical
      Found in modules/SMSNotifier/actions/MassSMS.php by phan

      Call to method setStateCondition from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
      Open

                  $queryGenerator->setStateCondition($request->getByType('entityState'));
      Severity: Critical
      Found in modules/SMSNotifier/actions/MassSMS.php by phan

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

          public function checkPermission(App\Request $request)
          {
              $sourceModule = $request->getByType('source_module', \App\Purifier::ALNUM);
              $moduleModel = Vtiger_Module_Model::getInstance($request->getModule());
              $userPrivilegesModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
      Severity: Major
      Found in modules/SMSNotifier/actions/MassSMS.php and 1 other location - About 2 hrs to fix
      modules/SMSNotifier/views/MassSMS.php on lines 27..35

      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 134.

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

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

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

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

      Refactorings

      Further Reading

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

                  if (!$request->isEmpty('operator')) {
                      $operator = $request->getByType('operator');
                      $searchKey = $request->getByType('search_key', 'Alnum');
                      $customViewModel->set('operator', $operator);
                      $customViewModel->set('search_key', $searchKey);
      Severity: Major
      Found in modules/SMSNotifier/actions/MassSMS.php and 2 other locations - About 1 hr to fix
      modules/SMSNotifier/views/MassSMS.php on lines 119..125
      modules/Vtiger/actions/Mass.php on lines 41..47

      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 103.

      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 SMSNotifier_MassSMS_Action extends Vtiger_Mass_Action

      The class SMSNotifier_MassSMS_Action is not named in CamelCase.
      Open

      class SMSNotifier_MassSMS_Action extends Vtiger_Mass_Action
      {
          /** {@inheritdoc} */
          public function checkPermission(App\Request $request)
          {

      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

                  if ($fieldModel && $fieldModel->isWritable()) {

      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

              $response->setResult(['message' => \App\Language::translate('LBL_MASS_SEND_SMS_QUEUE_INFO', $request->getModule()), 'count' => $count]);

      Line exceeds 120 characters; contains 144 characters
      Open

              $response->setResult(['message' => \App\Language::translate('LBL_MASS_SEND_SMS_QUEUE_INFO', $request->getModule()), 'count' => $count]);

      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

          public function checkPermission(App\Request $request)

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

              $queryGenerator = $this->getQuery($request);

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

              $recordModelTemp = \Vtiger_Record_Model::getCleanInstance($moduleName);

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

           */

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

                  }

      Line exceeds 120 characters; contains 124 characters
      Open

                  if ($advancedConditions = $request->has('advancedConditions') ? $request->getArray('advancedConditions') : []) {

      Line exceeds 120 characters; contains 122 characters
      Open

                      $customViewModel->set('advancedConditions', \App\Condition::validAdvancedConditions($advancedConditions));

      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

                  $phoneFields = array_filter(array_unique(array_intersect_key($row, array_flip($phoneFieldList))));

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

          public static function getQuery(App\Request $request)

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

              if ((!$cvId || !empty($cvId) && 'undefined' === $cvId) && 'Users' !== $sourceModule) {

      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

                      ++$count;

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

              $sourceModule = $request->getModule();

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

              $selectedIds = $request->getArray('selected_ids', 2);

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

                  $queryGenerator = new App\QueryGenerator($moduleName);

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

                  if (!$request->isEmpty('operator')) {

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

                  }

      Line exceeds 120 characters; contains 135 characters
      Open

                  $customViewModel->set('search_params', App\Condition::validSearchParams($moduleName, $request->getArray('search_params')));

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

           * @param \App\Request $request

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

          {

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

              foreach (['message', 'image'] as $fieldName) {

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

                      $recordModel->set('phone', $phoneNumber)

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

              $customViewModel = CustomView_Record_Model::getInstanceById((int) $cvId);

      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

           * Function that saves SMS records.

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

          public function process(App\Request $request)

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

                      $customViewModel->set('search_key', $searchKey);

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

                      $customViewModel->set('search_value', App\Condition::validSearchValue($request->getByType('search_value', 'Text'), $moduleName, $searchKey, $operator));

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

                  $customViewModel->set('search_params', App\Condition::validSearchParams($moduleName, $request->getArray('search_params')));

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

                  if ($advancedConditions = $request->has('advancedConditions') ? $request->getArray('advancedConditions') : []) {

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

              foreach ($fields as $phoneField) {

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

              $response = new \Vtiger_Response();

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

              $cvId = $request->isEmpty('viewname') ? '' : $request->getByType('viewname', \App\Purifier::ALNUM);

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

              $empty = false;

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

                  $empty = true;

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

              return $queryGenerator;

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

                      $recordModel = clone $recordModelTemp;

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

          }

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

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

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

                      $customViewModel->set('operator', $operator);

      Line exceeds 120 characters; contains 129 characters
      Open

                      $customViewModel->set('orderby', $request->getArray('orderby', \App\Purifier::STANDARD, [], \App\Purifier::SQL));

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

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

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

                          ->set('related_to', $row['id'])

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

                          ->save();

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

              if (!$customViewModel) {

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

                      $customViewModel->set('orderby', $request->getArray('orderby', \App\Purifier::STANDARD, [], \App\Purifier::SQL));

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

                  $customViewModel->set('entityState', $request->getByType('entityState'));

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

              $userPrivilegesModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();

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

                  $fieldModel = $recordModelTemp->getField($fieldName);

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

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

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

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

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

              $queryGenerator->clearFields()->setFields($fields);

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

          }

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

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

      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

                          ->set('image', $recordModelTemp->getField($fieldName)->getUITypeModel()->getDuplicateValue($recordModelTemp))

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

                      $searchKey = $request->getByType('search_key', 'Alnum');

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

                  if ($request->getBoolean('isSortActive') && !$request->isEmpty('orderby')) {

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

                  }

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

                  $queryGenerator = $customViewModel->getRecordsListQuery($request->getArray('excluded_ids', 2), $moduleName);

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

          {

      Line exceeds 120 characters; contains 284 characters
      Open

              if (!$moduleModel->isPermitted('CreateView') || !\in_array($sourceModule, $moduleModel->getFieldByName('related_to')->getReferenceList()) || !$userPrivilegesModel->hasModuleActionPermission($sourceModule, 'MassSendSMS') || !\App\Integrations\SMSProvider::isActiveProvider()) {

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

              $count = 0;

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

                      $fieldModel->getUITypeModel()->setValueFromRequest($request, $recordModelTemp);

      Line exceeds 120 characters; contains 129 characters
      Open

                          ->set('image', $recordModelTemp->getField($fieldName)->getUITypeModel()->getDuplicateValue($recordModelTemp))

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

              if ($selectedIds && 'all' !== $selectedIds[0]) {

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

                  $queryGenerator->setStateCondition($request->getByType('entityState'));

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

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

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

              $fields[] = 'id';

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

              $queryGenerator->setLimit(\App\Config::module($request->getModule(), 'maxMassSentSMS', 1));

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

              if (!$moduleModel->isPermitted('CreateView') || !\in_array($sourceModule, $moduleModel->getFieldByName('related_to')->getReferenceList()) || !$userPrivilegesModel->hasModuleActionPermission($sourceModule, 'MassSendSMS') || !\App\Integrations\SMSProvider::isActiveProvider()) {

      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 false;

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

                  $queryGenerator->initForCustomViewById($cvId, $empty);

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

              }

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

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

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

              $moduleName = $request->getModule();

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

                  foreach ($phoneFields as $phoneNumber) {

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

          {

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

                  $cvId = CustomView_Record_Model::getAllFilterByModule($sourceModule)->getId();

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

              } else {

      Line exceeds 120 characters; contains 168 characters
      Open

                      $customViewModel->set('search_value', App\Condition::validSearchValue($request->getByType('search_value', 'Text'), $moduleName, $searchKey, $operator));

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

           *

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

              $dataReader->close();

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

              $response->emit();

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

                  $queryGenerator->addCondition('id', $selectedIds, 'e');

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

                      $operator = $request->getByType('operator');

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

                      $customViewModel->set('advancedConditions', \App\Condition::validAdvancedConditions($advancedConditions));

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

                  $queryGenerator->addCondition($phoneField, '', 'ny', false);

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

      class SMSNotifier_MassSMS_Action extends Vtiger_Mass_Action

      There are no issues that match your filters.

      Category
      Status