YetiForceCompany/YetiForceCRM

View on GitHub
app/RecordTransfer.php

Summary

Maintainability
C
1 day
Test Coverage
F
0%

Function relations has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
Open

    public static function relations(int $sourceId, array $records)
    {
        $sourceRecord = \Vtiger_Record_Model::getInstanceById($sourceId);
        foreach ($records as $recordId) {
            $recordModel = \Vtiger_Record_Model::getInstanceById($recordId);
Severity: Minor
Found in app/RecordTransfer.php - About 7 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 relations has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function relations(int $sourceId, array $records)
    {
        $sourceRecord = \Vtiger_Record_Model::getInstanceById($sourceId);
        foreach ($records as $recordId) {
            $recordModel = \Vtiger_Record_Model::getInstanceById($recordId);
Severity: Minor
Found in app/RecordTransfer.php - About 1 hr to fix

    Function recordData has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function recordData(\Vtiger_Record_Model $recordModel, array $migrate)
        {
            foreach ($migrate as $recordId => $fields) {
                if (!Record::isExists($recordId) || (($sourceRecord = \Vtiger_Record_Model::getInstanceById($recordId)) && (!$sourceRecord->isViewable()))) {
                    throw new Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);
    Severity: Minor
    Found in app/RecordTransfer.php - About 1 hr to fix

    Cognitive Complexity

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

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

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

    Further reading

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

        public static function recordData(\Vtiger_Record_Model $recordModel, array $migrate)
        {
            foreach ($migrate as $recordId => $fields) {
                if (!Record::isExists($recordId) || (($sourceRecord = \Vtiger_Record_Model::getInstanceById($recordId)) && (!$sourceRecord->isViewable()))) {
                    throw new Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);
    Severity: Minor
    Found in app/RecordTransfer.php by phpmd

    CyclomaticComplexity

    Since: 0.1

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

    Example

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

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

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

        public static function relations(int $sourceId, array $records)
        {
            $sourceRecord = \Vtiger_Record_Model::getInstanceById($sourceId);
            foreach ($records as $recordId) {
                $recordModel = \Vtiger_Record_Model::getInstanceById($recordId);
    Severity: Minor
    Found in app/RecordTransfer.php by phpmd

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

        public static function relations(int $sourceId, array $records)
    Severity: Critical
    Found in app/RecordTransfer.php by sonar-php

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

    See

    Missing class import via use statement (line '31', column '14').
    Open

                throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);
    Severity: Minor
    Found in app/RecordTransfer.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 assigning values to variables in if clauses and the like (line '58', column '42').
    Open

        public static function recordData(\Vtiger_Record_Model $recordModel, array $migrate)
        {
            foreach ($migrate as $recordId => $fields) {
                if (!Record::isExists($recordId) || (($sourceRecord = \Vtiger_Record_Model::getInstanceById($recordId)) && (!$sourceRecord->isViewable()))) {
                    throw new Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);
    Severity: Minor
    Found in app/RecordTransfer.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 '\Vtiger_Record_Model' in method 'relations'.
    Open

                $recordModel = \Vtiger_Record_Model::getInstanceById($recordId);
    Severity: Minor
    Found in app/RecordTransfer.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 recordData uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

                    } else {
                        throw new Exceptions\FieldException('ERR_FIELD_NOT_FOUND');
                    }
    Severity: Minor
    Found in app/RecordTransfer.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 '\Vtiger_Relation_Model' in method 'relations'.
    Open

                $relations = \Vtiger_Relation_Model::getAllRelations($recordModel->getModule(), false, true, false);
    Severity: Minor
    Found in app/RecordTransfer.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_Relation_Model' in method 'relations'.
    Open

                foreach (\Vtiger_Relation_Model::getAllRelations($sourceRecord->getModule(), false, true, false) as $sourceRelation) {
    Severity: Minor
    Found in app/RecordTransfer.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 '30', column '41').
    Open

        public static function transfer(int $recordId, array $migrate)
        {
            if (!Record::isExists($recordId) || (($record = \Vtiger_Record_Model::getInstanceById($recordId)) && !$record->isViewable())) {
                throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);
            }
    Severity: Minor
    Found in app/RecordTransfer.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\Record' in method 'transfer'.
    Open

            if (!Record::isExists($recordId) || (($record = \Vtiger_Record_Model::getInstanceById($recordId)) && !$record->isViewable())) {
    Severity: Minor
    Found in app/RecordTransfer.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 '\ModComments' in method 'relations'.
    Open

                    \ModComments::transferRecords($recordId, $sourceId);
    Severity: Minor
    Found in app/RecordTransfer.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 'recordData'.
    Open

                if (!Record::isExists($recordId) || (($sourceRecord = \Vtiger_Record_Model::getInstanceById($recordId)) && (!$sourceRecord->isViewable()))) {
    Severity: Minor
    Found in app/RecordTransfer.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 'recordData'.
    Open

                if (!Record::isExists($recordId) || (($sourceRecord = \Vtiger_Record_Model::getInstanceById($recordId)) && (!$sourceRecord->isViewable()))) {
    Severity: Minor
    Found in app/RecordTransfer.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 '\CRMEntity' in method 'relations'.
    Open

                    \CRMEntity::getInstance('ModComments');
    Severity: Minor
    Found in app/RecordTransfer.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 'transfer'.
    Open

            if (!Record::isExists($recordId) || (($record = \Vtiger_Record_Model::getInstanceById($recordId)) && !$record->isViewable())) {
    Severity: Minor
    Found in app/RecordTransfer.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 'relations'.
    Open

            $sourceRecord = \Vtiger_Record_Model::getInstanceById($sourceId);
    Severity: Minor
    Found in app/RecordTransfer.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 "ERR_NO_PERMISSIONS_FOR_THE_RECORD" 3 times.
    Open

                throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);
    Severity: Critical
    Found in app/RecordTransfer.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 undeclared method \App\Db\Query::select
    Open

                                $relTrees = $destRelation->getRelationTreeQuery()->select(['ttd.tree', 'crmid'])->createCommand()->queryAllByGroup();
    Severity: Critical
    Found in app/RecordTransfer.php by phan

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

            $transaction = Db::getInstance()->beginTransaction();
    Severity: Critical
    Found in app/RecordTransfer.php by phan

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

                            $queryGenerator = $sourceRelation->set('parentRecord', $sourceRecord)->getQuery()->setFields(['id']);
    Severity: Critical
    Found in app/RecordTransfer.php by phan

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

                            $queryGenerator = $destRelation->set('parentRecord', $recordModel)->getQuery()->setFields(['id']);
    Severity: Critical
    Found in app/RecordTransfer.php by phan

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

                                $sourceTrees = $sourceRelation->getRelationTreeQuery()->select(['ttd.tree', 'crmid'])->createCommand()->queryAllByGroup();
    Severity: Critical
    Found in app/RecordTransfer.php by phan

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

        {
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

            if (!Record::isExists($recordId) || (($record = \Vtiger_Record_Model::getInstanceById($recordId)) && !$record->isViewable())) {
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

    Line exceeds 120 characters; contains 135 characters
    Open

            if (!Record::isExists($recordId) || (($record = \Vtiger_Record_Model::getInstanceById($recordId)) && !$record->isViewable())) {
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

         * @throws Exceptions\FieldException
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

        {
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

            }
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

         * Update record data.
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                }
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                    $sourceFieldModel = $sourceRecord->getField($source);
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

         *
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

        }
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

        public static function recordData(\Vtiger_Record_Model $recordModel, array $migrate)
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

         * @param int   $recordId
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

         * @throws \App\Exceptions\NoPermittedToRecord
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

         * @throws \Throwable
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

            $transaction = Db::getInstance()->beginTransaction();
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

         * @throws Exceptions\NoPermittedToRecord
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

         * @param array $migrate
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

            try {
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                $transaction->rollBack();
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                    $targetFieldModel = $recordModel->getField($target);
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                $transaction->commit();
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

         * @param array                $migrate     [$recordId => [$source => $target, ...], ...]
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

         *
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                if (!Record::isExists($recordId) || (($sourceRecord = \Vtiger_Record_Model::getInstanceById($recordId)) && (!$sourceRecord->isViewable()))) {
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

    Line exceeds 120 characters; contains 153 characters
    Open

                if (!Record::isExists($recordId) || (($sourceRecord = \Vtiger_Record_Model::getInstanceById($recordId)) && (!$sourceRecord->isViewable()))) {
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

         * Transfer.
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

        public static function transfer(int $recordId, array $migrate)
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

            }
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

         */
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                    throw new Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                    }
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

        /**
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                if ($recordModel->getModule()->isCommentEnabled() && $sourceRecord->getModule()->isCommentEnabled()) {
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                                    $destRelation->deleteRelationTree($recordModel->getId(), $tree);
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                            }
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

        }
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

         *
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

         * @param \Vtiger_Record_Model $recordModel
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

            foreach ($migrate as $recordId => $fields) {
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

         *
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                }
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                    foreach ($relations as $destRelation) {
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                            $queryGenerator->permissions = false;
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

    Line exceeds 120 characters; contains 122 characters
    Open

                            $queryGenerator = $destRelation->set('parentRecord', $recordModel)->getQuery()->setFields(['id']);
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                            foreach (array_diff($relationIds, $sourceRelationIds) as $relId) {
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

            }
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

            } catch (\Throwable $ex) {
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                        throw new Exceptions\FieldException('ERR_FIELD_NOT_FOUND');
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                                $sourceRelation->transfer([$relId => $recordModel->getId()]);
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                                    $destRelation->transferDelete($relId);
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

         */
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                $record->save();
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                $record->ext['modificationType'] = \ModTracker_Record_Model::TRANSFER_EDIT;
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

        /**
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

         *
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                foreach ($fields as $source => $target) {
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                $recordModel = \Vtiger_Record_Model::getInstanceById($recordId);
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

    Line exceeds 120 characters; contains 134 characters
    Open

                    if ($sourceFieldModel && $sourceFieldModel->isViewEnabled() && $targetFieldModel && $targetFieldModel->isEditable()) {
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                if (!$recordModel->isViewable()) {
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                        $recordModel->set($target, $sourceFieldModel->getUITypeModel()->getDuplicateValue($sourceRecord));
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                    \CRMEntity::getInstance('ModComments');
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

    Line exceeds 120 characters; contains 125 characters
    Open

                            $queryGenerator = $sourceRelation->set('parentRecord', $sourceRecord)->getQuery()->setFields(['id']);
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

         */
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                            $queryGenerator->setStateCondition('All');
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                foreach (\Vtiger_Relation_Model::getAllRelations($sourceRecord->getModule(), false, true, false) as $sourceRelation) {
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                            foreach (array_intersect($relationIds, $sourceRelationIds) as $relId) {
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                            $destRelation = clone $destRelation;
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

    Line exceeds 120 characters; contains 150 characters
    Open

                                $sourceTrees = $sourceRelation->getRelationTreeQuery()->select(['ttd.tree', 'crmid'])->createCommand()->queryAllByGroup();
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                            $queryGenerator = $sourceRelation->set('parentRecord', $sourceRecord)->getQuery()->setFields(['id']);
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                            $queryGenerator->setStateCondition('All');
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                                $destRelation->transferDelete($relId);
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                }
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

        /**
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                static::relations($recordId, array_keys($migrate));
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                                $sourceTrees = $sourceRelation->getRelationTreeQuery()->select(['ttd.tree', 'crmid'])->createCommand()->queryAllByGroup();
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                                }
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                static::recordData($record, $migrate);
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                }
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

            }
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

         * Transfer relations.
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                                if (!$destRelation->isDirectRelation()) {
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                            }
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                    }
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

         * @param int   $sourceId
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

        public static function relations(int $sourceId, array $records)
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

    Line exceeds 120 characters; contains 130 characters
    Open

                foreach (\Vtiger_Relation_Model::getAllRelations($sourceRecord->getModule(), false, true, false) as $sourceRelation) {
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                                }
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                                foreach ($relTrees as $tree => $crmid) {
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                                    if (!isset($sourceTrees[$tree])) {
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                    } else {
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                            $queryGenerator->permissions = false;
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                                    }
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

        }
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

         * @param array $records
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                    \ModComments::transferRecords($recordId, $sourceId);
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

         * @throws Exceptions\NoPermittedToRecord
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

        {
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                    throw new Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                            $sourceRelationIds = $queryGenerator->createQuery()->column();
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                                        $sourceRelation->transferTree([$tree => $crmid]);
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                throw $ex;
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                    if ($sourceFieldModel && $sourceFieldModel->isViewEnabled() && $targetFieldModel && $targetFieldModel->isEditable()) {
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                        if ($sourceRelation->get('related_tabid') === $destRelation->get('related_tabid') && $sourceRelation->get('name') === $destRelation->get('name') && $sourceRelation->get('field_name') === $destRelation->get('field_name')) {
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

    Line exceeds 120 characters; contains 242 characters
    Open

                        if ($sourceRelation->get('related_tabid') === $destRelation->get('related_tabid') && $sourceRelation->get('name') === $destRelation->get('name') && $sourceRelation->get('field_name') === $destRelation->get('field_name')) {
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                            $relationIds = $queryGenerator->createQuery()->column();
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

    Line exceeds 120 characters; contains 145 characters
    Open

                                $relTrees = $destRelation->getRelationTreeQuery()->select(['ttd.tree', 'crmid'])->createCommand()->queryAllByGroup();
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

         *
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                            $sourceRelation = clone $sourceRelation;
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

            $sourceRecord = \Vtiger_Record_Model::getInstanceById($sourceId);
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

            foreach ($records as $recordId) {
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                $relations = \Vtiger_Relation_Model::getAllRelations($recordModel->getModule(), false, true, false);
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                            $queryGenerator = $destRelation->set('parentRecord', $recordModel)->getQuery()->setFields(['id']);
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                            }
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                        }
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                }
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                            if ($destRelation->isTreeRelation()) {
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

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

                                $relTrees = $destRelation->getRelationTreeQuery()->select(['ttd.tree', 'crmid'])->createCommand()->queryAllByGroup();
    Severity: Minor
    Found in app/RecordTransfer.php by phpcodesniffer

    There are no issues that match your filters.

    Category
    Status