YetiForceCompany/YetiForceCRM

View on GitHub
modules/Vtiger/models/MappedFields.php

Summary

Maintainability
A
3 hrs
Test Coverage
F
21%

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

class Vtiger_MappedFields_Model extends \App\Base
{
    public static $baseTable = 'a_yf_mapped_config';
    public static $mappingTable = 'a_yf_mapped_fields';
    public static $baseIndex = 'id';

Method checkUserPermissions has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function checkUserPermissions()
    {
        \App\Log::trace('Entering ' . __METHOD__ . '() method ...');
        $permissions = $this->get('permissions');
        if (empty($permissions)) {
Severity: Minor
Found in modules/Vtiger/models/MappedFields.php - About 1 hr to fix

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

        public function checkUserPermissions()
        {
            \App\Log::trace('Entering ' . __METHOD__ . '() method ...');
            $permissions = $this->get('permissions');
            if (empty($permissions)) {
    Severity: Minor
    Found in modules/Vtiger/models/MappedFields.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 getFieldFilterValueType has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getFieldFilterValueType($fieldname)
        {
            $conditions = $this->get('conditions');
            if (!empty($conditions) && \is_array($conditions)) {
                foreach ($conditions as $filter) {
    Severity: Minor
    Found in modules/Vtiger/models/MappedFields.php - About 35 mins to fix

    Cognitive Complexity

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

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

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

    Further reading

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

        public function getActiveTemplatesForRecord($recordId, $view, $moduleName = false)
        {
            \App\Log::trace('Entering ' . __METHOD__ . '(' . $recordId . ',' . $view . ',' . $moduleName . ') method ...');
            if (!\App\Record::isExists($recordId)) {
                \App\Log::trace('Exiting ' . __METHOD__ . ' method ...');
    Severity: Minor
    Found in modules/Vtiger/models/MappedFields.php - About 25 mins to fix

    Cognitive Complexity

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

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

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

    Further reading

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

        public function checkUserPermissions()
        {
            \App\Log::trace('Entering ' . __METHOD__ . '() method ...');
            $permissions = $this->get('permissions');
            if (empty($permissions)) {

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

    class Vtiger_MappedFields_Model extends \App\Base
    {
        public static $baseTable = 'a_yf_mapped_config';
        public static $mappingTable = 'a_yf_mapped_fields';
        public static $baseIndex = 'id';

    CouplingBetweenObjects

    Since: 1.1.0

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

    Example

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

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

    Missing class import via use statement (line '108', column '17').
    Open

                $rows = (new \App\Db\Query())->from(self::$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

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

        public function getActiveTemplatesForRecord($recordId, $view, $moduleName = 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 '199', column '23').
    Open

                $dataReader = (new App\Db\Query())->from(self::$mappingTable)->where([self::$mappingIndex => $this->getId()])

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

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

    Missing class import via use statement (line '261', column '28').
    Open

            $conditionStrategy = new VTJsonCondition();

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

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

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

            $row = (new App\Db\Query())->from(self::$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

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

            $row = (new \App\Db\Query())->from(self::$baseTable)->where(['tabid' => $tabId, 'reltabid' => $relTabId])->limit(1)->one();

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

            \App\Log::trace('Entering ' . __METHOD__ . '(' . $recordId . ',' . $view . ',' . $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\Privilege' in method 'getActiveTemplatesForRecord'.
    Open

                if (!$template->checkFiltersForRecord($recordId) || !$template->checkUserPermissions() || !\App\Privilege::isPermitted($template->getRelatedName(), 'EditView')) {

    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 'getActiveTemplatesForRecord'.
    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('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('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_Loader' in method 'checkFiltersForRecord'.
    Open

            Vtiger_Loader::includeOnce('~/modules/com_vtiger_workflow/VTJsonCondition.php');

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

                $rows = App\Cache::get('MappedFieldsTemplatesByModule', $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 'Settings_MappedFields_Field_Model' in method 'getMapping'.
    Open

                        'target' => Settings_MappedFields_Field_Model::getInstance($mappingDetails['target'], $this->getRelatedModule(), $mappingDetails['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 'Users_Record_Model' in method 'checkUserPermissions'.
    Open

            $currentUser = Users_Record_Model::getCurrentUserModel();

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

            if (!\App\Record::isExists($recordId)) {

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

            } else {
                $rows = (new \App\Db\Query())->from(self::$baseTable)
                    ->where(['tabid' => \App\Module::getModuleId($moduleName), 'status' => 1])
                    ->all();
                \App\Cache::save('MappedFieldsTemplatesByModule', $moduleName, $rows);

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

            return \App\Module::getModuleName($this->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 '\App\Module' in method 'getRelatedName'.
    Open

            return \App\Module::getModuleName($this->get('reltabid'));

    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 'checkUserPermissions'.
    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 'getTemplatesByModule'.
    Open

            if (App\Cache::has('MappedFieldsTemplatesByModule', $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 'Vtiger_Loader' in method 'getTemplatesByModule'.
    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 'Vtiger_Cache' in method 'getInstanceById'.
    Open

            Vtiger_Cache::set('MappedFieldsModel', $recordId, $mf);

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

            if (\App\Cache::staticHas(__METHOD__, $key)) {

    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 'checkUserPermissions'.
    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 'Vtiger_Loader' in method 'getInstanceByModules'.
    Open

            $handlerClass = Vtiger_Loader::getComponentClassName('Model', 'MappedFields', \App\Module::getModuleName($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 'getRelatedModule'.
    Open

            return Vtiger_Module_Model::getInstance($this->getRelatedName());

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

            \App\Log::trace('Entering ' . __METHOD__ . '(' . $moduleName . ',' . $view . ') 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 'getActiveTemplatesForModule'.
    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 'getInstanceByModules'.
    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 'get'.
    Open

                return \App\Json::decode(html_entity_decode(parent::get($key)));

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

                \App\Cache::save('MappedFieldsTemplatesByModule', $moduleName, $rows);

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

                        'source' => Settings_MappedFields_Field_Model::getInstance($mappingDetails['source'], $this->getModule(), $mappingDetails['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 'getModule'.
    Open

            return 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 'getInstanceByModules'.
    Open

            \App\Log::trace('Entering ' . __METHOD__ . '(' . $tabId . ',' . $relTabId . ') 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 'getMapping'.
    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_Record_Model' in method 'checkFiltersForRecord'.
    Open

            $recordModel = Vtiger_Record_Model::getInstanceById($recordId);

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

                return \App\Cache::staticGet(__METHOD__, $key);

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

            $handlerClass = Vtiger_Loader::getComponentClassName('Model', 'MappedFields', \App\Module::getModuleName($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 '\App\Record' in method 'getActiveTemplatesForRecord'.
    Open

                $moduleName = \App\Record::getType($recordId);

    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 'getMapping'.
    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 'checkUserPermissions'.
    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 'getInstanceByModules'.
    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_Cache' in method 'getInstanceById'.
    Open

            $mf = Vtiger_Cache::get('MappedFieldsModel', $recordId);

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

            \App\Cache::staticSave(__METHOD__, $key, $test);

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

                    ->where(['tabid' => \App\Module::getModuleId($moduleName), 'status' => 1])

    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 'getInstanceById'.
    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

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

            \App\Log::trace('Entering ' . __METHOD__ . '(' . $recordId . ',' . $view . ',' . $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 "tabid" 3 times.
    Open

                    ->where(['tabid' => \App\Module::getModuleId($moduleName), 'status' => 1])

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

            if (App\Cache::has('MappedFieldsTemplatesByModule', $moduleName)) {

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

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

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

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

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

            \App\Log::trace('Entering ' . __METHOD__ . '(' . $recordId . ',' . $view . ',' . $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 "conditions" 3 times.
    Open

            if (\in_array($key, ['conditions', 'params']) && !\is_array(parent::get($key))) {

    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 ..." 12 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.

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

         * @return <Number> - Record Id

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

                \App\Log::trace('Exiting ' . __METHOD__ . ' method ...');
    Severity: Critical
    Found in modules/Vtiger/models/MappedFields.php by phan

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

            \App\Log::trace('Entering ' . __METHOD__ . '() method ...');
    Severity: Critical
    Found in modules/Vtiger/models/MappedFields.php by phan

    Argument 2 (module) is \Vtiger_Module_Model|\vtlib\Module|\vtlib\ModuleBasic but \Settings_MappedFields_Field_Model::getInstance() takes false|string defined at /code/modules/Settings/MappedFields/models/Field.php:166
    Open

                        'target' => Settings_MappedFields_Field_Model::getInstance($mappingDetails['target'], $this->getRelatedModule(), $mappingDetails['type']),
    Severity: Minor
    Found in modules/Vtiger/models/MappedFields.php by phan

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

                \App\Log::trace('Exiting ' . __METHOD__ . ' method ...');
    Severity: Critical
    Found in modules/Vtiger/models/MappedFields.php by phan

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

            \App\Log::trace('Exiting ' . __METHOD__ . ' method ...');
    Severity: Critical
    Found in modules/Vtiger/models/MappedFields.php by phan

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

                $accessibleGroups = array_keys(\App\Fields\Owner::getInstance($this->get('module_name'), $currentUser)->getAccessibleGroupForModule());
    Severity: Critical
    Found in modules/Vtiger/models/MappedFields.php by phan

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

            \App\Log::trace('Entering ' . __METHOD__ . '(' . $moduleName . ') method ...');
    Severity: Critical
    Found in modules/Vtiger/models/MappedFields.php by phan

    Returning type string but checkFiltersForRecord() is declared to return bool
    Open

            return $test;
    Severity: Minor
    Found in modules/Vtiger/models/MappedFields.php by phan

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

            \App\Log::trace('Exiting ' . __METHOD__ . ' method ...');
    Severity: Critical
    Found in modules/Vtiger/models/MappedFields.php by phan

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

            $row = (new App\Db\Query())->from(self::$baseTable)
    Severity: Critical
    Found in modules/Vtiger/models/MappedFields.php by phan

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

            \App\Log::trace('Exiting ' . __METHOD__ . ' method ...');
    Severity: Critical
    Found in modules/Vtiger/models/MappedFields.php by phan

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

            \App\Log::trace('Entering ' . __METHOD__ . '(' . $moduleName . ',' . $view . ') method ...');
    Severity: Critical
    Found in modules/Vtiger/models/MappedFields.php by phan

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

                \App\Log::trace('Exiting ' . __METHOD__ . ' method ...');
    Severity: Critical
    Found in modules/Vtiger/models/MappedFields.php by phan

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

            \App\Log::trace('Entering ' . __METHOD__ . '() method ...');
    Severity: Critical
    Found in modules/Vtiger/models/MappedFields.php by phan

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

                \App\Log::trace('Exiting ' . __METHOD__ . ' method ...');
    Severity: Critical
    Found in modules/Vtiger/models/MappedFields.php by phan

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

            \App\Log::trace('Entering ' . __METHOD__ . '(' . $tabId . ',' . $relTabId . ') method ...');
    Severity: Critical
    Found in modules/Vtiger/models/MappedFields.php by phan

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

            \App\Log::trace('Exiting ' . __METHOD__ . ' method ...');
    Severity: Critical
    Found in modules/Vtiger/models/MappedFields.php by phan

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

            \App\Log::trace('Exiting ' . __METHOD__ . ' method ...');
    Severity: Critical
    Found in modules/Vtiger/models/MappedFields.php by phan

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

            \App\Log::trace('Exiting ' . __METHOD__ . ' method ...');
    Severity: Critical
    Found in modules/Vtiger/models/MappedFields.php by phan

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

                \App\Log::trace('Exiting ' . __METHOD__ . ' method ...');
    Severity: Critical
    Found in modules/Vtiger/models/MappedFields.php by phan

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

                $rows = (new \App\Db\Query())->from(self::$baseTable)
    Severity: Critical
    Found in modules/Vtiger/models/MappedFields.php by phan

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

            \App\Log::trace('Entering ' . __METHOD__ . '(' . $recordId . ',' . $moduleName . ') method ...');
    Severity: Critical
    Found in modules/Vtiger/models/MappedFields.php by phan

    Returning type false but getFieldFilterValueType() is declared to return string
    Open

            return false;
    Severity: Minor
    Found in modules/Vtiger/models/MappedFields.php by phan

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

            $row = (new \App\Db\Query())->from(self::$baseTable)->where(['tabid' => $tabId, 'reltabid' => $relTabId])->limit(1)->one();
    Severity: Critical
    Found in modules/Vtiger/models/MappedFields.php by phan

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

                $dataReader = (new App\Db\Query())->from(self::$mappingTable)->where([self::$mappingIndex => $this->getId()])
    Severity: Critical
    Found in modules/Vtiger/models/MappedFields.php by phan

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

            \App\Log::trace('Entering ' . __METHOD__ . '(' . $recordId . ',' . $view . ',' . $moduleName . ') method ...');
    Severity: Critical
    Found in modules/Vtiger/models/MappedFields.php by phan

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

            \App\Log::trace('Exiting ' . __METHOD__ . ' method ...');
    Severity: Critical
    Found in modules/Vtiger/models/MappedFields.php by phan

    Argument 2 (module) is \Vtiger_Module_Model|\vtlib\Module|\vtlib\ModuleBasic but \Settings_MappedFields_Field_Model::getInstance() takes false|string defined at /code/modules/Settings/MappedFields/models/Field.php:166
    Open

                        'source' => Settings_MappedFields_Field_Model::getInstance($mappingDetails['source'], $this->getModule(), $mappingDetails['type']),
    Severity: Minor
    Found in modules/Vtiger/models/MappedFields.php by phan

    This branch's code block is the same as the block for the branch on line 286.
    Open

            } elseif (\in_array('Roles:' . $currentUser->getRole(), $permissions)) {
                $return = true;
            } elseif (\array_key_exists('Groups', $getTypes)) {

    Having two cases in a switch statement or two branches in an if chain with the same implementation is at best duplicate code, and at worst a coding error. If the same logic is truly needed for both instances, then in an if chain they should be combined, or for a switch, one should fall through to the other.

    Noncompliant Code Example

    switch ($i) {
      case 1:
        doSomething();
        break;
      case 2:
        doSomethingDifferent();
        break;
      case 3:  // Noncompliant; duplicates case 1's implementation
        doSomething();
        break;
      default:
        doTheRest();
    }
    
    if ($a >= 0 && $a < 10) {
      doTheThing();
    else if ($a >= 10 && $a < 20) {
      doTheOtherThing();
    }
    else if ($a >= 20 && $a < 50) {
      doTheThing();  // Noncompliant; duplicates first condition
    }
    else {
      doTheRest();
    }
    
    if ($b == 0) {
      doOneMoreThing();
    }
    else {
      doOneMoreThing(); // Noncompliant; duplicates then-branch
    }
    
    var b = a ? 12 > 4 : 4;  // Noncompliant; always results in the same value
    

    Compliant Solution

    switch ($i) {
      case 1:
      case 3:
        doSomething();
        break;
      case 2:
        doSomethingDifferent();
        break;
      default:
        doTheRest();
    }
    
    if (($a >= 0 && $a < 10) || ($a >= 20 && $a < 50)) {
      doTheThing();
    else if ($a >= 10 && $a < 20) {
      doTheOtherThing();
    }
    else {
      doTheRest();
    }
    
    doOneMoreThing();
    
    b = 4;
    

    or

    switch ($i) {
      case 1:
        doSomething();
        break;
      case 2:
        doSomethingDifferent();
        break;
      case 3:
        doThirdThing();
        break;
      default:
        doTheRest();
    }
    
    if ($a >= 0 && $a < 10) {
      doTheThing();
    else if ($a >= 10 && $a < 20) {
      doTheOtherThing();
    }
    else if ($a >= 20 && $a < 50) {
      doTheThirdThing();
    }
    else {
      doTheRest();
    }
    
    if ($b == 0) {
      doOneMoreThing();
    }
    else {
      doTheRest();
    }
    
    int b = a ? 12 > 4 : 8;
    

    Exceptions

    Blocks in an if chain that contain a single line of code are ignored, as are blocks in a switch statement that contain a single line of code with or without a following break.

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

    class Vtiger_MappedFields_Model extends \App\Base

    The class Vtiger_MappedFields_Model is not named in CamelCase.
    Open

    class Vtiger_MappedFields_Model extends \App\Base
    {
        public static $baseTable = 'a_yf_mapped_config';
        public static $mappingTable = 'a_yf_mapped_fields';
        public static $baseIndex = 'id';

    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 = Vtiger_Cache::get('MappedFieldsModel', $recordId);

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

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

        public static $mappingTable = 'a_yf_mapped_fields';

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

         * Function to get the id of the record.

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

        {

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

         * Check if templates are avauble for this record, user and view.

    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

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

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

         * @param string $moduleName - name of the module

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

            $templates = $this->getActiveTemplatesForRecord($recordId, $view, $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

                $handlerClass = Vtiger_Loader::getComponentClassName('Model', 'MappedFields', $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

         * @return <Number> - Record Id

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

        {

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

                if (!$template->checkFiltersForRecord($recordId) || !$template->checkUserPermissions() || !\App\Privilege::isPermitted($template->getRelatedName(), 'EditView')) {

    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\Cache::save('MappedFieldsTemplatesByModule', $moduleName, $rows);

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

        protected $mapping = [];

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

            return parent::get($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

                return true;

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

            }

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

                $rows = App\Cache::get('MappedFieldsTemplatesByModule', $moduleName);

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

                $templates[$mf->getId()] = $mf;

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

            return $templates;

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

        {

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

                return false;

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

            return $mf;

    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

        }

    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

        public function getFieldFilterValueType($fieldname)

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

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

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

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

                $roles = $currentUser->getParentRoles();

    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 false;

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

        }

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

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

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

            return $templates;

    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

            \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

            \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

            $row = (new \App\Db\Query())->from(self::$baseTable)->where(['tabid' => $tabId, 'reltabid' => $relTabId])->limit(1)->one();

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

                        'target' => Settings_MappedFields_Field_Model::getInstance($mappingDetails['target'], $this->getRelatedModule(), $mappingDetails['type']),

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

                    }

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

        {

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

                $getTypes[$valueType[0]][] = $valueType[1];

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

                $return = true;

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

                $accessibleGroups = array_keys(\App\Fields\Owner::getInstance($this->get('module_name'), $currentUser)->getAccessibleGroupForModule());

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

                        'source' => Settings_MappedFields_Field_Model::getInstance($mappingDetails['source'], $this->getModule(), $mappingDetails['type']),

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

                        return $filter['valuetype'];

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

            if (\App\Cache::staticHas(__METHOD__, $key)) {

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

            \App\Cache::staticSave(__METHOD__, $key, $test);

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

        public static $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

                $groups = array_intersect($getTypes['Groups'], $currentUser->getGroups());

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

            if (\count($templates) > 0) {

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

                if (array_intersect($groups, $accessibleGroups)) {

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

                $moduleName = \App\Record::getType($recordId);

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

                    ->all();

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

            }

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

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

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

                    ->createCommand()->query();

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

        }

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

        {

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

         *

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

            $recordModel = Vtiger_Record_Model::getInstanceById($recordId);

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

        {

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

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

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

                return true;

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

            }

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

        public static $baseIndex = 'id';

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

        /**

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

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

                return [];

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

            }

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

            } else {

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

                if (!$template->checkUserPermissions()) {

    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

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

            return Vtiger_Module_Model::getInstance($this->getRelatedName());

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

         *

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

         * @param string $view       - modules view - Detail or List

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

        }

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

                $rows = (new \App\Db\Query())->from(self::$baseTable)

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

            $templates = [];

    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 getActiveTemplatesForModule($moduleName, $view)

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

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

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

                    unset($templates[$id]);

    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

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

    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

        {

    Line exceeds 120 characters; contains 158 characters
    Open

                        'target' => Settings_MappedFields_Field_Model::getInstance($mappingDetails['target'], $this->getRelatedModule(), $mappingDetails['type']),

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

            return $this->mapping;

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

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

                if (array_intersect($getTypes['RoleAndSubordinates'], array_filter($roles))) {

    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 Vtiger_Module_Model::getInstance($this->getName());

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

         * @return bool true or false

    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

         * @param string $moduleName - module name for which template was created

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

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

            $this->mapping = $mapp;

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

         * @return string

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

            return \App\Module::getModuleName($this->get('tabid'));

    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

            $key = $this->getId() . '_' . $recordId;

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

                return \App\Cache::staticGet(__METHOD__, $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

                $valueType = explode(':', $name);

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

            } elseif (\array_key_exists('Groups', $getTypes)) {

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

         * Function returns valuetype of the field filter.

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

         *

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

            return false;

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

                $return = true;

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

                    $return = true;

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

         */

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

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

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

         * Returns template records by module name.

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

         * @return array of template record models

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

            $templates = $this->getTemplatesByModule($moduleName);

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

                ->one();

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

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

    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

                    $finalMapping[] = [

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

            return \App\Module::getModuleName($this->get('reltabid'));

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

            $conditionStrategy = new VTJsonCondition();

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

        public function checkUserPermissions()

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

        public static $mappingIndex = 'mappedid';

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

                return \App\Json::decode(html_entity_decode(parent::get($key)));

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

            $templates = $this->getTemplatesByModule($moduleName);

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

        public static function getInstanceByModules($tabId, $relTabId)

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

            $handlerClass = Vtiger_Loader::getComponentClassName('Model', 'MappedFields', \App\Module::getModuleName($tabId));

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

            if (false === $row) {

    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->mapping) {

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

                }

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

         * @param int $recordId

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

            Vtiger_Loader::includeOnce('~/modules/com_vtiger_workflow/VTJsonCondition.php');

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

            $getTypes = [];

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

            if (\array_key_exists('RoleAndSubordinates', $getTypes) && !$return) {

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

        }

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

        {

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

        {

    Line exceeds 120 characters; contains 174 characters
    Open

                if (!$template->checkFiltersForRecord($recordId) || !$template->checkUserPermissions() || !\App\Privilege::isPermitted($template->getRelatedName(), 'EditView')) {

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

                    ->where(['tabid' => \App\Module::getModuleId($moduleName), 'status' => 1])

    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 ($templates as $id => &$template) {

    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

            if ($mf) {

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

            $mf->setData($row);

    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

                        'source' => Settings_MappedFields_Field_Model::getInstance($mappingDetails['source'], $this->getModule(), $mappingDetails['type']),

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

                    if ($fieldname == $filter['fieldname']) {

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

            }

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

         * Function to check filters for record.

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

         * @return bool

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

                $roles[] = $currentUser->getRole();

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

            foreach ($rows as $row) {

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

                $mf->setData($row);

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

            $mf = Vtiger_Cache::get('MappedFieldsModel', $recordId);

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

                ->where([self::$baseIndex => $recordId])

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

                while ($mappingDetails = $dataReader->read()) {

    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

        /**

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

            $permissions = explode(',', $permissions);

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

            return parent::get($key);

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

         * @param int    $recordId   - id of a record

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

            if (App\Cache::has('MappedFieldsTemplatesByModule', $moduleName)) {

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

            return $templates;

    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

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

    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

            $row = (new App\Db\Query())->from(self::$baseTable)

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

            Vtiger_Cache::set('MappedFieldsModel', $recordId, $mf);

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

                        'type' => $mappingDetails['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

            $test = $conditionStrategy->evaluate($this->getRaw('conditions'), $recordModel);

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

            if (false === $row) {

    Line exceeds 120 characters; contains 122 characters
    Open

            $handlerClass = Vtiger_Loader::getComponentClassName('Model', 'MappedFields', \App\Module::getModuleName($tabId));

    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

                $finalMapping = [];

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

                foreach ($conditions as $filter) {

    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 checkActiveTemplates($recordId, $moduleName, $view)

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

        public function getActiveTemplatesForRecord($recordId, $view, $moduleName = false)

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

            if (!\App\Record::isExists($recordId)) {

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

                    unset($templates[$id]);

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

            }

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

            \App\Log::trace('Entering ' . __METHOD__ . '(' . $tabId . ',' . $relTabId . ') method ...');

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

            $mf->setData($row);

    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

            $mf = new $handlerClass();

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

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

        public function getRelatedName()

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

            }

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

            $currentUser = Users_Record_Model::getCurrentUserModel();

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

            foreach ($permissions as $name) {

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

                $dataReader = (new App\Db\Query())->from(self::$mappingTable)->where([self::$mappingIndex => $this->getId()])

    Line exceeds 120 characters; contains 121 characters
    Open

                $dataReader = (new App\Db\Query())->from(self::$mappingTable)->where([self::$mappingIndex => $this->getId()])

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

                $this->mapping = $finalMapping;

    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

            if (empty($permissions)) {

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

            } elseif (\in_array('Roles:' . $currentUser->getRole(), $permissions)) {

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

                    $return = true;

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

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

    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

            if (\in_array($key, ['conditions', 'params']) && !\is_array(parent::get($key))) {

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

        public function getRelatedModule()

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

            foreach ($templates as $id => &$template) {

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

            $row = (new \App\Db\Query())->from(self::$baseTable)->where(['tabid' => $tabId, 'reltabid' => $relTabId])->limit(1)->one();

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

    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

                        'default' => $mappingDetails['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

         * @param mixed $fieldname

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

            if (!empty($conditions) && \is_array($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 checkFiltersForRecord($recordId)

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

            if (\in_array('Users:' . $currentUser->getId(), $permissions)) {

    Line exceeds 120 characters; contains 147 characters
    Open

                $accessibleGroups = array_keys(\App\Fields\Owner::getInstance($this->get('module_name'), $currentUser)->getAccessibleGroupForModule());

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

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

        }

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

    class Vtiger_MappedFields_Model extends \App\Base

    There are no issues that match your filters.

    Category
    Status