YetiForceCompany/YetiForceCRM

View on GitHub
modules/ModTracker/handlers/ModTrackerHandler.php

Summary

Maintainability
D
2 days
Test Coverage
D
61%

Function entityAfterSave has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

    public function entityAfterSave(App\EventHandler $eventHandler)
    {
        if (!ModTracker::isTrackingEnabledForModule($eventHandler->getModuleName())) {
            return false;
        }
Severity: Minor
Found in modules/ModTracker/handlers/ModTrackerHandler.php - About 4 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 entityAfterSave has 91 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function entityAfterSave(App\EventHandler $eventHandler)
    {
        if (!ModTracker::isTrackingEnabledForModule($eventHandler->getModuleName())) {
            return false;
        }
Severity: Major
Found in modules/ModTracker/handlers/ModTrackerHandler.php - About 3 hrs to fix

    The class ModTracker_ModTrackerHandler_Handler has an overall complexity of 56 which is very high. The configured complexity threshold is 50.
    Open

    class ModTracker_ModTrackerHandler_Handler
    {
        /**
         * EntityAfterSave function.
         *

    File ModTrackerHandler.php has 253 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /* +**********************************************************************************
     * The contents of this file are subject to the vtiger CRM Public License Version 1.0
     * ("License"); You may not use this file except in compliance with the License
     * The Original Code is:  vtiger CRM Open Source
    Severity: Minor
    Found in modules/ModTracker/handlers/ModTrackerHandler.php - About 2 hrs to fix

      Method entityChangeState has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function entityChangeState(App\EventHandler $eventHandler)
          {
              if (!ModTracker::isTrackingEnabledForModule($eventHandler->getModuleName())) {
                  return false;
              }
      Severity: Minor
      Found in modules/ModTracker/handlers/ModTrackerHandler.php - About 1 hr to fix

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

            public function entityChangeState(App\EventHandler $eventHandler)
            {
                if (!ModTracker::isTrackingEnabledForModule($eventHandler->getModuleName())) {
                    return false;
                }
        Severity: Minor
        Found in modules/ModTracker/handlers/ModTrackerHandler.php - About 55 mins to fix

        Cognitive Complexity

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

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

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

        Further reading

        Function addNotification has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            public function addNotification($moduleName, $recordId, $watchdogTitle, $watchdogMessage = '')
            {
                if ($watchdogTitle) {
                    $watchdog = Vtiger_Watchdog_Model::getInstanceById($recordId, $moduleName);
                    $users = $watchdog->getWatchingUsers([\App\User::getCurrentUserRealId()]);
        Severity: Minor
        Found in modules/ModTracker/handlers/ModTrackerHandler.php - About 25 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 entityAfterSave() has an NPath complexity of 333312. The configured NPath complexity threshold is 200.
        Open

            public function entityAfterSave(App\EventHandler $eventHandler)
            {
                if (!ModTracker::isTrackingEnabledForModule($eventHandler->getModuleName())) {
                    return false;
                }

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

            public function entityAfterSave(App\EventHandler $eventHandler)
            {
                if (!ModTracker::isTrackingEnabledForModule($eventHandler->getModuleName())) {
                    return false;
                }

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

            public function entityAfterSave(App\EventHandler $eventHandler)

        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

        Avoid using undefined variables such as '$statusLabel' which will lead to PHP notices.
        Open

                    $watchdogTitle = $status === ModTracker::$TRANSFER_EDIT ? ModTracker_Record_Model::$statusLabel[$status] : '';

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

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

        Avoid using undefined variables such as '$statusLabel' which will lead to PHP notices.
        Open

                $this->addNotification($eventHandler->getModuleName(), $recordId, ModTracker_Record_Model::$statusLabel[$status]);

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

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

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

        class ModTracker_ModTrackerHandler_Handler
        {
            /**
             * EntityAfterSave function.
             *

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

                        throw new App\Exceptions\AppException("Incorrect data type in $fieldName: Value can not be the object of " . \get_class($newValue));

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

                $isExists = (new \App\Db\Query())->from('vtiger_crmentity')->where(['crmid' => $recordId])->andWhere(['<>', 'smownerid', \App\User::getCurrentUserRealId()])->exists();

        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 'ModTracker' in method 'entityAfterUnLink'.
        Open

                ModTracker::unLinkRelation($params['sourceModule'], $params['sourceRecordId'], $params['destinationModule'], $params['destinationRecordId']);

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

                if (App\Config::module('ModTracker', 'WATCHDOG')) {

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

                        \App\Log::warning($fieldName . ' field does not exist in the module ' . $eventHandler->getModuleName(), __METHOD__);

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

                } else {
                    $delta = $recordModel->getChanges();
                    $status = ModTracker::$UPDATED;
                    $watchdogTitle = 'LBL_UPDATED';
                    $watchdogMessage = '$(record : ChangesListValues)$';

        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\User' in method 'entityAfterSave'.
        Open

                    'whodid' => App\User::getCurrentUserRealId(),

        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 'ModTracker_Record_Model' in method 'entityAfterSave'.
        Open

                    ModTracker_Record_Model::unsetReviewed($recordId, App\User::getCurrentUserRealId(), $id);

        StaticAccess

        Since: 1.4.0

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

        Example

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

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

        Avoid using static access to class 'ModTracker' in method 'detailViewBefore'.
        Open

                if (!ModTracker::isTrackingEnabledForModule($eventHandler->getModuleName())) {

        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 'ModTracker' in method 'entityAfterSave'.
        Open

        }

        StaticAccess

        Since: 1.4.0

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

        Example

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

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

        Avoid using static access to class 'ModTracker' in method 'entityChangeState'.
        Open

        }

        StaticAccess

        Since: 1.4.0

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

        Example

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

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

        Avoid assigning values to variables in if clauses and the like (line '29', column '53').
        Open

            public function entityAfterSave(App\EventHandler $eventHandler)
            {
                if (!ModTracker::isTrackingEnabledForModule($eventHandler->getModuleName())) {
                    return false;
                }

        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 'ModTracker' in method 'entityAfterLink'.
        Open

                if (!ModTracker::isTrackingEnabledForModule($params['destinationModule'])) {

        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\User' in method 'detailViewBefore'.
        Open

                    'whodid' => \App\User::getCurrentUserRealId(),

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

            public function entityAfterSave(App\EventHandler $eventHandler)
            {
                if (!ModTracker::isTrackingEnabledForModule($eventHandler->getModuleName())) {
                    return false;
                }

        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 'ModTracker' in method 'entityAfterLink'.
        Open

                ModTracker::linkRelation($params['sourceModule'], $params['sourceRecordId'], $params['destinationModule'], $params['destinationRecordId']);

        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 'ModTracker' in method 'entityAfterTransferLink'.
        Open

                if (!ModTracker::isTrackingEnabledForModule($params['destinationModule'])) {

        StaticAccess

        Since: 1.4.0

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

        Example

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

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

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

                $db = \App\Db::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 'ModTracker' in method 'entityAfterUnLink'.
        Open

                    ModTracker::unLinkRelation($params['destinationModule'], $params['destinationRecordId'], $params['sourceModule'], $params['sourceRecordId']);

        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 'ModTracker' in method 'entityAfterTransferUnLink'.
        Open

                if (!ModTracker::isTrackingEnabledForModule($params['destinationModule'])) {

        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\User' in method 'entityAfterSave'.
        Open

                    'last_reviewed_users' => '#' . App\User::getCurrentUserRealId() . '#',

        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\User' in method 'entityAfterSave'.
        Open

                    ModTracker_Record_Model::unsetReviewed($recordId, App\User::getCurrentUserRealId(), $id);

        StaticAccess

        Since: 1.4.0

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

        Example

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

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

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

                        $preValue = empty($preValue) ? $preValue : \App\TextUtils::textTruncate($preValue, 65532);

        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 'ModTracker' in method 'entityAfterSave'.
        Open

                if (!ModTracker::isTrackingEnabledForModule($eventHandler->getModuleName())) {

        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 'ModTracker' in method 'entityAfterUnLink'.
        Open

                if (!ModTracker::isTrackingEnabledForModule($params['destinationModule'])) {

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

                if (App\Config::module('ModTracker', 'WATCHDOG')) {

        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 'ModTracker' in method 'entityAfterTransferLink'.
        Open

                ModTracker::transferRelation($eventHandler->getModuleName(), $params['sourceRecordId'], $params['destinationModule'], $params['destinationRecordId'], ModTracker::$TRANSFER_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 'ModTracker' in method 'entityAfterTransferUnLink'.
        Open

                ModTracker::transferRelation($eventHandler->getModuleName(), $params['sourceRecordId'], $params['destinationModule'], $params['destinationRecordId'], ModTracker::$TRANSFER_UNLINK);

        StaticAccess

        Since: 1.4.0

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

        Example

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

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

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

                    $db->createCommand()->insert('u_#__modtracker_inv', ['id' => $id, 'changes' => \App\Json::encode($inventoryData)])->execute();

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

                        $newValue = empty($newValue) ? $newValue : \App\TextUtils::textTruncate($newValue, 65532);

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

                    $watchdogMessage = '<a href="index.php?module=' . $params['sourceModule'] . '&view=Detail&record=' . $params['sourceRecordId'] . '">' . vtlib\Functions::getCRMRecordLabel($params['sourceRecordId']) . '</a>';

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

                    $watchdogMessage = '<a href="index.php?module=' . $params['sourceModule'] . '&view=Detail&record=' . $params['sourceRecordId'] . '">' . vtlib\Functions::getCRMRecordLabel($params['sourceRecordId']) . '</a>';

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

                } else {
                    switch ($recordModel->get('deleted')) {
                        case 'Active':
                            $status = ModTracker::$ACTIVE;
                            break;

        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\User' in method 'entityAfterShowHiddenData'.
        Open

                    'whodid' => \App\User::getCurrentUserRealId(),

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

                        $watchdogTitle = \App\Fields\Owner::getUserLabel(\App\User::getCurrentUserId()) . ' ' . $watchdogTitle;

        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\User' in method 'entityChangeState'.
        Open

                    'whodid' => \App\User::getCurrentUserRealId(),

        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\User' in method 'entityChangeState'.
        Open

                    'last_reviewed_users' => '#' . \App\User::getCurrentUserRealId() . '#',

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

                            $notification = Vtiger_Record_Model::getCleanInstance('Notification');

        StaticAccess

        Since: 1.4.0

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

        Example

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

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

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

                $db = \App\Db::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 'ModTracker' in method 'entityChangeState'.
        Open

                if (!ModTracker::isTrackingEnabledForModule($eventHandler->getModuleName())) {

        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\ModuleHierarchy' in method 'addNotification'.
        Open

                        $relatedField = \App\ModuleHierarchy::getMappingRelatedField($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 'ModTracker_Record_Model' in method 'entityChangeState'.
        Open

                ModTracker_Record_Model::unsetReviewed($recordId, \App\User::getCurrentUserRealId(), $id);

        StaticAccess

        Since: 1.4.0

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

        Example

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

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

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

                $isExists = (new \App\Db\Query())->from('vtiger_crmentity')->where(['crmid' => $recordId])->andWhere(['<>', 'smownerid', \App\User::getCurrentUserRealId()])->exists();

        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\User' in method 'entityChangeState'.
        Open

                ModTracker_Record_Model::unsetReviewed($recordId, \App\User::getCurrentUserRealId(), $id);

        StaticAccess

        Since: 1.4.0

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

        Example

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

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

        Avoid using static access to class 'ModTracker' in method 'entityAfterShowHiddenData'.
        Open

                if (!ModTracker::isTrackingEnabledForModule($eventHandler->getModuleName())) {

        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\User' in method 'addNotification'.
        Open

                    $users = $watchdog->getWatchingUsers([\App\User::getCurrentUserRealId()]);

        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 'ModTracker' in method 'entityAfterDelete'.
        Open

                if (!ModTracker::isTrackingEnabledForModule($eventHandler->getModuleName())) {

        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\User' in method 'entityAfterDelete'.
        Open

                    'whodid' => \App\User::getCurrentUserRealId(),

        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_Watchdog_Model' in method 'addNotification'.
        Open

                    $watchdog = Vtiger_Watchdog_Model::getInstanceById($recordId, $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\User' in method 'addNotification'.
        Open

                        $watchdogTitle = \App\Fields\Owner::getUserLabel(\App\User::getCurrentUserId()) . ' ' . $watchdogTitle;

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

                if (!ModTracker::isTrackingEnabledForModule($params['destinationModule'])) {

        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 "Y-m-d H:i:s" 4 times.
        Open

                    'changedon' => date('Y-m-d H:i:s'),

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

                } elseif (isset($recordModel->ext['modificationType'], ModTracker::getAllActionsTypes()[$recordModel->ext['modificationType']])) {

        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 "&view=Detail&record=" 4 times.
        Open

                    $watchdogMessage = '<a href="index.php?module=' . $params['sourceModule'] . '&view=Detail&record=' . $params['sourceRecordId'] . '">' . vtlib\Functions::getCRMRecordLabel($params['sourceRecordId']) . '</a>';

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

                ModTracker::linkRelation($params['sourceModule'], $params['sourceRecordId'], $params['destinationModule'], $params['destinationRecordId']);

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

                    'changedon' => $recordModel->get('modifiedtime'),

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

                $db->createCommand()->insert('vtiger_modtracker_basic', [

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

                ModTracker::linkRelation($params['sourceModule'], $params['sourceRecordId'], $params['destinationModule'], $params['destinationRecordId']);

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

                    'whodid' => App\User::getCurrentUserRealId(),

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

                    'crmid' => $recordId,

        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 "<a href="index.php?module=" times.></a>
        Open

                    $watchdogMessage = '<a href="index.php?module=' . $params['sourceModule'] . '&view=Detail&record=' . $params['sourceRecordId'] . '">' . vtlib\Functions::getCRMRecordLabel($params['sourceRecordId']) . '</a>';

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

                ModTracker::linkRelation($params['sourceModule'], $params['sourceRecordId'], $params['destinationModule'], $params['destinationRecordId']);

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

                    'status' => $status,

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

                        $delta['inventory'] = array_fill_keys(array_keys($invData), []);

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

                    'module' => $eventHandler->getModuleName(),

        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 getCurrentUserRealId from undeclared class \App\User (Did you mean class \Tests\App\User)
        Open

                    'last_reviewed_users' => '#' . App\User::getCurrentUserRealId() . '#',

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

                    'whodid' => \App\User::getCurrentUserRealId(),

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

                    'whodid' => \App\User::getCurrentUserRealId(),

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

                \App\Db::getInstance()->createCommand()->insert('vtiger_modtracker_basic', [

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

                $db->createCommand()->insert('vtiger_modtracker_basic', [

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

                ModTracker_Record_Model::unsetReviewed($recordId, \App\User::getCurrentUserRealId(), $id);

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

                    $db->createCommand()->insert('u_#__modtracker_inv', ['id' => $id, 'changes' => \App\Json::encode($inventoryData)])->execute();

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

                        \App\Log::warning($fieldName . ' field does not exist in the module ' . $eventHandler->getModuleName(), __METHOD__);

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

                    'whodid' => \App\User::getCurrentUserRealId(),

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

                    $db->createCommand()->update('vtiger_crmentity', ['was_read' => 0], ['crmid' => $recordId])->execute();

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

                        $watchdogTitle = \App\Fields\Owner::getUserLabel(\App\User::getCurrentUserId()) . ' ' . $watchdogTitle;

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

                $db->createCommand()->insert('vtiger_modtracker_basic', [

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

                \App\Db::getInstance()->createCommand()->insert('vtiger_modtracker_basic', [

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

                    'whodid' => App\User::getCurrentUserRealId(),

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

                        $watchdogTitle = \App\Fields\Owner::getUserLabel(\App\User::getCurrentUserId()) . ' ' . $watchdogTitle;

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

                    'last_reviewed_users' => '#' . \App\User::getCurrentUserRealId() . '#',

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

                $isExists = (new \App\Db\Query())->from('vtiger_crmentity')->where(['crmid' => $recordId])->andWhere(['<>', 'smownerid', \App\User::getCurrentUserRealId()])->exists();

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

                    'whodid' => \App\User::getCurrentUserRealId(),

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

                    $users = $watchdog->getWatchingUsers([\App\User::getCurrentUserRealId()]);

        Invalid offset "id" of array type array{}
        Open

                        $itemId = $invData['id'] ?? $item['id'];

        Invalid offset "name" of array type array{}
        Open

                        $inventoryData[$itemId]['item'] = $invData['name'] ?? $item['name'];

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

                \App\Db::getInstance()->createCommand()->insert('vtiger_modtracker_basic', [

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

                    ModTracker_Record_Model::unsetReviewed($recordId, App\User::getCurrentUserRealId(), $id);

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

                $isExists = (new \App\Db\Query())->from('vtiger_crmentity')->where(['crmid' => $recordId])->andWhere(['<>', 'smownerid', \App\User::getCurrentUserRealId()])->exists();

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

                    $db->createCommand()

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

                if (App\Config::module('ModTracker', 'WATCHDOG')) {
                    $watchdogTitle = 'LBL_UNLINK';
                    $watchdogMessage = '<a href="index.php?module=' . $params['sourceModule'] . '&view=Detail&record=' . $params['sourceRecordId'] . '">' . vtlib\Functions::getCRMRecordLabel($params['sourceRecordId']) . '</a>';
                    $watchdogMessage .= ' $(translate : LBL_WITH)$ ';
                    $watchdogMessage .= '<a href="index.php?module=' . $params['destinationModule'] . '&view=Detail&record=' . $params['destinationRecordId'] . '">$(record : RecordLabel)$</a>';
        Severity: Major
        Found in modules/ModTracker/handlers/ModTrackerHandler.php and 1 other location - About 2 hrs to fix
        modules/ModTracker/handlers/ModTrackerHandler.php on lines 127..133

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

        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 2 locations. Consider refactoring.
        Open

                if (App\Config::module('ModTracker', 'WATCHDOG')) {
                    $watchdogTitle = 'LBL_ADDED';
                    $watchdogMessage = '<a href="index.php?module=' . $params['sourceModule'] . '&view=Detail&record=' . $params['sourceRecordId'] . '">' . vtlib\Functions::getCRMRecordLabel($params['sourceRecordId']) . '</a>';
                    $watchdogMessage .= ' $(translate : LBL_WITH)$ ';
                    $watchdogMessage .= '<a href="index.php?module=' . $params['destinationModule'] . '&view=Detail&record=' . $params['destinationRecordId'] . '">$(record : RecordLabel)$</a>';
        Severity: Major
        Found in modules/ModTracker/handlers/ModTrackerHandler.php and 1 other location - About 2 hrs to fix
        modules/ModTracker/handlers/ModTrackerHandler.php on lines 151..157

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

        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 2 locations. Consider refactoring.
        Open

            public function detailViewBefore(App\EventHandler $eventHandler)
            {
                if (!ModTracker::isTrackingEnabledForModule($eventHandler->getModuleName())) {
                    return false;
                }
        Severity: Major
        Found in modules/ModTracker/handlers/ModTrackerHandler.php and 1 other location - About 1 hr to fix
        modules/ModTracker/handlers/ModTrackerHandler.php on lines 262..274

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

        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 2 locations. Consider refactoring.
        Open

            public function entityAfterDelete(App\EventHandler $eventHandler)
            {
                if (!ModTracker::isTrackingEnabledForModule($eventHandler->getModuleName())) {
                    return false;
                }
        Severity: Major
        Found in modules/ModTracker/handlers/ModTrackerHandler.php and 1 other location - About 1 hr to fix
        modules/ModTracker/handlers/ModTrackerHandler.php on lines 195..207

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

        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 ModTracker_ModTrackerHandler_Handler

        A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 13 and the first side effect is on line 11.
        Open

        <?php

        The class ModTracker_ModTrackerHandler_Handler is not named in CamelCase.
        Open

        class ModTracker_ModTrackerHandler_Handler
        {
            /**
             * EntityAfterSave function.
             *

        CamelCaseClassName

        Since: 0.2

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

        Example

        class class_name {
        }

        Source

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

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

        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

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

                $id = $db->getLastInsertID('vtiger_modtracker_basic_id_seq');

        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

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

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

        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

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

                $id = $db->getLastInsertID('vtiger_modtracker_basic_id_seq');

        ShortVariable

        Since: 0.2

        Detects when a field, local, or parameter has a very short name.

        Example

        class Something {
            private $q = 15; // VIOLATION - Field
            public static function main( array $as ) { // VIOLATION - Formal
                $r = 20 + $this->q; // VIOLATION - Local
                for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                    $r += $this->q;
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#shortvariable

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

            public function entityAfterSave(App\EventHandler $eventHandler)

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

                if (!ModTracker::isTrackingEnabledForModule($eventHandler->getModuleName())) {

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

             *

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

             * @param App\EventHandler $eventHandler

        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

             * EntityAfterSave function.

        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

                    'status' => $status,

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

                    $inventoryData = [];

        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::warning($fieldName . ' field does not exist in the module ' . $eventHandler->getModuleName(), __METHOD__);

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

                }

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

             * EntityAfterLink handler function.

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

             *

        Line exceeds 120 characters; contains 185 characters
        Open

                    $watchdogMessage .= '<a href="index.php?module=' . $params['destinationModule'] . '&view=Detail&record=' . $params['destinationRecordId'] . '">$(record : RecordLabel)$</a>';

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

                    $watchdogTitle = $status === ModTracker::$TRANSFER_EDIT ? ModTracker_Record_Model::$statusLabel[$status] : '';

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

                if (isset($delta['inventory'])) {

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

                        $newValue = implode(',', $newValue);

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

                        $preValue = $newValue = '****';

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

                if ($insertedData) {

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

                $recordModel = $eventHandler->getRecordModel();

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

                if (empty($delta)) {

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

                ])->execute();

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

                        continue;

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

                    if (!$fieldModel) {

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

                    $db->createCommand()

        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

                    return false;

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

                    ModTracker::unLinkRelation($params['destinationModule'], $params['destinationRecordId'], $params['sourceModule'], $params['sourceRecordId']);

        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 ($recordModel->getModule()->isInventory() && ($invData = $recordModel->getInventoryData())) {

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

                } elseif (isset($recordModel->ext['modificationType'], ModTracker::getAllActionsTypes()[$recordModel->ext['modificationType']])) {

        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

                    ModTracker_Record_Model::unsetReviewed($recordId, App\User::getCurrentUserRealId(), $id);

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

                        $inventoryData[$itemId]['postvalue'] = $invData ? array_intersect_key($item, $invData) : $item;

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

                    if (\is_object($newValue)) {

        Line exceeds 120 characters; contains 124 characters
        Open

                if ($params['relatedName'] && \in_array($params['relatedName'], ['getManyToMany', 'getRelatedList', 'getEmails'])) {

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

                    $watchdogMessage .= ' $(translate : LBL_WITH)$ ';

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

                    $watchdogTitle = 'LBL_CREATED';

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

                    $delta = $recordModel->getChanges();

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

                $id = $db->getLastInsertID('vtiger_modtracker_basic_id_seq');

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

                    foreach ($delta['inventory'] as $key => $invData) {

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

                $insertedData = [];

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

                        throw new App\Exceptions\AppException("Incorrect data type in $fieldName: Value can not be the object of " . \get_class($newValue));

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

                    }

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

                    $watchdogMessage .= '<a href="index.php?module=' . $params['destinationModule'] . '&view=Detail&record=' . $params['destinationRecordId'] . '">$(record : RecordLabel)$</a>';

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

                $params = $eventHandler->getParams();

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

                    $watchdogMessage .= '<a href="index.php?module=' . $params['destinationModule'] . '&view=Detail&record=' . $params['destinationRecordId'] . '">$(record : RecordLabel)$</a>';

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

                    $watchdogMessage = '$(record : ChangesListValues)$';

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

                        }

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

                        $itemId = $invData['id'] ?? $item['id'];

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

                    if ($fieldModel && \in_array(\App\Anonymization::MODTRACKER_DB, $fieldModel->getAnonymizationTarget())) {

        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->addNotification($params['destinationModule'], $params['destinationRecordId'], $watchdogTitle, $watchdogMessage);

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

                }

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

                    $delta = array_intersect_key($recordModel->getData(), $recordModel->getModule()->getFields());

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

                    $watchdogTitle = $status === ModTracker::$TRANSFER_EDIT ? ModTracker_Record_Model::$statusLabel[$status] : '';

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

                    $delta = $recordModel->getChanges();

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

                $recordId = $recordModel->getId();

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

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

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

                    'last_reviewed_users' => '#' . App\User::getCurrentUserRealId() . '#',

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

                        $item = $recordModel->getInventoryItem($key) ?? [];

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

                    unset($delta['inventory']);

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

                    $newValue = $recordModel->get($fieldName);

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

                if (App\Config::module('ModTracker', 'WATCHDOG')) {

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

                    $watchdogMessage .= ' $(translate : LBL_WITH)$ ';

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

                }

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

                    unset($delta['createdtime'], $delta['modifiedtime'], $delta['modifiedby']);

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

                    $status = ModTracker::$UPDATED;

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

                    if (empty($preValue) && empty($newValue)) {

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

            {

        Line exceeds 120 characters; contains 153 characters
        Open

                    ModTracker::unLinkRelation($params['destinationModule'], $params['destinationRecordId'], $params['sourceModule'], $params['sourceRecordId']);

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

                    $watchdogMessage = '$(record : ChangesListValues)$';

        Line exceeds 120 characters; contains 138 characters
        Open

                } elseif (isset($recordModel->ext['modificationType'], ModTracker::getAllActionsTypes()[$recordModel->ext['modificationType']])) {

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

                    }

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

                }

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

            /**

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

                $params = $eventHandler->getParams();

        Line exceeds 120 characters; contains 131 characters
        Open

                    $this->addNotification($params['destinationModule'], $params['destinationRecordId'], $watchdogTitle, $watchdogMessage);

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

            }

        Line exceeds 120 characters; contains 185 characters
        Open

                    $watchdogMessage .= '<a href="index.php?module=' . $params['destinationModule'] . '&view=Detail&record=' . $params['destinationRecordId'] . '">$(record : RecordLabel)$</a>';

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

                if ($skipFields = $recordModel->ext['ModTrackerSkipFields'] ?? []) {

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

                if (!$recordModel->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

                        $inventoryData[$itemId]['prevalue'] = $invData;

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

                    $db->createCommand()->insert('u_#__modtracker_inv', ['id' => $id, 'changes' => \App\Json::encode($inventoryData)])->execute();

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

                    }

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

                $this->addNotification($eventHandler->getModuleName(), $recordId, $watchdogTitle, $watchdogMessage);

        Line exceeds 120 characters; contains 147 characters
        Open

                ModTracker::linkRelation($params['sourceModule'], $params['sourceRecordId'], $params['destinationModule'], $params['destinationRecordId']);

        Line exceeds 120 characters; contains 219 characters
        Open

                    $watchdogMessage = '<a href="index.php?module=' . $params['sourceModule'] . '&view=Detail&record=' . $params['sourceRecordId'] . '">' . vtlib\Functions::getCRMRecordLabel($params['sourceRecordId']) . '</a>';

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

                    'changedon' => $recordModel->get('modifiedtime'),

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

                        ->execute();

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

                if (!ModTracker::isTrackingEnabledForModule($params['destinationModule'])) {

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

                }

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

             * @param App\EventHandler $eventHandler

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

                if (!ModTracker::isTrackingEnabledForModule($params['destinationModule'])) {

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

                    $watchdogMessage = '<a href="index.php?module=' . $params['sourceModule'] . '&view=Detail&record=' . $params['sourceRecordId'] . '">' . vtlib\Functions::getCRMRecordLabel($params['sourceRecordId']) . '</a>';

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

             *

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

                $params = $eventHandler->getParams();

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

             */

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

                            break;

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

                            $status = ModTracker::$ARCHIVED;

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

                    'whodid' => \App\User::getCurrentUserRealId(),

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

                $recordModel = $eventHandler->getRecordModel();

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

                    'whodid' => \App\User::getCurrentUserRealId(),

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

                    $status = ModTracker::$CREATED;

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

                    $watchdogMessage = '';

        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

                $db->createCommand()->insert('vtiger_modtracker_basic', [

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

                    'crmid' => $recordId,

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

                        $inventoryData[$itemId]['item'] = $invData['name'] ?? $item['name'];

        Line exceeds 120 characters; contains 138 characters
        Open

                    $db->createCommand()->insert('u_#__modtracker_inv', ['id' => $id, 'changes' => \App\Json::encode($inventoryData)])->execute();

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

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

        Line exceeds 120 characters; contains 132 characters
        Open

                        \App\Log::warning($fieldName . ' field does not exist in the module ' . $eventHandler->getModuleName(), __METHOD__);

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

                        $newValue = empty($newValue) ? $newValue : \App\TextUtils::textTruncate($newValue, 65532);

        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

             * EntityAfterTransferLink handler function.

        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

                    $db->createCommand()->update('vtiger_crmentity', ['was_read' => 0], ['crmid' => $recordId])->execute();

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

                $this->addNotification($eventHandler->getModuleName(), $recordId, ModTracker_Record_Model::$statusLabel[$status]);

        Line exceeds 120 characters; contains 122 characters
        Open

                $this->addNotification($eventHandler->getModuleName(), $recordId, ModTracker_Record_Model::$statusLabel[$status]);

        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

                }

        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 ($delta as $fieldName => $preValue) {

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

            }

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

                    $watchdogTitle = 'LBL_ADDED';

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

            public function entityAfterUnLink(App\EventHandler $eventHandler)

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

                ModTracker::unLinkRelation($params['sourceModule'], $params['sourceRecordId'], $params['destinationModule'], $params['destinationRecordId']);

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

            {

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

                }

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

             *

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

             * @param App\EventHandler $eventHandler

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

                    $status = $recordModel->ext['modificationType'];

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

                            break;

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

                        default:

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

                }

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

                }

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

                    'module' => $eventHandler->getModuleName(),

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

                    'changedon' => date('Y-m-d H:i:s'),

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

            public function addNotification($moduleName, $recordId, $watchdogTitle, $watchdogMessage = '')

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

                    $watchdog = Vtiger_Watchdog_Model::getInstanceById($recordId, $moduleName);

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

                        $delta['inventory'] = array_fill_keys(array_keys($invData), []);

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

                    foreach ($delta as $fieldName => $preValue) {

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

                    'whodid' => App\User::getCurrentUserRealId(),

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

                    }

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

                        $preValue = empty($preValue) ? $preValue : \App\TextUtils::textTruncate($preValue, 65532);

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

                    $insertedData[] = [$id, $fieldName, $preValue, $newValue];

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

                        ->batchInsert('vtiger_modtracker_detail', ['id', 'fieldname', 'prevalue', 'postvalue'], $insertedData)

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

                }

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

                ModTracker::linkRelation($params['sourceModule'], $params['sourceRecordId'], $params['destinationModule'], $params['destinationRecordId']);

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

                    $watchdogMessage = '<a href="index.php?module=' . $params['sourceModule'] . '&view=Detail&record=' . $params['sourceRecordId'] . '">' . vtlib\Functions::getCRMRecordLabel($params['sourceRecordId']) . '</a>';

        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;

        Line exceeds 120 characters; contains 186 characters
        Open

                ModTracker::transferRelation($eventHandler->getModuleName(), $params['sourceRecordId'], $params['destinationModule'], $params['destinationRecordId'], ModTracker::$TRANSFER_LINK);

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

                ModTracker::transferRelation($eventHandler->getModuleName(), $params['sourceRecordId'], $params['destinationModule'], $params['destinationRecordId'], ModTracker::$TRANSFER_UNLINK);

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

             * DetailViewBefore handler function.

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

             */

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

                $status = 0;

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

                    }

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

                    'whodid' => \App\User::getCurrentUserRealId(),

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

                \App\Db::getInstance()->createCommand()->insert('vtiger_modtracker_basic', [

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

                    'crmid' => $eventHandler->getRecordModel()->getId(),

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

            /**

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

             * @param string $moduleName

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

                if ($recordModel->isNew()) {

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

                    $watchdogTitle = 'LBL_UPDATED';

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

                        if (\in_array($fieldName, $skipFields)) {

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

                            unset($delta[$fieldName]);

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

                    'module' => $eventHandler->getModuleName(),

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

                    if (\is_array($newValue)) {

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

             */

        Line exceeds 120 characters; contains 149 characters
        Open

                ModTracker::unLinkRelation($params['sourceModule'], $params['sourceRecordId'], $params['destinationModule'], $params['destinationRecordId']);

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

                if (App\Config::module('ModTracker', 'WATCHDOG')) {

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

                    $watchdogTitle = 'LBL_UNLINK';

        Line exceeds 120 characters; contains 131 characters
        Open

                    $this->addNotification($params['destinationModule'], $params['destinationRecordId'], $watchdogTitle, $watchdogMessage);

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

                    $delta = array_fill_keys(array_keys($delta), null);

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

                    $status = $recordModel->ext['modificationType'];

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

                    }

        Line exceeds 120 characters; contains 148 characters
        Open

                        throw new App\Exceptions\AppException("Incorrect data type in $fieldName: Value can not be the object of " . \get_class($newValue));

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

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

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

             * @param App\EventHandler $eventHandler

        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 entityAfterLink(App\EventHandler $eventHandler)

        Line exceeds 120 characters; contains 219 characters
        Open

                    $watchdogMessage = '<a href="index.php?module=' . $params['sourceModule'] . '&view=Detail&record=' . $params['sourceRecordId'] . '">' . vtlib\Functions::getCRMRecordLabel($params['sourceRecordId']) . '</a>';

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

                    $this->addNotification($params['destinationModule'], $params['destinationRecordId'], $watchdogTitle, $watchdogMessage);

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

             * EntityAfterUnLink handler function.

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

                if ($params['relatedName'] && \in_array($params['relatedName'], ['getManyToMany', 'getRelatedList', 'getEmails'])) {

        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 entityAfterTransferUnLink(App\EventHandler $eventHandler)

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

                }

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

                    'changedon' => date('Y-m-d H:i:s'),

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

             * EntityAfterDelete handler function.

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

             * @param App\EventHandler $eventHandler

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

             * @param int    $recordId

        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 ($watchdogTitle) {

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

                if (!ModTracker::isTrackingEnabledForModule($params['destinationModule'])) {

        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

                } else {

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

                        case 'Active':

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

                            break;

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

                $db->createCommand()->insert('vtiger_modtracker_basic', [

        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

             */

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

                \App\Db::getInstance()->createCommand()->insert('vtiger_modtracker_basic', [

        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

                $recordId = $recordModel->getId();

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

                            $status = ModTracker::$TRASH;

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

                            break;

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

                    'last_reviewed_users' => '#' . \App\User::getCurrentUserRealId() . '#',

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

            /**

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

                            $notification->set('shownerid', $users);

        Line exceeds 120 characters; contains 188 characters
        Open

                ModTracker::transferRelation($eventHandler->getModuleName(), $params['sourceRecordId'], $params['destinationModule'], $params['destinationRecordId'], ModTracker::$TRANSFER_UNLINK);

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

            /**

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

                    'module' => $eventHandler->getModuleName(),

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

            {

        Line exceeds 120 characters; contains 132 characters
        Open

                if (isset($recordModel->ext['modificationType'], ModTracker::getAllActionsTypes()[$recordModel->ext['modificationType']])) {

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

                    'status' => $status,

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

                ModTracker_Record_Model::unsetReviewed($recordId, \App\User::getCurrentUserRealId(), $id);

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

             * Show hidden data handler function.

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

                    $users = $watchdog->getWatchingUsers([\App\User::getCurrentUserRealId()]);

        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 entityAfterTransferLink(App\EventHandler $eventHandler)

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

                if (!ModTracker::isTrackingEnabledForModule($params['destinationModule'])) {

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

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

        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 entityAfterDelete(App\EventHandler $eventHandler)

        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 entityAfterShowHiddenData(App\EventHandler $eventHandler)

        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 (!ModTracker::isTrackingEnabledForModule($eventHandler->getModuleName())) {

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

             * @param string $watchdogMessage

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

                        $watchdogTitle = \App\Fields\Owner::getUserLabel(\App\User::getCurrentUserId()) . ' ' . $watchdogTitle;

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

                            $notification->set('description', $watchdogMessage);

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

                }

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

                $params = $eventHandler->getParams();

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

                ModTracker::transferRelation($eventHandler->getModuleName(), $params['sourceRecordId'], $params['destinationModule'], $params['destinationRecordId'], ModTracker::$TRANSFER_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

            public function entityChangeState(App\EventHandler $eventHandler)

        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

                    'module' => $eventHandler->getModuleName(),

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

                ])->execute();

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

            }

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

             *

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

             * @param App\EventHandler $eventHandler

        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

                    switch ($recordModel->get('deleted')) {

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

                        case 'Archived':

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

                            $notification->save();

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

                            $notification->set('notification_type', $watchdog->noticeDefaultType);

        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

            public function detailViewBefore(App\EventHandler $eventHandler)

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

            {

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

                    'whodid' => \App\User::getCurrentUserRealId(),

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

                    'status' => ModTracker::$DISPLAYED,

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

                $recordModel = $eventHandler->getRecordModel();

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

                            $status = ModTracker::$ACTIVE;

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

                $id = $db->getLastInsertID('vtiger_modtracker_basic_id_seq');

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

                $isExists = (new \App\Db\Query())->from('vtiger_crmentity')->where(['crmid' => $recordId])->andWhere(['<>', 'smownerid', \App\User::getCurrentUserRealId()])->exists();

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

            {

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

                if (!ModTracker::isTrackingEnabledForModule($eventHandler->getModuleName())) {

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

                    'status' => ModTracker::$DELETED,

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

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

                            $notification->set('notification_status', 'PLL_UNREAD');

        Line exceeds 120 characters; contains 127 characters
        Open

                            $notification->setHandlerExceptions(['disableHandlerClasses' => ['ModTracker_ModTrackerHandler_Handler']]);

        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 (!ModTracker::isTrackingEnabledForModule($eventHandler->getModuleName())) {

        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 (!ModTracker::isTrackingEnabledForModule($eventHandler->getModuleName())) {

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

                    'crmid' => $recordId,

        Line exceeds 120 characters; contains 175 characters
        Open

                $isExists = (new \App\Db\Query())->from('vtiger_crmentity')->where(['crmid' => $recordId])->andWhere(['<>', 'smownerid', \App\User::getCurrentUserRealId()])->exists();

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

             */

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

             *

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

                    'crmid' => $recordModel->getId(),

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

             */

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

             * @param App\EventHandler $eventHandler

        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

                }

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

                ])->execute();

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

             * EntityChangeState handler function.

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

             * @param \App\EventHandler $eventHandler

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

                            $notification->set($relatedField, $recordId);

        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

            {

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

                \App\Db::getInstance()->createCommand()->insert('vtiger_modtracker_basic', [

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

                    'crmid' => $eventHandler->getRecordModel()->getId(),

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

                if (isset($recordModel->ext['modificationType'], ModTracker::getAllActionsTypes()[$recordModel->ext['modificationType']])) {

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

                        case 'Trash':

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

                    'changedon' => date('Y-m-d H:i:s'),

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

                ])->execute();

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

                    'changedon' => date('Y-m-d H:i:s'),

        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

                        $relatedField = \App\ModuleHierarchy::getMappingRelatedField($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

             *

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

             * @param App\EventHandler $eventHandler

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

                    'module' => $eventHandler->getModuleName(),

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

                if ($isExists) {

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

            }

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

                    'status' => ModTracker::$SHOW_HIDDEN_DATA,

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

                ])->execute();

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

            }

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

             * Add notification in handler.

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

                        $watchdogTitle = '$(translate : ModTracker|' . $watchdogTitle . ')$ $(record : RecordLabel)$';

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

                            $notification = Vtiger_Record_Model::getCleanInstance('Notification');

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

                            $notification->set('title', $watchdogTitle);

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

            }

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

                            $notification->setHandlerExceptions(['disableHandlerClasses' => ['ModTracker_ModTrackerHandler_Handler']]);

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

                        if ($relatedField) {

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

        class ModTracker_ModTrackerHandler_Handler

        There are no issues that match your filters.

        Category
        Status