YetiForceCompany/YetiForceCRM

View on GitHub
app/Automatic/RecordFlowUpdater.php

Summary

Maintainability
A
50 mins
Test Coverage
F
16%

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

    private function addToQueueWhenParentHasBeenModified(\Vtiger_Record_Model $recordModel)
    {
        if (!empty($this->targetColumnParentId) && false !== ($previousValue = $recordModel->getPreviousValue($this->targetColumnParentId))) {
            if (!empty($previousValue)) {
                $this->addToQueueSubordinateModule($previousValue);
Severity: Minor
Found in app/Automatic/RecordFlowUpdater.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

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

    public function updateFieldValue(int $recordId)
    {
        if (!$this->checkIsConfigured()) {
            return;
        }
Severity: Minor
Found in app/Automatic/RecordFlowUpdater.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

Missing class import via use statement (line '302', column '8').
Open

        (new \App\BatchMethod(['method' => static::class . '::update', 'params' => [$this->sourceModuleName, $recordId]]))->save();
Severity: Minor
Found in app/Automatic/RecordFlowUpdater.php by phpmd

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

                (new \App\Db\Query())
Severity: Minor
Found in app/Automatic/RecordFlowUpdater.php by phpmd

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

            (new \App\BatchMethod([
Severity: Minor
Found in app/Automatic/RecordFlowUpdater.php by phpmd

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

                (new \App\Db\Query())
Severity: Minor
Found in app/Automatic/RecordFlowUpdater.php by phpmd

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

            $config = (new \App\Db\Query())
Severity: Minor
Found in app/Automatic/RecordFlowUpdater.php by phpmd

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

        } elseif (\App\Cache::staticHas('RecordFlowUpdater.getChildrenValues', $recordId)) {
Severity: Minor
Found in app/Automatic/RecordFlowUpdater.php by phpmd

StaticAccess

Since: 1.4.0

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

Example

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

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

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

        if (!\App\Record::isExists($recordId, $this->targetModuleName)) {
Severity: Minor
Found in app/Automatic/RecordFlowUpdater.php by phpmd

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

            \App\Log::error("The record does not exist recordId: {$recordId} module: {$this->targetModuleName}.");
Severity: Minor
Found in app/Automatic/RecordFlowUpdater.php by phpmd

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\Module' in method 'addToQueueSubordinateModule'.
Open

                'params' => [\App\Module::getModuleName($config['source_module']), $recordId],
Severity: Minor
Found in app/Automatic/RecordFlowUpdater.php by phpmd

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

    private function addToQueueWhenParentHasBeenModified(\Vtiger_Record_Model $recordModel)
    {
        if (!empty($this->targetColumnParentId) && false !== ($previousValue = $recordModel->getPreviousValue($this->targetColumnParentId))) {
            if (!empty($previousValue)) {
                $this->addToQueueSubordinateModule($previousValue);
Severity: Minor
Found in app/Automatic/RecordFlowUpdater.php by phpmd

IfStatementAssignment

Since: 2.7.0

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

Example

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

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

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

        if (\App\Cache::has('RecordFlowUpdater.getConfig', $cacheKey)) {
Severity: Minor
Found in app/Automatic/RecordFlowUpdater.php by phpmd

StaticAccess

Since: 1.4.0

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

Example

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

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

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

            $items = \App\Cache::staticGet('RecordFlowUpdater.getChildrenValues', $recordId);
Severity: Minor
Found in app/Automatic/RecordFlowUpdater.php by phpmd

StaticAccess

Since: 1.4.0

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

Example

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

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

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

            \App\Cache::staticSave('RecordFlowUpdater.getChildrenValues', $recordId, $items);
Severity: Minor
Found in app/Automatic/RecordFlowUpdater.php by phpmd

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\Module' in method 'getConfig'.
Open

                ->andWhere([$column => \App\Module::getModuleId($this->sourceModuleName)])
Severity: Minor
Found in app/Automatic/RecordFlowUpdater.php by phpmd

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

            $this->rules = \App\Json::decode($config['rules']);
Severity: Minor
Found in app/Automatic/RecordFlowUpdater.php by phpmd

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

        $recordModel = \Vtiger_Record_Model::getInstanceById($recordId, $this->targetModuleName);
Severity: Minor
Found in app/Automatic/RecordFlowUpdater.php by phpmd

StaticAccess

Since: 1.4.0

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

Example

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

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

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

            $config = \App\Cache::get('RecordFlowUpdater.getConfig', $cacheKey);
Severity: Minor
Found in app/Automatic/RecordFlowUpdater.php by phpmd

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\Picklist' in method 'getStatusFromPicklist'.
Open

        foreach (\App\Fields\Picklist::getValues($this->sourceField) as $item) {
Severity: Minor
Found in app/Automatic/RecordFlowUpdater.php by phpmd

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

        } else {
            $config = (new \App\Db\Query())
                ->from('s_#__auto_record_flow_updater')
                ->where(['status' => 1])
                ->andWhere([$column => \App\Module::getModuleId($this->sourceModuleName)])
Severity: Minor
Found in app/Automatic/RecordFlowUpdater.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

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

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

            \App\Cache::save('RecordFlowUpdater.getConfig', $column, $cacheKey);
Severity: Minor
Found in app/Automatic/RecordFlowUpdater.php by phpmd

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

            \App\Log::warning(
                "There is no rule defined for this case recordId: {$recordId} module: {$this->sourceModuleName}. Statuses:" .
                implode(',', array_map(function ($item) {
                    return $item['status'];
                }, $itmes))
Severity: Minor
Found in app/Automatic/RecordFlowUpdater.php by phpmd

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

            $sourceModuleModel = \Vtiger_Module_Model::getInstance($this->sourceModuleName);
Severity: Minor
Found in app/Automatic/RecordFlowUpdater.php by phpmd

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

            $targetModuleModel = \Vtiger_Module_Model::getInstance($config['target_module']);
Severity: Minor
Found in app/Automatic/RecordFlowUpdater.php by phpmd

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

        } else {
            $columnId = "{$this->targetTable}.{$this->targetTableId}";
            $items = $this->getStatusFromPicklist(
                (new \App\Db\Query())
                    ->select(['id' => $columnId, 'status' => "{$this->targetTable}.{$this->targetField}"])
Severity: Minor
Found in app/Automatic/RecordFlowUpdater.php by phpmd

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\Module' in method '__construct'.
Open

            $this->targetModuleName = \App\Module::getModuleName($config['target_module']);
Severity: Minor
Found in app/Automatic/RecordFlowUpdater.php by phpmd

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

        if (\App\Cache::has('RecordFlowUpdater.getConfig', $cacheKey)) {
Severity: Critical
Found in app/Automatic/RecordFlowUpdater.php by sonar-php

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

        } elseif (\App\Cache::staticHas('RecordFlowUpdater.getChildrenValues', $recordId)) {
Severity: Critical
Found in app/Automatic/RecordFlowUpdater.php by sonar-php

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

                ->where(['status' => 1])
Severity: Critical
Found in app/Automatic/RecordFlowUpdater.php by sonar-php

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

            $targetModuleModel = \Vtiger_Module_Model::getInstance($config['target_module']);
Severity: Critical
Found in app/Automatic/RecordFlowUpdater.php by sonar-php

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 error from undeclared class \App\Log
Open

            \App\Log::error("The record does not exist recordId: {$recordId} module: {$this->targetModuleName}.");
Severity: Critical
Found in app/Automatic/RecordFlowUpdater.php by phan

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

                (new \App\Db\Query())
Severity: Critical
Found in app/Automatic/RecordFlowUpdater.php by phan

Assigning false to property but \App\Automatic\RecordFlowUpdater->sourceTable is string
Open

            $this->sourceTable = $sourceModuleModel->basetable;
Severity: Minor
Found in app/Automatic/RecordFlowUpdater.php by phan

Assigning false to property but \App\Automatic\RecordFlowUpdater->targetTableId is string
Open

            $this->targetTableId = $targetModuleModel->basetableid;
Severity: Minor
Found in app/Automatic/RecordFlowUpdater.php by phan

Argument 2 (key) is int but \App\Cache::staticSave() takes string defined at /code/app/Cache.php:156
Open

            \App\Cache::staticSave('RecordFlowUpdater.getChildrenValues', $recordId, $items);
Severity: Minor
Found in app/Automatic/RecordFlowUpdater.php by phan

Assigning false to property but \App\Automatic\RecordFlowUpdater->sourceTableId is string
Open

            $this->sourceTableId = $sourceModuleModel->basetableid;
Severity: Minor
Found in app/Automatic/RecordFlowUpdater.php by phan

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

            $config = (new \App\Db\Query())
Severity: Critical
Found in app/Automatic/RecordFlowUpdater.php by phan

Expected @param annotation for sourceModuleName to be before the @param annotation for recordId
Open

     * @param int    $recordId
Severity: Info
Found in app/Automatic/RecordFlowUpdater.php by phan

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

            \App\Log::warning(
Severity: Critical
Found in app/Automatic/RecordFlowUpdater.php by phan

Assigning false to property but \App\Automatic\RecordFlowUpdater->targetTable is string
Open

            $this->targetTable = $targetModuleModel->basetable;
Severity: Minor
Found in app/Automatic/RecordFlowUpdater.php by phan

Saw an @param annotation for value, but it was not found in the param list of function getConfig(string $column = 'source_module') : array|false
Open

     * @param mixed  $value
Severity: Info
Found in app/Automatic/RecordFlowUpdater.php by phan

Argument 2 (key) is int but \App\Cache::staticHas() takes string defined at /code/app/Cache.php:141
Open

        } elseif (\App\Cache::staticHas('RecordFlowUpdater.getChildrenValues', $recordId)) {
Severity: Minor
Found in app/Automatic/RecordFlowUpdater.php by phan

Argument 2 (key) is int but \App\Cache::staticGet() takes string defined at /code/app/Cache.php:128
Open

            $items = \App\Cache::staticGet('RecordFlowUpdater.getChildrenValues', $recordId);
Severity: Minor
Found in app/Automatic/RecordFlowUpdater.php by phan

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

                (new \App\Db\Query())
Severity: Critical
Found in app/Automatic/RecordFlowUpdater.php by phan

Avoid excessively long variable names like $currentColumnParentId. Keep variable name length under 20.
Open

    protected $currentColumnParentId;
Severity: Minor
Found in app/Automatic/RecordFlowUpdater.php by phpmd

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

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

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

     */

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

     * @var array

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

    public static function update(string $sourceModuleName, 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

     *

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

    protected $sourceField;

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

     * @var string

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

     */

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

    /**

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

     * @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

     *

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

     */

Line exceeds 120 characters; contains 142 characters
Open

        if (!empty($this->targetColumnParentId) && false !== ($previousValue = $recordModel->getPreviousValue($this->targetColumnParentId))) {

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

            }

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

    private $sourceModuleName;

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

     *

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

    protected $targetTable;

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

    protected $targetColumnParentId;

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

    /**

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

     * The default value is returned if the rules do not specify this case.

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

     * Definition of rules for automatic status change.

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

     */

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

    private $isConfigured = 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

     * Construct.

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

            $this->targetTableId = $targetModuleModel->basetableid;

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

     * Check is configured.

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

     * Update field value.

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

            return;

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

     * Method called in Handler during the event "entityChangeState".

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

     * Add to the queue when the source field has been modified.

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

    private function addToQueueWhenSourceFieldHasBeenModified(\Vtiger_Record_Model $recordModel)

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->addToQueue($recordModel->get($this->targetTableId));

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

     * Add to the queue when the parent has been modified.

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

     * @var string

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

    protected $targetTableId;

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

     * @var string

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

     *

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

     *

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

     * Is configured.

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

            $sourceModuleModel = \Vtiger_Module_Model::getInstance($this->sourceModuleName);

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

     * The name of the table in the database for the superior/target element.

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

            }

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

    protected $sourceTableId;

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

    }

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

    /**

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

    /**

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

    /**

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

     *

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

     */

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

    {

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

     *

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

     * @return void

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->addToQueueWhenSourceFieldHasBeenModified($recordModel);

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

     * @param \Vtiger_Record_Model $recordModel

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->addToQueueSubordinateModule($previousValue);

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 \Vtiger_Record_Model $recordModel

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 to queue subordinate module.

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

    /**

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

     * @var string

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

     * @var string

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

     * @var string

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

     * The name of the table in the database for the current element.

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

    /**

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

    protected $sourceTable;

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->sourceField = $config['source_field'];

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

            $this->isConfigured = true;

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

        }

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

        if (!$this->checkIsConfigured()) {

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(\Vtiger_Record_Model $recordModel)

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

     * The name of the "primary key" column for the superior/target element.

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

    /**

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

     * The name of the "value" column/field for the superior/target element.

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

     * @var string

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

     */

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

     */

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

    /**

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

     */

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

        $this->sourceModuleName = $sourceModuleName;

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

    }

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

        $returnedValue = $this->executeRules($recordId);

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

        $recordModel = \Vtiger_Record_Model::getInstanceById($recordId, $this->targetModuleName);

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 void

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

     * @param \Vtiger_Record_Model $recordModel

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

     *

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

     *

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

     */

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

    /**

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

     * Name of the module for current elemnt.

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

     *

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

     * The name of the "primary key" column for the current element.

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

     * @var 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

            $targetModuleModel = \Vtiger_Module_Model::getInstance($config['target_module']);

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

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

        return $this->isConfigured;

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

            \App\Log::error("The record does not exist recordId: {$recordId} module: {$this->targetModuleName}.");

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

                $this->updateFieldValue($recordModel->get($this->targetColumnParentId));

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 entityAfterSave(\Vtiger_Record_Model $recordModel)

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

        if ($this->checkIsConfigured() && !empty($this->targetTableId)) {

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 void

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

    private function addToQueueWhenParentHasBeenModified(\Vtiger_Record_Model $recordModel)

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

    /**

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

    protected $targetModuleName;

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

    protected $targetField;

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

     * @var string

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

     * The name of the "parent ID" column for the current element.

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

     * @param string $sourceModuleName

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

            $this->targetTable = $targetModuleModel->basetable;

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

            $this->defaultValue = $config['default_value'];

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

     *

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

            $recordModel->set($this->targetField, $returnedValue);

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

     */

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

     * @var string

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

    protected $currentModuleName;

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

    private $defaultValue = 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

        if (!\App\Record::isExists($recordId, $this->targetModuleName)) {

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

     * @param \Vtiger_Record_Model $recordModel

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

        } elseif (!empty($this->targetTableId)) {

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 void

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

     */

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

    /**

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

     */

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

     *

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

     * @return void

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

    {

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

     *

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

    public function __construct(string $sourceModuleName)

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

        if (false !== $config) {

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

     * @return void

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

        if (!$this->checkIsConfigured()) {

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

        if ($recordModel->get($this->targetField) !== $returnedValue) {

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

     * Method called in Handler during the event "entityAfterSave".

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

    }

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

     *

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

     *

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

     */

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

            }

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

                $this->addToQueueSubordinateModule($recordModel->get($this->targetColumnParentId));

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

     * @var string

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

     *

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

     * The name of the "primary key" column for the current element.

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

     *

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

     */

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

    /**

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

        $this->isConfigured = 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

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

     * Method called in Handler during the event "entityAfterDelete".

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

        }

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

        if (!empty($this->targetTableId) && $recordModel->getPreviousValue($this->sourceField)) {

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

     * Name of the module for superior/target elemnt.

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

     *

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

     * The name of the "status" column for the current element.

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

     *

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

     * Update the value of the field.

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

            $this->targetField = $config['target_field'];

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

            return;

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

        }

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

     * @return void

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

    {

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

     * Source/sub-module module name.

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

     * @var string

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

    protected $currentColumnParentId;

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

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

    private $rules = [];

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

     */

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

     * @var bool

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

            $this->rules = \App\Json::decode($config['rules']);

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

            $this->addToQueueWhenParentHasBeenModified($recordModel);

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->targetColumnParentId = $config['relation_field'];

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->addToQueue($recordModel->get($this->targetTableId));

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

            $recordModel->save();

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

    }

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

            if (!empty($this->targetColumnParentId) && !$recordModel->isEmpty($this->targetColumnParentId)) {

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

            $this->addToQueue($recordModel->get($this->targetTableId));

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

                "There is no rule defined for this case recordId: {$recordId} module: {$this->sourceModuleName}. Statuses:" .

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

    public function entityAfterDelete(\Vtiger_Record_Model $recordModel)

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

        } elseif (\App\Cache::staticHas('RecordFlowUpdater.getChildrenValues', $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

                    ->all()

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 $items;

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

            if (!empty($previousValue)) {

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

    private function getStatusFromPicklist(array $items): array

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

    /**

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

    }

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

    private function getConfig(string $column = 'source_module')

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

    }

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

     * Get values from the source.

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

     *

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

        return $items;

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

            $this->targetModuleName = \App\Module::getModuleName($config['target_module']);

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 \Vtiger_Record_Model $recordModel

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

     * @return void

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

        if ($this->checkIsConfigured() && !empty($this->targetTableId)) {

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

        }

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

                'method' => static::class . '::update',

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 mixed  $value

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

            $config = \App\Cache::get('RecordFlowUpdater.getConfig', $cacheKey);

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

     * @return bool|string

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

        $items = [];

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

        if (empty($this->targetColumnParentId)) {

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

                    ->innerJoin('vtiger_crmentity', "{$columnId} = vtiger_crmentity.crmid")

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

                    ->andWhere(["{$this->targetTable}.{$this->targetColumnParentId}" => $recordId])

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

        return $this->getStatusFromPicklist(

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

                    ->andWhere(["{$this->sourceTable}.{$this->targetTableId}" => $recordId])

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

     * @return array

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

            $picklist[$item['picklistValue']] = $item;

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

        (new static($sourceModuleName))->updateFieldValue($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

        $config = $this->getConfig();

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

            $this->sourceTable = $sourceModuleModel->basetable;

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

            $this->sourceTableId = $sourceModuleModel->basetableid;

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

            return;

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

            $this->addToQueue($recordModel->get($this->targetTableId));

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

        }

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

        if (!empty($this->targetColumnParentId) && false !== ($previousValue = $recordModel->getPreviousValue($this->targetColumnParentId))) {

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

            if (!$recordModel->isEmpty($this->targetColumnParentId)) {

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

    private function addToQueueSubordinateModule(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

        $config = false;

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

                ->where(['status' => 1])

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

        return $config;

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

        if (false === $returnedValue) {

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

            (new \App\BatchMethod([

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

            ]))->save();

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

     * @param string $column

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

            $items = \App\Cache::staticGet('RecordFlowUpdater.getChildrenValues', $recordId);

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

                (new \App\Db\Query())

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

        }

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

    /**

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

                    ->innerJoin('vtiger_crmentity', "{$columnId} = vtiger_crmentity.crmid")

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

                'params' => [\App\Module::getModuleName($config['source_module']), $recordId],

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

     * @return void

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

     * @return array|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

        return $returnedValue;

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

                    ->from($this->targetTable)

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

    private function getValuesFromSource(int $recordId): array

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

            $item['automation'] = $picklist[$item['status']]['automation'];

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(

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

                implode(',', array_map(function ($item) {

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

     * @param array $items

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 to queue.

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

    private function addToQueue(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

        (new \App\BatchMethod(['method' => static::class . '::update', 'params' => [$this->sourceModuleName, $recordId]]))->save();

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

                    ->select(['id' => $columnId, 'status' => "{$this->targetTable}.{$this->targetField}"])

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

        $columnId = "{$this->sourceTable}.{$this->sourceTableId}";

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

                    ->from($this->sourceTable)

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

     * Get status from picklist.

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

        if (\App\Cache::has('RecordFlowUpdater.getConfig', $cacheKey)) {

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

     *

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

    /**

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

     * @return array

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

    private function getChildrenValues(int $recordId): array

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

            \App\Cache::staticSave('RecordFlowUpdater.getChildrenValues', $recordId, $items);

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

                ->one();

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

        $itmes = array_merge($this->getValuesFromSource($recordId), $this->getChildrenValues($recordId));

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

                }, $itmes))

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

     * Get the values of children.

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

            $items = [];

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

            $columnId = "{$this->targetTable}.{$this->targetTableId}";

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

     *

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

                    ->where(['vtiger_crmentity.deleted' => [0, 2]])

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

    }

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

                ->from('s_#__auto_record_flow_updater')

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

     * Execute rules and return the processed value.

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

     */

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

    {

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

                    return $item['status'];

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

        } else {

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

     * @return array

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

     */

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

        foreach ($items as &$item) {

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

        $config = $this->getConfig('target_module');

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

                ->andWhere([$column => \App\Module::getModuleId($this->sourceModuleName)])

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

    {

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

     */

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

        }

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

    {

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

    }

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

        $picklist = [];

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

                    ->all()

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

            $config = (new \App\Db\Query())

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

     *

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

    private function executeRules(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

     *

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

        if (false !== $config) {

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

     * @param int $recordId

Line exceeds 120 characters; contains 131 characters
Open

        (new \App\BatchMethod(['method' => static::class . '::update', 'params' => [$this->sourceModuleName, $recordId]]))->save();

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

    /**

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

        $cacheKey = "{$this->sourceModuleName}.{$column}";

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

        $returnedValue = (new RulesPicklist($this->rules, $this->defaultValue))->getValue($itmes);

Line exceeds 120 characters; contains 125 characters
Open

                "There is no rule defined for this case recordId: {$recordId} module: {$this->sourceModuleName}. Statuses:" .

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

            $items = $this->getStatusFromPicklist(

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

                    ->where(['vtiger_crmentity.deleted' => [0, 2]])

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

            );

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

                (new \App\Db\Query())

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

    {

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

        foreach (\App\Fields\Picklist::getValues($this->sourceField) as $item) {

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

     * Get config.

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

            \App\Cache::save('RecordFlowUpdater.getConfig', $column, $cacheKey);

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

                    ->select(['id' => $columnId, 'status' => "{$this->sourceTable}." . $this->sourceField])

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

        }

Multi-line function call not indented correctly; expected 12 spaces but found 16
Open

                (new \App\Db\Query())

Multi-line function call not indented correctly; expected 8 spaces but found 12
Open

            );

There are no issues that match your filters.

Category
Status