YetiForceCompany/YetiForceCRM

View on GitHub
modules/Notification/models/Record.php

Summary

Maintainability
B
5 hrs
Test Coverage
D
69%

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

    public function save(): bool
    {
        $relatedRecord = $this->getRelatedRecord();
        $relatedId = $relatedModule = false;
        if (false !== $relatedRecord) {
Severity: Minor
Found in modules/Notification/models/Record.php - About 2 hrs to fix

Cognitive Complexity

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

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

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

Further reading

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

    public function save(): bool
    {
        $relatedRecord = $this->getRelatedRecord();
        $relatedId = $relatedModule = false;
        if (false !== $relatedRecord) {
Severity: Minor
Found in modules/Notification/models/Record.php - About 2 hrs to fix

    Function getRelatedRecord has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getRelatedRecord()
        {
            $relatedId = false;
            $subprocess = $this->get('subprocess');
            $process = $this->get('process');
    Severity: Minor
    Found in modules/Notification/models/Record.php - About 45 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

    Consider simplifying this complex logical expression.
    Open

            if (!empty($sl) && \App\Record::isExists($sl)) {
                $relatedId = $sl;
            } elseif (!empty($subprocess) && \App\Record::isExists($subprocess)) {
                $relatedId = $subprocess;
            } elseif (!empty($process) && \App\Record::isExists($process)) {
    Severity: Major
    Found in modules/Notification/models/Record.php - About 40 mins to fix

      The method save() has an NPath complexity of 9856. The configured NPath complexity threshold is 200.
      Open

          public function save(): bool
          {
              $relatedRecord = $this->getRelatedRecord();
              $relatedId = $relatedModule = false;
              if (false !== $relatedRecord) {

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

          public function getRelatedRecord()
          {
              $relatedId = false;
              $subprocess = $this->get('subprocess');
              $process = $this->get('process');

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

          public function save(): bool
          {
              $relatedRecord = $this->getRelatedRecord();
              $relatedId = $relatedModule = false;
              if (false !== $relatedRecord) {

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

          public function save(): bool

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

      class Notification_Record_Model extends Vtiger_Record_Model
      {
          /**
           * Function to parse content.
           *

      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

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

                  $textParser = \App\TextParser::getInstance();

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

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

              } elseif (!empty($process) && \App\Record::isExists($process)) {

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

      Avoid using static access to class '\App\Fields\Owner' in method 'save'.
      Open

                  \App\Log::warning('User ' . \App\Fields\Owner::getLabel($this->get('assigned_user_id')) . ' has no active notifications');

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

              } else {
                  $textParser = \App\TextParser::getInstance();
                  $textParser->setContent($value)->parseTranslations();
              }

      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\Fields\Owner' in method 'save'.
      Open

                      $userType = \App\Fields\Owner::getType($userId);

      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\Record' in method 'getRelatedRecord'.
      Open

              if (!empty($sl) && \App\Record::isExists($sl)) {

      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_Link_Model' in method 'getRecordListViewLinksLeftSide'.
      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\Record' in method 'getRelatedRecord'.
      Open

              } elseif (!empty($linkextend) && \App\Record::isExists($linkextend)) {

      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\Record' in method 'save'.
      Open

              if ($relatedModule && 'PLL_USERS' !== $notificationType && \App\Record::isExists($relatedId)) {

      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\Record' in method 'getParseField'.
      Open

              if (\App\Record::isExists($relatedId)) {

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

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

                  \App\Log::warning('User ' . \App\Fields\Owner::getLabel($this->get('assigned_user_id')) . ' has no active notifications');

      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\TextParser' in method 'getParseField'.
      Open

                  $textParser = \App\TextParser::getInstanceById($relatedId, $relatedModule);

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

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

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

      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\Record' in method 'getRelatedRecord'.
      Open

              } elseif (!empty($link) && \App\Record::isExists($link)) {

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

      Avoid using static access to class '\App\Fields\Owner' in method 'getCreatorUser'.
      Open

                  return \App\Fields\Owner::getLabel($userid);

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

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

                  \App\Log::error('User ' . \App\Fields\Owner::getLabel($this->get('assigned_user_id')) .
                      ' does not have permission for this record ' . $relatedId);

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

              } else {
                  $icon = [
                      'icon' => 'fas fa-hdd',
                  ];
              }

      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

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

              } else {
                  return false;
              }

      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\Utils\Completions' in method 'getMessage'.
      Open

              return \App\Utils\Completions::decode($this->getDisplayValue('description', $this->getId(), $this));

      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\Privilege' in method 'save'.
      Open

              if (!\App\Privilege::isPermitted('Notification', 'DetailView')) {

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

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

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

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

      Avoid using static access to class '\vtlib\Functions' in method 'getRelatedRecord'.
      Open

      }

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

      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 {
                          $usersCollection[] = $userId;
                      }

      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\Record' in method 'getRelatedRecord'.
      Open

              } elseif (!empty($subprocess) && \App\Record::isExists($subprocess)) {

      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\Privilege' in method 'save'.
      Open

              if ($relatedModule && 'PLL_USERS' !== $notificationType && !\App\Privilege::isPermitted($relatedModule, 'DetailView', $relatedId)) {

      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\TextParser' in method 'save'.
      Open

                  $textParser = \App\TextParser::getInstanceById($relatedId, $relatedModule);

      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\PrivilegeUtil' in method 'save'.
      Open

                          $usersCollection = array_merge($usersCollection, \App\PrivilegeUtil::getUsersByGroup($userId));

      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\TextUtils' in method 'save'.
      Open

                  $this->setFromUserValue('title', \App\TextUtils::textTruncate(\App\Purifier::purifyByType($textParser->setContent($this->get('title'))->parse()->getContent(), 'Text'), $this->getField('title')->getMaxValue(), 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\Purifier' in method 'save'.
      Open

                  $this->setFromUserValue('title', \App\TextUtils::textTruncate(\App\Purifier::purifyByType($textParser->setContent($this->get('title'))->parse()->getContent(), 'Text'), $this->getField('title')->getMaxValue(), 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\Privilege' in method 'save'.
      Open

                  if ($isNew && $relatedId && 'PLL_SYSTEM' === $notificationType && !\App\Privilege::isPermitted($relatedModule, 'DetailView', $relatedId, $userId)) {

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

      Avoid using static access to class '\App\Fields\Owner' in method 'save'.
      Open

                  \App\Log::error('User ' . \App\Fields\Owner::getLabel($this->get('assigned_user_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

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

              $relatedModule = $relatedRecords['module'];

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

              if ($relatedModule && 'PLL_USERS' !== $notificationType && !\App\Privilege::isPermitted($relatedModule, 'DetailView', $relatedId)) {

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

                  \App\Log::warning('User ' . \App\Fields\Owner::getLabel($this->get('assigned_user_id')) . ' has no active notifications');

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

              return $this->get('notification_type');

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

              return \App\Utils\Completions::decode($this->getDisplayValue('description', $this->getId(), $this));

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

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

      Noncompliant Code Example

      With the default threshold of 3:

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

      Compliant Solution

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

      Exceptions

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

      Define a constant instead of duplicating this literal "title" 4 times.
      Open

              return $this->getDisplayValue('title', $this->getId(), $this);

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

              if (!\App\Privilege::isPermitted('Notification', 'DetailView')) {

      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.

      Argument 3 (rawText) is \App\Base|\Notification_Record_Model|\Vtiger_Record_Model but \Notification_Record_Model::getDisplayValue() takes bool|false defined at /code/modules/Vtiger/models/Record.php:416
      Open

              return \App\Utils\Completions::decode($this->getDisplayValue('description', $this->getId(), $this));
      Severity: Minor
      Found in modules/Notification/models/Record.php by phan

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

                  \App\Log::warning('User ' . \App\Fields\Owner::getLabel($this->get('assigned_user_id')) . ' has no active notifications');
      Severity: Critical
      Found in modules/Notification/models/Record.php by phan

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

                  \App\Log::warning('User ' . \App\Fields\Owner::getLabel($this->get('assigned_user_id')) . ' has no active notifications');
      Severity: Critical
      Found in modules/Notification/models/Record.php by phan

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

                  \App\Log::trace('Exiting ' . __METHOD__ . ' - return true');
      Severity: Critical
      Found in modules/Notification/models/Record.php by phan

      Call to method getInstanceById from undeclared class \App\TextParser (Did you mean class \Tests\App\TextParser)
      Open

                  $textParser = \App\TextParser::getInstanceById($relatedId, $relatedModule);
      Severity: Critical
      Found in modules/Notification/models/Record.php by phan

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

                      $userType = \App\Fields\Owner::getType($userId);
      Severity: Critical
      Found in modules/Notification/models/Record.php by phan

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

                  $textParser = \App\TextParser::getInstance();
      Severity: Critical
      Found in modules/Notification/models/Record.php by phan

      Call to method decode from undeclared class \App\Utils\Completions
      Open

              return \App\Utils\Completions::decode($this->getDisplayValue('description', $this->getId(), $this));
      Severity: Critical
      Found in modules/Notification/models/Record.php by phan

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

                  \App\Log::trace('Exiting ' . __METHOD__ . ' - return true');
      Severity: Critical
      Found in modules/Notification/models/Record.php by phan

      Argument 3 (rawText) is \App\Base|\Notification_Record_Model|\Vtiger_Record_Model but \Notification_Record_Model::getDisplayValue() takes bool|false defined at /code/modules/Vtiger/models/Record.php:416
      Open

              return $this->getDisplayValue('title', $this->getId(), $this);
      Severity: Minor
      Found in modules/Notification/models/Record.php by phan

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

                  return \App\Fields\Owner::getLabel($userid);
      Severity: Critical
      Found in modules/Notification/models/Record.php by phan

      Returning type false but getRelatedRecord() is declared to return array
      Open

                  return false;
      Severity: Minor
      Found in modules/Notification/models/Record.php by phan

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

                  \App\Log::error('User ' . \App\Fields\Owner::getLabel($this->get('assigned_user_id')) .
      Severity: Critical
      Found in modules/Notification/models/Record.php by phan

      Call to method getInstanceById from undeclared class \App\TextParser (Did you mean class \Tests\App\TextParser)
      Open

                  $textParser = \App\TextParser::getInstanceById($relatedId, $relatedModule);
      Severity: Critical
      Found in modules/Notification/models/Record.php by phan

      false to array comparison
      Open

              if (false !== $relatedRecord) {

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

                  \App\Log::error('User ' . \App\Fields\Owner::getLabel($this->get('assigned_user_id')) .
      Severity: Critical
      Found in modules/Notification/models/Record.php by phan

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

                  $icon = \App\User::getUserModel($this->get('smcreatorid'))->getImage();
      Severity: Critical
      Found in modules/Notification/models/Record.php by phan

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

      class Notification_Record_Model extends Vtiger_Record_Model

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

              $sl = $this->get('subprocess_sl');

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

      class Notification_Record_Model extends Vtiger_Record_Model
      {
          /**
           * Function to parse content.
           *

      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

           *

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

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

      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

                  $textParser->setContent($value)->parseTranslations();

      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

              $subprocess = $this->get('subprocess');

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

          public function getCreatorUser()

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

          }

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

              $relatedId = $relatedModule = false;

      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

              }

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

           * @return string

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

           * @return string

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

              if (!empty($userid)) {

      Line exceeds 120 characters; contains 140 characters
      Open

              if ($relatedModule && 'PLL_USERS' !== $notificationType && !\App\Privilege::isPermitted($relatedModule, 'DetailView', $relatedId)) {

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

                  $textParser = \App\TextParser::getInstanceById($relatedId, $relatedModule);

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

                  $this->set('shownerid', null);

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

           * @return Vtiger_Link_Model[] - Associate array of Vtiger_Link_Model instances

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

                      'linktype' => 'LIST_VIEW_ACTIONS_RECORD_LEFT_SIDE',

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

          }

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

                  $relatedId = $sl;

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

           */

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

                  }

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

           * @param string $fieldName

      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

              }

      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

              } elseif (!empty($subprocess) && \App\Record::isExists($subprocess)) {

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

                  return false;

      Line exceeds 120 characters; contains 134 characters
      Open

                  \App\Log::warning('User ' . \App\Fields\Owner::getLabel($this->get('assigned_user_id')) . ' has no active notifications');

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

                  $users = \is_array($users) ? $users : explode(',', $users);

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

                  if ($isNew) {

      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 message of notification.

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

          public function getMessage(): string

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

           * Function to get the most important records.

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

                  $relatedId = $subprocess;

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

           * Function to get name of user who create this notification.

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

              }

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

                  \App\Log::error('User ' . \App\Fields\Owner::getLabel($this->get('assigned_user_id')) .

      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

                      $this->isNew = true;

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

          /**

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

              }

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

              $relatedModule = $relatedRecords['module'];

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

              if (\App\Record::isExists($relatedId)) {

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

                  $textParser->setContent($value)->parse();

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

           */

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

                  $relatedId = $process;

      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 ['id' => $relatedId, 'module' => \vtlib\Functions::getCRMRecordMetadata($relatedId)['setype']];

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

          {

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

              $userid = $this->get('smcreatorid');

      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 bool

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

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

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

                  $this->setFromUserValue('title', \App\TextUtils::textTruncate(\App\Purifier::purifyByType($textParser->setContent($this->get('title'))->parse()->getContent(), 'Text'), $this->getField('title')->getMaxValue(), false));

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

              if (!empty($users)) {

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

                      $userType = \App\Fields\Owner::getType($userId);

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

                          $usersCollection[] = $userId;

      Line exceeds 120 characters; contains 160 characters
      Open

                  if ($isNew && $relatedId && 'PLL_SYSTEM' === $notificationType && !\App\Privilege::isPermitted($relatedModule, 'DetailView', $relatedId, $userId)) {

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

              return $icon;

      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 nl2br(str_replace("<br>\n", '<br>', $textParser->getContent()));

      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

              $link = $this->get('link');

      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

              if ($this->getModule()->isPermitted('EditView') && $this->isEditable()) {

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

                      'linklabel' => 'LBL_MARK_AS_READ',

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

                      'linkurl' => 'javascript:Notification_List_Js.setAsMarked(' . $this->getId() . ')',

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

                      'linkicon' => 'fas fa-check',

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

          public function getParseField($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

           * @return string

      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 \App\Fields\Owner::getLabel($userid);

      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 (false !== $relatedRecord) {

      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

                  if ($isNew && $relatedId && 'PLL_SYSTEM' === $notificationType && !\App\Privilege::isPermitted($relatedModule, 'DetailView', $relatedId, $userId)) {

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

                  $icon = [

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

           * Function to get the list view actions for the record.

      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

                  $links[] = Vtiger_Link_Model::getInstanceFromValues($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

              } else {

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

          public function getTitle()

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

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

          public function setMarked()

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

          {

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

              $relatedId = false;

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

              } elseif (!empty($link) && \App\Record::isExists($link)) {

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

              return '';

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

              $notificationType = $this->get('notification_type');

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

                      ' does not have permission for this record ' . $relatedId);

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

                  $this->setFromUserValue('description', $textParser->withoutTranslations()->setContent($this->get('description'))->parse()->getContent());

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

                  parent::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

                  $icon = \App\User::getUserModel($this->get('smcreatorid'))->getImage();

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

              }

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

              $isNew = $this->isNew;

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

              return true;

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

              $icon = [];

      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

              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

           */

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

              if (empty($relatedRecords['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

          }

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

              if (!empty($sl) && \App\Record::isExists($sl)) {

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

          public function save(): bool

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

                  $relatedId = $relatedRecord['id'];

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

              if ($relatedModule && 'PLL_USERS' !== $notificationType && !\App\Privilege::isPermitted($relatedModule, 'DetailView', $relatedId)) {

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

              $usersCollection = $this->isEmpty('assigned_user_id') ? [] : [$this->get('assigned_user_id')];

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

                  $this->set('assigned_user_id', $userId);

      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

              $links = parent::getRecordListViewLinksLeftSide();

      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

           * Function to set notification as read.

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

              } elseif (!empty($process) && \App\Record::isExists($process)) {

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

                  $relatedId = $link;

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

          }

      Line exceeds 120 characters; contains 229 characters
      Open

                  $this->setFromUserValue('title', \App\TextUtils::textTruncate(\App\Purifier::purifyByType($textParser->setContent($this->get('title'))->parse()->getContent(), 'Text'), $this->getField('title')->getMaxValue(), false));

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

              }

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

                  ];

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

           * Function to parse content.

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

                  $textParser = \App\TextParser::getInstance();

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

           * Title.

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

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

              $linkextend = $this->get('linkextend');

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

              $sl = $this->get('subprocess_sl');

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

              } elseif (!empty($linkextend) && \App\Record::isExists($linkextend)) {

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

                  $relatedId = $linkextend;

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

          /**

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

              $relatedRecord = $this->getRelatedRecord();

      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

              $usersCollection = array_unique($usersCollection);

      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-sm btn-default',

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

           * Return name type notification.

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

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

          /**

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

          public function getRelatedRecord()

      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

              $users = $this->get('shownerid');

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

                      continue;

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

          /**

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

              }

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

          }

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

              $relatedRecords = $this->getRelatedRecord();

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

                  $textParser = \App\TextParser::getInstanceById($relatedId, $relatedModule);

      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

           * @throws \Exception

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

                  $relatedModule = $relatedRecord['module'];

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

                  \App\Log::warning('User ' . \App\Fields\Owner::getLabel($this->get('assigned_user_id')) . ' has no active notifications');

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

                      if ('Groups' === $userType) {

      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 icon for notification.

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

                      'icon' => 'fas fa-hdd',

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

          public function getRecordListViewLinksLeftSide()

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

              return $this->getDisplayValue('title', $this->getId(), $this);

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

              return \App\Utils\Completions::decode($this->getDisplayValue('description', $this->getId(), $this));

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

           * @return array

      Line exceeds 120 characters; contains 149 characters
      Open

                  $this->setFromUserValue('description', $textParser->withoutTranslations()->setContent($this->get('description'))->parse()->getContent());

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

              foreach ($usersCollection as $userId) {

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

           * @return array params icon

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

              if ('PLL_USERS' === $this->get('notification_type')) {

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

           *

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

          {

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

              $relatedId = $relatedRecords['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

           */

      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('notification_status', 'PLL_READ');

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

              $process = $this->get('process');

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

           * Function to save record.

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

              if (!\App\Privilege::isPermitted('Notification', 'DetailView')) {

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

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

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

              if ($relatedModule && 'PLL_USERS' !== $notificationType && \App\Record::isExists($relatedId)) {

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

                  foreach ($users as $userId) {

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

                          $usersCollection = array_merge($usersCollection, \App\PrivilegeUtil::getUsersByGroup($userId));

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

          public function getIcon()

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

              return $links;

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

      class Notification_Record_Model extends Vtiger_Record_Model

      There are no issues that match your filters.

      Category
      Status