YetiForceCompany/YetiForceCRM

View on GitHub
modules/Settings/MappedFields/models/Module.php

Summary

Maintainability
F
3 days
Test Coverage
F
0%

import accesses the super-global variable $_FILES.
Open

    public function import($qualifiedModuleName = false)
    {
        $id = '';
        $fileInstance = \App\Fields\File::loadFromRequest($_FILES['imported_xml']);
        if (!$fileInstance->validate() || 'xml' !== $fileInstance->getExtension(true)) {

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

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

    public function importDataFromXML($uploadedXml)
    {
        $combine = ['tabid' => 'source', 'reltabid' => 'target'];
        $instances = [];
        $i = 0;
Severity: Minor
Found in modules/Settings/MappedFields/models/Module.php - About 4 hrs to fix

Cognitive Complexity

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

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

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

Further reading

File Module.php has 326 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * Module Class for MappedFields Settings.
 *
Severity: Minor
Found in modules/Settings/MappedFields/models/Module.php - About 3 hrs to fix

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

    class Settings_MappedFields_Module_Model extends Settings_Vtiger_Module_Model
    {
        protected $record = false;
        public $baseTable = 'a_yf_mapped_config';
        public $mappingTable = 'a_yf_mapped_fields';

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

        public function save($saveMapping = false)
        {
            \App\Log::trace('Entering ' . __METHOD__ . '(' . $saveMapping . ') method ...');
            $db = \App\Db::getInstance();
            $fields = self::$allFields;
    Severity: Minor
    Found in modules/Settings/MappedFields/models/Module.php - About 2 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    Settings_MappedFields_Module_Model has 23 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Settings_MappedFields_Module_Model extends Settings_Vtiger_Module_Model
    {
        protected $record = false;
        public $baseTable = 'a_yf_mapped_config';
        public $mappingTable = 'a_yf_mapped_fields';
    Severity: Minor
    Found in modules/Settings/MappedFields/models/Module.php - About 2 hrs to fix

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

          public function importDataFromXML($uploadedXml)
          {
              $combine = ['tabid' => 'source', 'reltabid' => 'target'];
              $instances = [];
              $i = 0;
      Severity: Minor
      Found in modules/Settings/MappedFields/models/Module.php - About 2 hrs to fix

        Function transformAdvanceFilterToWorkFlowFilter has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            public function transformAdvanceFilterToWorkFlowFilter()
            {
                \App\Log::trace('Entering ' . __METHOD__ . '() method ...');
                $conditions = $this->get('conditions');
                $wfCondition = [];
        Severity: Minor
        Found in modules/Settings/MappedFields/models/Module.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

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

            public function getFields($source = false)
            {
                \App\Log::trace('Entering ' . __METHOD__ . '() method ...');
                $moduleModel = Vtiger_Module_Model::getInstance($this->getName());
                $fields = [];
        Severity: Minor
        Found in modules/Settings/MappedFields/models/Module.php - About 1 hr to fix

        Cognitive Complexity

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

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

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

        Further reading

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

            public function save($saveMapping = false)
            {
                \App\Log::trace('Entering ' . __METHOD__ . '(' . $saveMapping . ') method ...');
                $db = \App\Db::getInstance();
                $fields = self::$allFields;
        Severity: Minor
        Found in modules/Settings/MappedFields/models/Module.php - About 1 hr to fix

          Method getFields has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getFields($source = false)
              {
                  \App\Log::trace('Entering ' . __METHOD__ . '() method ...');
                  $moduleModel = Vtiger_Module_Model::getInstance($this->getName());
                  $fields = [];
          Severity: Minor
          Found in modules/Settings/MappedFields/models/Module.php - About 1 hr to fix

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

                public function getFields($source = false)
                {
                    \App\Log::trace('Entering ' . __METHOD__ . '() method ...');
                    $moduleModel = Vtiger_Module_Model::getInstance($this->getName());
                    $fields = [];

            CyclomaticComplexity

            Since: 0.1

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

            Example

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

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

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

                public function save($saveMapping = false)
                {
                    \App\Log::trace('Entering ' . __METHOD__ . '(' . $saveMapping . ') method ...');
                    $db = \App\Db::getInstance();
                    $fields = self::$allFields;

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

                public function importDataFromXML($uploadedXml)
                {
                    $combine = ['tabid' => 'source', 'reltabid' => 'target'];
                    $instances = [];
                    $i = 0;

            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

            Class "Settings_MappedFields_Module_Model" has 23 methods, which is greater than 20 authorized. Split it into smaller classes.
            Open

            class Settings_MappedFields_Module_Model extends Settings_Vtiger_Module_Model

            A class that grows too much tends to aggregate too many responsibilities and inevitably becomes harder to understand and therefore to maintain. Above a specific threshold, it is strongly advised to refactor the class into smaller ones which focus on well defined topics.

            Reduce the number of returns of this function 4, down to the maximum allowed 3.
            Open

                public static function getFieldsByStep($step = 1)

            Having too many return statements in a function increases the function's essential complexity because the flow of execution is broken each time a return statement is encountered. This makes it harder to read and understand the logic of the function.

            Noncompliant Code Example

            With the default threshold of 3:

            function myFunction(){ // Noncompliant as there are 4 return statements
              if (condition1) {
                return true;
              } else {
                if (condition2) {
                  return false;
                } else {
                  return true;
                }
              }
              return false;
            }
            

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

                public function save($saveMapping = false)

            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

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

                public function importDataFromXML($uploadedXml)

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

            See

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

            class Settings_MappedFields_Module_Model extends Settings_Vtiger_Module_Model
            {
                protected $record = false;
                public $baseTable = 'a_yf_mapped_config';
                public $mappingTable = 'a_yf_mapped_fields';

            CouplingBetweenObjects

            Since: 1.1.0

            A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

            Example

            class Foo {
                /**
                 * @var \foo\bar\X
                 */
                private $x = null;
            
                /**
                 * @var \foo\bar\Y
                 */
                private $y = null;
            
                /**
                 * @var \foo\bar\Z
                 */
                private $z = null;
            
                public function setFoo(\Foo $foo) {}
                public function setBar(\Bar $bar) {}
                public function setBaz(\Baz $baz) {}
            
                /**
                 * @return \SplObjectStorage
                 * @throws \OutOfRangeException
                 * @throws \InvalidArgumentException
                 * @throws \ErrorException
                 */
                public function process(\Iterator $it) {}
            
                // ...
            }

            Source https://phpmd.org/rules/design.html#couplingbetweenobjects

            The method import has a boolean flag argument $qualifiedModuleName, which is a certain sign of a Single Responsibility Principle violation.
            Open

                public function import($qualifiedModuleName = false)

            BooleanArgumentFlag

            Since: 1.4.0

            A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

            Example

            class Foo {
                public function bar($flag = true) {
                }
            }

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

            The method save has a boolean flag argument $saveMapping, which is a certain sign of a Single Responsibility Principle violation.
            Open

                public function save($saveMapping = false)

            BooleanArgumentFlag

            Since: 1.4.0

            A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

            Example

            class Foo {
                public function bar($flag = true) {
                }
            }

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

            The method getFields has a boolean flag argument $source, which is a certain sign of a Single Responsibility Principle violation.
            Open

                public function getFields($source = false)

            BooleanArgumentFlag

            Since: 1.4.0

            A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

            Example

            class Foo {
                public function bar($flag = true) {
                }
            }

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

            Missing class import via use statement (line '288', column '15').
            Open

                    return (new \App\Db\Query())->from($this->baseTable)

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

                    return \App\Module::getModuleId($this->getName());

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

            Avoid using static access to class '\App\Purifier' in method 'importDataFromXML'.
            Open

                                        $mapping[$i][$columnKey] = 'default' === $columnKey ? \App\Purifier::purify($columnValue) : $columnValue;

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

                    $moduleModel = Vtiger_Module_Model::getInstance($this->getName());

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

                    \App\Log::trace('Exiting ' . __METHOD__ . ' method ...');

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                            $instances[$combine[$fieldsKey]] = Vtiger_Module_Model::getInstance((string) $fieldsValue);

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

                    \App\Log::trace('Entering ' . __METHOD__ . '(' . $moduleName . ') method ...');

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

            Avoid using static access to class 'Vtiger_MappedFields_Model' in method 'getInstanceById'.
            Open

                    $instance->record = Vtiger_MappedFields_Model::getInstanceById($recordId, $moduleName);

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                    \App\Cache::delete('MappedFieldsTemplatesByModule', \App\Module::getModuleName($this->record->get('tabid')));

            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_Loader' in method 'getCleanInstance'.
            Open

                    $handlerClass = Vtiger_Loader::getComponentClassName('Model', 'MappedFields', $moduleName);

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                    \App\Log::trace('Entering ' . __METHOD__ . '() method ...');

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                    } else {
                        $db->createCommand()->update($this->baseTable, $params, [$this->baseIndex => $this->getRecordId()])->execute();
                    }

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

                    \App\Log::trace('Exiting ' . __METHOD__ . ' method ...');

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                    \App\Log::trace('Exiting ' . __METHOD__ . ' method ...');

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                        } else {
                            $value = (string) $fieldsValue;
                        }

            ElseExpression

            Since: 1.4.0

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

            Example

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

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

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

                    } else {
                        $id = null;
                        $message = 'LBL_NO_PERMISSION_TO_IMPORT';
                    }

            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\Log' in method 'getInstance'.
            Open

                    \App\Log::trace('Exiting ' . __METHOD__ . ' method ...');

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                    \App\Log::trace('Entering ' . __METHOD__ . '(' . $recordId . ',' . $moduleName . ') method ...');

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                    \App\Log::trace('Entering ' . __METHOD__ . '(' . $saveMapping . ') method ...');

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

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

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

            Avoid using static access to class 'Settings_MappedFields_Field_Model' in method 'importDataFromXML'.
            Open

                                    $fieldObject = Settings_MappedFields_Field_Model::getInstance($columnValue, $instances[$columnKey], $mapping[$i]['type']);

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

                    $moduleModel = Vtiger_Module_Model::getInstance($moduleName);

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                    \App\Log::trace('Exiting ' . __METHOD__ . ' method ...');

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                    \App\Cache::delete('MappedFieldsTemplatesByModule', \App\Module::getModuleName($this->record->get('tabid')));

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

                    } else {
                        [$id, $message] = $this->importDataFromXML($fileInstance->getPath());
                    }

            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 'Settings_MappedFields_Field_Model' in method 'getSpecialFields'.
            Open

                        $fieldInstane = Settings_MappedFields_Field_Model::fromArray($data);

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

                    \App\Log::trace('Exiting ' . __METHOD__ . ' method ...');

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                            $params[$field] = \App\Json::encode($value);

            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\File' in method 'import'.
            Open

                    $fileInstance = \App\Fields\File::loadFromRequest($_FILES['imported_xml']);

            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 'Settings_MappedFields_Field_Model' in method 'getFields'.
            Open

                            $fields[$blockName][$field->getColumnName()] = Settings_MappedFields_Field_Model::getInstanceFromInventoryFieldObject($field);

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

                    \App\Cache::delete('MappedFieldsTemplatesByModule', \App\Module::getModuleName($this->record->get('tabid')));

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

                    $moduleModels = Vtiger_Module_Model::getAll([0, 2]);

            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 'Settings_MappedFields_Field_Model' in method 'getFields'.
            Open

                            $fields[$blockName][$fieldModel->getId()] = Settings_MappedFields_Field_Model::getInstanceFromWebserviceFieldObject($fieldModel);

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

                            $value = (int) \App\Module::getModuleId((string) $fieldsValue);

            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_Inventory_Model' in method 'getFields'.
            Open

                        $inventoryModel = Vtiger_Inventory_Model::getInstance($this->getName());

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

                    \App\Log::trace('Entering ' . __METHOD__ . '() method ...');

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

            Avoid using static access to class '\App\Module' in method 'delete'.
            Open

                    \App\Cache::delete('MappedFieldsTemplatesByModule', \App\Module::getModuleName($this->record->get('tabid')));

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                        } else {
                            $params[$field] = $value;
                        }

            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\Log' in method 'transformAdvanceFilterToWorkFlowFilter'.
            Open

                    \App\Log::trace('Entering ' . __METHOD__ . '() method ...');

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                    \App\Log::trace('Exiting ' . __METHOD__ . ' method ...');

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                    return ['id' => $id, 'message' => \App\Language::translate($message, $qualifiedModuleName)];

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

                    \App\Log::trace('Entering ' . __METHOD__ . '(' . $moduleName . ') method ...');

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                    'status' => 'Integer',

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

                    'tabid' => 'LBL_MODULE',

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

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

            Noncompliant Code Example

            With the default threshold of 3:

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

            Compliant Solution

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

            Exceptions

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

            Define a constant instead of duplicating this literal "Exiting " 7 times.
            Open

                    \App\Log::trace('Exiting ' . __METHOD__ . ' method ...');

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

                    \App\Log::trace('Entering ' . __METHOD__ . '(' . $moduleName . ') method ...');

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

                                $wfCondition[] = ['fieldname' => '', 'operation' => '', 'value' => '', 'valuetype' => '',

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

                public static $step2Fields = ['source', 'target', 'default', 'type'];

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

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

            Noncompliant Code Example

            With the default threshold of 3:

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

            Compliant Solution

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

            Exceptions

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

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

                                $wfCondition[] = ['fieldname' => '', 'operation' => '', 'value' => '', 'valuetype' => '',

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

                    'conditions',

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

                    'status' => 'LBL_STATUS',

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

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

            Noncompliant Code Example

            With the default threshold of 3:

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

            Compliant Solution

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

            Exceptions

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

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

                                    'joincondition' => '', 'groupid' => '0', ];

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

                    \App\Log::trace('Entering ' . __METHOD__ . '(' . $moduleName . ') method ...');

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

                    \App\Log::trace('Exiting ' . __METHOD__ . ' method ...');

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

                public static $step2Fields = ['source', 'target', 'default', 'type'];

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

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

            Noncompliant Code Example

            With the default threshold of 3:

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

            Compliant Solution

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

            Exceptions

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

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

                    'permissions',

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

                public static $step2Fields = ['source', 'target', 'default', 'type'];

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

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

            Noncompliant Code Example

            With the default threshold of 3:

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

            Compliant Solution

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

            Exceptions

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

            Define a constant instead of duplicating this literal "reltabid" 8 times.
            Open

                    'reltabid' => 'LBL_REL_MODULE',

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

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

            Noncompliant Code Example

            With the default threshold of 3:

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

            Compliant Solution

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

            Exceptions

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

            Define a constant instead of duplicating this literal "() method ..." 3 times.
            Open

                    \App\Log::trace('Entering ' . __METHOD__ . '() method ...');

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

                    \App\Log::trace('Exiting ' . __METHOD__ . ' method ...');

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

                    \App\Log::trace('Exiting ' . __METHOD__ . ' method ...');

            Call to method set on non-class type false
            Open

                    $this->getRecord()->set('conditions', $wfCondition);

            Saw unextractable annotation for comment '* @return <array> Restricted ui types'</array>
            Open

                 * @return <array> Restricted ui types

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

                    \App\Log::trace('Entering ' . __METHOD__ . '(' . $moduleName . ') method ...');

            Assigning object to property but \Settings_MappedFields_Module_Model->record is false
            Open

                    $instance->record = $mf;

            Saw unextractable annotation for comment '* @return <settings_mappedfields_module_model>'</settings_mappedfields_module_model>
            Open

                 * @return <Settings_MappedFields_Module_Model>

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

                        $db->createCommand()->update($this->baseTable, $params, [$this->baseIndex => $this->getRecordId()])->execute();

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

                    \App\Log::trace('Entering ' . __METHOD__ . '() method ...');

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

                    \App\Log::trace('Entering ' . __METHOD__ . '() method ...');

            Call to method get on non-class type false
            Open

                        $value = $this->record->get($field);

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

                    \App\Log::trace('Exiting ' . __METHOD__ . ' method ...');

            Saw unextractable annotation for comment '* @return <settings_mappedfields_module_model>'</settings_mappedfields_module_model>
            Open

                 * @return <Settings_MappedFields_Module_Model>

            Call to method setMapping on non-class type false
            Open

                    $this->record->setMapping($mapp);

            Return type of getSpecialFields() is undeclared type \instance
            Open

                public static function getSpecialFields()

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

                    return \App\Db::getInstance()->createCommand()->delete($this->baseTable, [$this->baseIndex => $this->getRecordId()])

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

                    \App\Db::getInstance()->createCommand()->delete($this->mappingTable, [$this->mappingIndex => $mappedIds])

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

                                $db->createCommand()->insert($this->mappingTable, $params)->execute();

            Invalid offset 0 of array type array{}
            Open

                                    $fieldObject = Settings_MappedFields_Field_Model::getInstance($columnValue, $instances[$columnKey], $mapping[$i]['type']);

            Call to method getMapping on non-class type false
            Open

                    return $this->record->getMapping();

            Return type of setMapping() is undeclared type \instance
            Open

                public function setMapping($mapp = [])

            Call to method get on non-class type false
            Open

                    return $this->record->get($key);

            Returning type array<string>|array{}</string> but getSpecialFields() is declared to return \instance
            Open

                    return $models;

            Call to method set on non-class type false
            Open

                        $this->record->set('id', $db->getLastInsertID($this->baseTable . '_id_seq'));

            Call to method getId on non-class type false
            Open

                    return $this->record->getId();

            Call to method get on non-class type false
            Open

                    \App\Cache::delete('MappedFieldsTemplatesByModule', \App\Module::getModuleName($this->record->get('tabid')));

            Call to method get on non-class type false
            Open

                    $tabid = $this->getRecord()->get('tabid');

            Call to method get on non-class type false
            Open

                    $reltabid = $this->getRecord()->get('reltabid');

            Saw unextractable annotation for comment '* @return <number>'</number>
            Open

                 * @return <Number>

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

                    \App\Log::trace('Exiting ' . __METHOD__ . ' method ...');

            Suspicious type false of a variable or expression used to build a string. (Expected type to be able to cast to a string)
            Open

                    \App\Log::trace('Entering ' . __METHOD__ . '(' . $saveMapping . ') method ...');

            Call to method set on non-class type false
            Open

                        $this->getRecord()->set($fieldsKey, $value);

            Saw unextractable annotation for comment '* @return <array> list of mapping details'</array>
            Open

                 * @return <Array> list of mapping details

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

                    \App\Log::trace('Entering ' . __METHOD__ . '(' . $saveMapping . ') method ...');

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

                        $db->createCommand()->insert($this->baseTable, $params)->execute();

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

                    \App\Log::trace('Entering ' . __METHOD__ . '(' . $moduleName . ') method ...');

            Saw unextractable annotation for comment '* @return <array of vtlib>'</array>
            Open

                 * @return <Array of vtlib\Field>

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

                    \App\Log::trace('Exiting ' . __METHOD__ . ' method ...');

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

                    \App\Log::trace('Exiting ' . __METHOD__ . ' method ...');

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

                    \App\Log::trace('Entering ' . __METHOD__ . '(' . $recordId . ',' . $moduleName . ') method ...');

            Returning type \Settings_MappedFields_Module_Model but setMapping() is declared to return \instance
            Open

                    return $this;

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

                    return (new \App\Db\Query())->from($this->baseTable)

            Call to method get on non-class type false
            Open

                    \App\Cache::delete('MappedFieldsTemplatesByModule', \App\Module::getModuleName($this->record->get('tabid')));

            Saw unextractable annotation for comment '* @return <array> Restricted ui types'</array>
            Open

                 * @return <array> Restricted ui types

            Return type of get() is undeclared type \Value
            Open

                public function get($key)

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

                    \App\Log::trace('Exiting ' . __METHOD__ . ' method ...');

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

                    \App\Log::trace('Entering ' . __METHOD__ . '() method ...');

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

                    if (!empty($conditions)) {
                        foreach ($conditions as $index => $condition) {
                            $columns = $condition['columns'];
                            if ('1' == $index && empty($columns)) {
                                $wfCondition[] = ['fieldname' => '', 'operation' => '', 'value' => '', 'valuetype' => '',
            Severity: Major
            Found in modules/Settings/MappedFields/models/Module.php and 1 other location - About 5 hrs to fix
            modules/Vtiger/helpers/AdvancedFilter.php on lines 164..179

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 186.

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

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

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

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

            Refactorings

            Further Reading

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

                    $supportedModuleModels = [];

            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

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

            class Settings_MappedFields_Module_Model extends Settings_Vtiger_Module_Model

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

                        $id = null;

            ShortVariable

            Since: 0.2

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

            Example

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

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

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

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

            ShortVariable

            Since: 0.2

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

            Example

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

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

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

                    $i = 0;

            ShortVariable

            Since: 0.2

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

            Example

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

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

            The class Settings_MappedFields_Module_Model is not named in CamelCase.
            Open

            class Settings_MappedFields_Module_Model extends Settings_Vtiger_Module_Model
            {
                protected $record = false;
                public $baseTable = 'a_yf_mapped_config';
                public $mappingTable = 'a_yf_mapped_fields';

            CamelCaseClassName

            Since: 0.2

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

            Example

            class class_name {
            }

            Source

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

                    $mf = new $handlerClass();

            ShortVariable

            Since: 0.2

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

            Example

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

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

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

                    $id = '';

            ShortVariable

            Since: 0.2

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

            Example

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

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

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

                    'reltabid' => 'LBL_REL_MODULE',

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

                public static $step4Fields = ['permissions'];

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

                {

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

                    return \App\Module::getModuleId($this->getName());

            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 self::$step1Fields;

            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 static $allFields = [

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

                public static $step1Fields = ['status', 'tabid', 'reltabid'];

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

                 * @var array Validator for fields

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

                public function getImportViewUrl()

            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

                    'tabid',

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

                    'permissions',

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

                ];

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

                    'permissions' => ['Text'],

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

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

                 * Function to get the Restricted Ui Types.

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

                    'status',

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

                    'reltabid' => 'Integer',

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

                            return self::$step4Fields;

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

                        default:

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

                }

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

                }

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

                public $baseIndex = 'id';

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

                public static $validatorFields = [

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

                public static function getFieldsByStep($step = 1)

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

                        case 1:

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

                public $listFields = [

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

                public $parent = 'Settings';

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

                public function getCreateRecordUrl()

            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

                    'status' => 'LBL_STATUS',

            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 self::$step3Fields;

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

                        case 2:

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

                 * @return <array> Restricted ui types

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

                 * @return <array> Restricted ui types

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

                    'tabid' => 'LBL_MODULE',

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

                    'reltabid',

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

                public static $step2Fields = ['source', 'target', 'default', 'type'];

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

                /**

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

                        case 3:

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

                public static $step3Fields = ['conditions'];

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

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

                public static function getSupportedModules()

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

                {

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

                    $moduleModels = Vtiger_Module_Model::getAll([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

                    \App\Log::trace('Exiting ' . __METHOD__ . ' method ...');

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

                }

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

                 * Function to get instance of 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

                public static function getInstanceById($recordId, $moduleName = 'Vtiger')

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

                 * Function to set mapping details.

            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 instance

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

                        $blockName = 'LBL_ADVANCED_BLOCK';

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

                    return 'index.php?module=MappedFields&parent=Settings&view=Edit';

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

                        case 4:

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

                    'params',

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

                    return 'index.php?module=MappedFields&parent=Settings&view=Import';

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

                 * Function to get the Module/Tab id.

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

                 * @return <Number>

            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 [4, 51, 52, 57, 58, 69, 70];

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

                 *

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

                    $restrictedModules = ['OSSMailView', 'ModComments'];

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

                            $supportedModuleModels[$tabId] = $moduleModel;

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

                /**

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

                    $fields = self::getFieldsByStep();

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

                    $instance = new self();

            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> list of mapping details

            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 of vtlib\Field>

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

                        if ($fieldModel->isActiveField() && !(false === $source && !($fieldModel->isEditable() && !\in_array($fieldModel->getUIType(), $this->getRestrictedUitypes())))) {

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

                            $fields[$blockName][$fieldModel->getId()] = Settings_MappedFields_Field_Model::getInstanceFromWebserviceFieldObject($fieldModel);

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

                    }

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

                    $supportedModuleModels = [];

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

                public static function getCleanInstance($moduleName = 'Vtiger')

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

                 * @return <Settings_MappedFields_Module_Model>

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

                    return $moduleModel;

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

            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

                        foreach ($this->getSpecialFields() as $fieldName => $fieldInstance) {

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

                protected $record = false;

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

                    'conditions',

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

                    'tabid' => 'Integer',

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

                public $name = 'MappedFields';

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

                    switch ($step) {

            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 Value for the given key

            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::trace('Entering ' . __METHOD__ . '(' . $recordId . ',' . $moduleName . ') method ...');

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

                public function getMapping()

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

                    $models = [];

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

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

                public $mappingTable = 'a_yf_mapped_fields';

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

                public $mappingIndex = 'mappedid';

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

                {

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

                 */

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

                 * Function to get the Restricted Ui Types.

            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 <Settings_MappedFields_Module_Model>

            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::trace('Entering ' . __METHOD__ . '(' . $moduleName . ') method ...');

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

                }

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

                 * Function to get mapping details.

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

                        $fieldInstane = Settings_MappedFields_Field_Model::fromArray($data);

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

                            $fields['LBL_NOT_ASSIGNET_TO_BLOCK'][$fieldName] = $fieldInstance;

            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

                    'status' => 'Integer',

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

                    return $this->record;

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

                            return self::$step2Fields;

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

                    foreach ($moduleModels as $tabId => $moduleModel) {

            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

                        $data[$field] = '';

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

                    return $this->record->get($key);

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

                    if ($moduleModel) {

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

                {

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

                 * Function to set mapping details.

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

                 * Function returns fields of module.

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

                            $blockName = $fieldModel->getBlockName();

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

                public $baseTable = 'a_yf_mapped_config';

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

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

                 *

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

                public function getRestrictedUitypes()

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

                    $data = [];

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

                public function get($key)

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

                    $moduleModel = Vtiger_Module_Model::getInstance($moduleName);

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

                    \App\Log::trace('Exiting ' . __METHOD__ . ' method ...');

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

                 * @return instance

            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 ($inventoryModel->getFields() as $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

                 * Function to get instance.

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

                    foreach ($fields as $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

                public static function getInstance($moduleName = 'Settings:Vtiger')

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

                        $objectProperties = get_object_vars($moduleModel);

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

                            $moduleModel->{$properName} = $propertyValue;

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

                    return $this->record->getMapping();

            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->record->setMapping($mapp);

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

                public static function getSpecialFields()

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

                        }

            Line exceeds 120 characters; contains 142 characters
            Open

                            $fields[$blockName][$field->getColumnName()] = Settings_MappedFields_Field_Model::getInstanceFromInventoryFieldObject($field);

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

                    \App\Db::getInstance()->createCommand()->delete($this->mappingTable, [$this->mappingIndex => $mappedIds])

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

                    \App\Log::trace('Entering ' . __METHOD__ . '(' . $saveMapping . ') method ...');

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

                        $db->createCommand()->insert($this->baseTable, $params)->execute();

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

                    } else {

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

                    }

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

                    }

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

                        [$id, $message] = $this->importDataFromXML($fileInstance->getPath());

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

                        if (\array_key_exists($fieldsKey, $combine)) {

            Line exceeds 120 characters; contains 133 characters
            Open

                                        $mapping[$i][$columnKey] = 'default' === $columnKey ? \App\Purifier::purify($columnValue) : $columnValue;

            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

                    $handlerClass = Vtiger_Loader::getComponentClassName('Model', 'MappedFields', $moduleName);

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

                    $instance->record = $mf;

            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

                    $fields = ['id' => ['name' => 'id', 'id' => 'id', 'fieldDataType' => 'reference', 'label' => 'LBL_SELF_ID', 'typeofdata' => 'SELF']];

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

                    $moduleModel = Vtiger_Module_Model::getInstance($this->getName());

            Line exceeds 120 characters; contains 174 characters
            Open

                        if ($fieldModel->isActiveField() && !(false === $source && !($fieldModel->isEditable() && !\in_array($fieldModel->getUIType(), $this->getRestrictedUitypes())))) {

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

                            $fields[$blockName][$field->getColumnName()] = Settings_MappedFields_Field_Model::getInstanceFromInventoryFieldObject($field);

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

                    \App\Log::trace('Exiting ' . __METHOD__ . ' method ...');

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

                    return $fields;

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

                    \App\Cache::delete('MappedFieldsTemplatesByModule', \App\Module::getModuleName($this->record->get('tabid')));

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

                    $fields = self::$allFields;

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

                        } else {

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

                        }

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

                            }

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

                    if (!empty($conditions)) {

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

                    } else {

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

                {

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

                        if ($moduleModel->isEntityModule() && !\in_array($moduleModel->getName(), $restrictedModules)) {

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

                    return $instance;

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

                    \App\Log::trace('Entering ' . __METHOD__ . '(' . $moduleName . ') method ...');

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

                }

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

                 * @param mixed $mapp

            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 getFields($source = false)

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

                {

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

                {

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

                 * Function transforms Advance filter to workflow conditions.

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

                                $wfCondition[] = ['fieldname' => '', 'operation' => '', 'value' => '', 'valuetype' => '',

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

                                    $columnValue = (string) $columnValue;

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

                            continue;

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

                            $value = (string) $fieldsValue;

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

                 * Function to get the value for a given key.

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

                 * @param string $moduleName

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

                 *

            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 setMapping($mapp = [])

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

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

                    if (!\is_array($mappedIds)) {

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

                            $params[$field] = implode(',', $value);

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

                            $params[$this->mappingIndex] = $this->getRecordId();

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

                                $db->createCommand()->insert($this->mappingTable, $params)->execute();

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

                            $columns = $condition['columns'];

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

                            }

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

                                        'value' => $column['value'], 'valuetype' => $column['valuetype'], 'joincondition' => $column['column_condition'],

            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->getRecord()->set('conditions', $wfCondition);

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

                    $instances = [];

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

                    $xml = simplexml_load_file($uploadedXml);

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

                            $instances[$combine[$fieldsKey]] = Vtiger_Module_Model::getInstance((string) $fieldsValue);

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

                                    $columnKey = (string) $columnKey;

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

                                        $mapping[$i][$columnKey] = 'default' === $columnKey ? \App\Purifier::purify($columnValue) : $columnValue;

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

                                        continue;

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

                    return $this->record->getId();

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

                 *

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

                 *

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

                    $instance = new self();

            Line exceeds 120 characters; contains 141 characters
            Open

                    $fields = ['id' => ['name' => 'id', 'id' => 'id', 'fieldDataType' => 'reference', 'label' => 'LBL_SELF_ID', 'typeofdata' => 'SELF']];

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

                 * @param mixed $source

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

                    $fields = [];

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

                                $blockName = 'LBL_NOT_ASSIGNET_TO_BLOCK';

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

                }

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

                    $params = [];

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

                        $value = $this->record->get($field);

            Line exceeds 120 characters; contains 123 characters
            Open

                        $db->createCommand()->update($this->baseTable, $params, [$this->baseIndex => $this->getRecordId()])->execute();

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

                    if ($saveMapping) {

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

                    \App\Cache::delete('MappedFieldsTemplatesByModule', \App\Module::getModuleName($this->record->get('tabid')));

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

                            if ('1' == $index && empty($columns)) {

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

                            if (!empty($columns) && \is_array($columns)) {

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

                    return ['id' => $id, 'message' => \App\Language::translate($message, $qualifiedModuleName)];

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

                            foreach ($fieldsValue as $fieldValue) {

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

                                    if (!$fieldObject) {

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

                 *

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

                    $instance->record = Vtiger_MappedFields_Model::getInstanceById($recordId, $moduleName);

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

                /**

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

                    foreach ($fields as $fieldName => $data) {

            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::trace('Entering ' . __METHOD__ . '() method ...');

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

                    foreach ($moduleModel->getFields() as $fieldName => $fieldModel) {

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

                        $inventoryModel = Vtiger_Inventory_Model::getInstance($this->getName());

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

                                foreach ($columns as $column) {

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

                                        'groupjoin' => $condition['condition'] ?? '', 'groupid' => $column['groupid'], ];

            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 ($fieldValue as $columnKey => $columnValue) {

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

                    if (empty($tabid) || empty($reltabid)) {

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

                        $id = null;

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

                }

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

                    $mf = new $handlerClass();

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

                /**

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

                        $moduleModel = new self();

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

                {

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

                    }

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

                }

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

                    foreach ($fields as $field) {

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

                    \App\Log::trace('Exiting ' . __METHOD__ . ' method ...');

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

                            $value = (int) \App\Module::getModuleId((string) $fieldsValue);

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

                        $message = 'LBL_IMPORT_OK';

            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 deleteMapping($mappedIds)

            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::trace('Entering ' . __METHOD__ . '() method ...');

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

                        ->count();

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

                        $db->createCommand()->update($this->baseTable, $params, [$this->baseIndex => $this->getRecordId()])->execute();

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

                            $params = [];

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

                            }

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

                                break;

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

                            }

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

                        } else {

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

                public function importsAllowed()

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

                        $this->record->set('id', $db->getLastInsertID($this->baseTable . '_id_seq'));

            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($params['source']) && !empty($params['target'])) {

            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

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

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

                {

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

                    $id = '';

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

                        $message = 'LBL_UPLOAD_ERROR';

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

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

                 */

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

                    $mf->setData($data);

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

                    \App\Log::trace('Exiting ' . __METHOD__ . ' method ...');

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

                    return $instance;

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

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

                            $fields[$blockName][$fieldModel->getId()] = Settings_MappedFields_Field_Model::getInstanceFromWebserviceFieldObject($fieldModel);

            Line exceeds 120 characters; contains 124 characters
            Open

                    return \App\Db::getInstance()->createCommand()->delete($this->baseTable, [$this->baseIndex => $this->getRecordId()])

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

                }

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

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

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

                        if (\in_array($field, ['conditions', 'params'])) {

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

                            $params[$field] = $value;

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

                    return $this->getRecordId();

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

                    \App\Log::trace('Entering ' . __METHOD__ . '() method ...');

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

                    $wfCondition = [];

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

                            }

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

                        $message = 'LBL_NO_PERMISSION_TO_IMPORT';

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

                    \App\Log::trace('Exiting ' . __METHOD__ . ' method ...');

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

                                if (isset($mapp[$name])) {

            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

                    $i = 0;

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

                    $mapping = [];

            Line exceeds 120 characters; contains 146 characters
            Open

                                    $fieldObject = Settings_MappedFields_Field_Model::getInstance($columnValue, $instances[$columnKey], $mapping[$i]['type']);

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

                                    }

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

                        $this->save(true);

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

                        $id = $this->getRecordId();

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

                    return [$id, $message];

            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 save($saveMapping = 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 (!$this->getRecordId()) {

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

                        $this->deleteMapping($this->getRecordId());

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

                public function transformAdvanceFilterToWorkFlowFilter()

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

                        foreach ($conditions as $index => $condition) {

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

                                    'joincondition' => '', 'groupid' => '0', ];

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

                    foreach ($xml as $fieldsKey => $fieldsValue) {

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

                                    }

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

                                ++$i;

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

                        $this->getRecord()->set($fieldsKey, $value);

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

                        $stepFields = self::getFieldsByStep(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

                 */

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

                {

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

                                    $wfCondition[] = ['fieldname' => $column['columnname'], 'operation' => $column['comparator'],

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

                    \App\Log::trace('Exiting ' . __METHOD__ . ' method ...');

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

                    if (!$fileInstance->validate() || 'xml' !== $fileInstance->getExtension(true)) {

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

                    $combine = ['tabid' => 'source', 'reltabid' => 'target'];

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

                                        continue;

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

                        $mappedIds = [$mappedIds];

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

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

                    return (new \App\Db\Query())->from($this->baseTable)

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

                    }

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

                                    $params[$name] = $mapp[$name];

            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 importDataFromXML($uploadedXml)

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

                            if (empty($value)) {

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

                        } elseif ('fields' === $fieldsKey) {

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

                                    $mapping[$i][$columnKey] = $fieldObject->getId();

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

                        $message = 'LBL_MODULE_NOT_EXIST';

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

                    return \App\Db::getInstance()->createCommand()->delete($this->baseTable, [$this->baseIndex => $this->getRecordId()])

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

                }

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

                            $params[$field] = \App\Json::encode($value);

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

                        foreach ($this->getMapping() as $mapp) {

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

                            foreach ($stepFields as $name) {

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

                    $fileInstance = \App\Fields\File::loadFromRequest($_FILES['imported_xml']);

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

                }

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

                                    $fieldObject = Settings_MappedFields_Field_Model::getInstance($columnValue, $instances[$columnKey], $mapping[$i]['type']);

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

                    $tabid = $this->getRecord()->get('tabid');

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

                    return $supportedModuleModels;

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

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

                        foreach ($objectProperties as $properName => $propertyValue) {

            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

                        $models[$fieldName] = $fieldInstane;

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

                    if ($moduleModel->isInventory()) {

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

                        ->execute();

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

                        ->execute();

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

                        ->where(['tabid' => $this->get('tabid'), 'reltabid' => $this->get('reltabid')])

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

                        } elseif (\is_array($value)) {

            Line exceeds 120 characters; contains 141 characters
            Open

                                        'value' => $column['value'], 'valuetype' => $column['valuetype'], 'joincondition' => $column['column_condition'],

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

                public function import($qualifiedModuleName = false)

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

                                    if (\in_array($columnKey, ['default', 'type'])) {

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

                    $reltabid = $this->getRecord()->get('reltabid');

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

                        $id = null;

            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

                    } elseif (!$this->importsAllowed()) {

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

                        $this->setMapping($mapping);

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

            class Settings_MappedFields_Module_Model extends Settings_Vtiger_Module_Model

            There are no issues that match your filters.

            Category
            Status