YetiForceCompany/YetiForceCRM

View on GitHub
modules/Settings/FieldsDependency/models/Record.php

Summary

Maintainability
A
3 hrs
Test Coverage
F
0%

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

    public function getDisplayValue(string $key)
    {
        $value = $this->get($key);
        switch ($key) {
            case 'tabid':
Severity: Minor
Found in modules/Settings/FieldsDependency/models/Record.php - About 1 hr to fix

    Function checkHandler has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function checkHandler()
        {
            $tableName = $this->getModule()->baseTable;
            $modules = (new \App\Db\Query())->select(['vtiger_tab.name'])
                ->from($tableName)->innerJoin('vtiger_tab', "{$tableName}.tabid=vtiger_tab.tabid")
    Severity: Minor
    Found in modules/Settings/FieldsDependency/models/Record.php - About 45 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 getDisplayValue has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getDisplayValue(string $key)
        {
            $value = $this->get($key);
            switch ($key) {
                case 'tabid':
    Severity: Minor
    Found in modules/Settings/FieldsDependency/models/Record.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

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

    class Settings_FieldsDependency_Record_Model extends Settings_Vtiger_Record_Model
    {
        /** {@inheritdoc} */
        public function getId()
        {

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

                $handlers = (new \App\Db\Query())->from('vtiger_eventhandlers')

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

            $modules = (new \App\Db\Query())->select(['vtiger_tab.name'])

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

                throw new \App\Exceptions\AppException('ERR_EXCEEDED_NUMBER_CHARACTERS||100', 406);

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

            $row = (new \App\Db\Query())->from('s_#__fields_dependency')->where(['id' => $id])->one(\App\Db::getInstance('admin'));

    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\Db' in method 'getInstanceById'.
    Open

            $row = (new \App\Db\Query())->from('s_#__fields_dependency')->where(['id' => $id])->one(\App\Db::getInstance('admin'));

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

            $conditions = \is_array($data['conditions']) ? $data['conditions'] : \App\Json::decode($data['conditions']);

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

            } else {
                $db->createCommand()->insert('s_#__fields_dependency', $data)->execute();
            }

    ElseExpression

    Since: 1.4.0

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

    Example

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

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

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

                    $value = implode(', ', array_map(fn ($val) => \App\Language::translate(\App\FieldsDependency::VIEWS[$val], 'Settings:FieldsDependency'), \App\Json::decode($value) ?? []));

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

                    $value = \App\Language::translate($moduleName, $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\Purifier' in method 'sanitize'.
    Open

                $data['id'] = \App\Purifier::purifyByType($data['id'], 'Integer');

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

            \App\Cache::delete('FieldsDependency', $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 'Settings_Vtiger_Module_Model' in method 'getInstanceById'.
    Open

                $instance->setData($row)->setModule(Settings_Vtiger_Module_Model::getInstance($qualifiedModuleName));

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

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

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

                    $value = "<div class=\"js-popover-tooltip ml-2 mr-2 d-inline mt-2\" data-js=\"popover\" data-content=\"$value\">" . \App\TextUtils::textTruncate($value) . '</div>';

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

                    $value = implode(', ', array_map(fn ($val) => \App\Language::translate(\App\FieldsDependency::VIEWS[$val], 'Settings:FieldsDependency'), \App\Json::decode($value) ?? []));

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

            } else {
                $types = ['EditViewChangeValue', 'EditViewPreSave'];
                $handlers = (new \App\Db\Query())->from('vtiger_eventhandlers')
                    ->where(['handler_class' => 'Vtiger_FieldsDependency_Handler', 'event_name' => $types])
                    ->indexBy('event_name')->all();

    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\EventHandler' in method 'checkHandler'.
    Open

                        \App\EventHandler::update($data, $handlers[$type]['eventhandler_id']);

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

            if (\App\TextUtils::getTextLength($data['name']) > 100) {

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

            $data['conditionsFields'] = \App\Json::encode(\App\Condition::getFieldsFromConditions($conditions)['baseModule'] ?? []);

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

            \App\Cache::delete('FieldsDependency', $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\Language' in method 'getDisplayValue'.
    Open

                    $value = \App\Language::translate($value ? 'LBL_YES' : 'LBL_NO');

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

                $data['fields'] = \App\Json::encode($data['fields']);

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

                    $value = \App\Purifier::encodeHtml($value);

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

    Avoid using static access to class '\App\EventHandler' in method 'checkHandler'.
    Open

                \App\EventHandler::deleteHandler('Vtiger_FieldsDependency_Handler');

    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\EventHandler' in method 'checkHandler'.
    Open

                        \App\EventHandler::registerHandler($type, 'Vtiger_FieldsDependency_Handler', implode(',', $modules), '', 5, true, 0, \App\EventHandler::SYSTEM);

    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_Link_Model' in method 'getRecordLinks'.
    Open

                $links[] = Vtiger_Link_Model::getInstanceFromValues($recordLink);

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

            $instance->setModule(Settings_Vtiger_Module_Model::getInstance('Settings:FieldsDependency'));

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

                    $moduleModel = Vtiger_Module_Model::getInstance($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\Json' in method 'getDisplayValue'.
    Open

                    $value = implode(', ', array_map(fn ($fieldName) => $moduleModel->getFieldByName($fieldName)->getFullLabelTranslation(), \App\Json::decode($value) ?? []));

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

    Avoid using static access to class '\App\Condition' in method 'sanitize'.
    Open

    }

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

                $data['views'] = \App\Json::encode($data['views']);

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

                    $moduleName = \App\Module::getModuleName($value);

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

                    $value = \App\Language::translate($value ? 'LBL_NO' : 'LBL_YES');

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

            $data['conditions'] = \App\Json::encode($conditions);

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

                    } else {
                        \App\EventHandler::registerHandler($type, 'Vtiger_FieldsDependency_Handler', implode(',', $modules), '', 5, true, 0, \App\EventHandler::SYSTEM);
                    }

    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

    syntax error, unexpected '=>' (T_DOUBLE_ARROW), expecting ',' or ')'
    Open

                    $value = implode(', ', array_map(fn ($val) => \App\Language::translate(\App\FieldsDependency::VIEWS[$val], 'Settings:FieldsDependency'), \App\Json::decode($value) ?? []));

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

        public static function getInstanceById(int $id, string $qualifiedModuleName = 'Settings:FieldsDependency')
        {
            $row = (new \App\Db\Query())->from('s_#__fields_dependency')->where(['id' => $id])->one(\App\Db::getInstance('admin'));
            $instance = null;
            if ($row) {
    Severity: Major
    Found in modules/Settings/FieldsDependency/models/Record.php and 1 other location - About 1 hr to fix
    modules/Settings/SlaPolicy/models/Record.php on lines 63..72

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 107.

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

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

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

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

    Refactorings

    Further Reading

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

    class Settings_FieldsDependency_Record_Model extends Settings_Vtiger_Record_Model

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

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

    ShortVariable

    Since: 0.2

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

    Example

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

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

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

        public static function getInstanceById(int $id, string $qualifiedModuleName = 'Settings:FieldsDependency')

    ShortVariable

    Since: 0.2

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

    Example

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

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

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

        protected function setId($id)

    ShortVariable

    Since: 0.2

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

    Example

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

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

    The class Settings_FieldsDependency_Record_Model is not named in CamelCase.
    Open

    class Settings_FieldsDependency_Record_Model extends Settings_Vtiger_Record_Model
    {
        /** {@inheritdoc} */
        public function getId()
        {

    CamelCaseClassName

    Since: 0.2

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

    Example

    class class_name {
    }

    Source

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

            $this->set('id', $id);

    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

        public function getName()

    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

        /** {@inheritdoc} */

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

        {

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

        /** {@inheritdoc} */

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

         *

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

        {

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

         * Function to set module to this record instance.

    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

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

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

            return $this->module;

    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

        protected function setId($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

        }

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

        }

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

         * @return \Settings_Vtiger_Module_Model

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

         *

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

        {

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

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

        {

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

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

        /**

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

        /** {@inheritdoc} */

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

        /**

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

        }

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

         * @param int    $id

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

                $data['id'] = \App\Purifier::purifyByType($data['id'], 'Integer');

    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\Cache::delete('FieldsDependency', $this->get('tabid'));

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

                    $value = implode(', ', array_map(fn ($val) => \App\Language::translate(\App\FieldsDependency::VIEWS[$val], 'Settings:FieldsDependency'), \App\Json::decode($value) ?? []));

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

                    $value = implode(', ', array_map(fn ($fieldName) => $moduleModel->getFieldByName($fieldName)->getFullLabelTranslation(), \App\Json::decode($value) ?? []));

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

         * function to get clean instance.

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

         *

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

            $instance = new static();

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

            $data['mandatory'] = (int) $data['mandatory'];

    Line exceeds 120 characters; contains 128 characters
    Open

            $data['conditionsFields'] = \App\Json::encode(\App\Condition::getFieldsFromConditions($conditions)['baseModule'] ?? []);

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

            $recordId = $this->getId();

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

                $db->createCommand()->update('s_#__fields_dependency', $data, ['id' => $recordId])->execute();

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

         */

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

        }

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

            switch ($key) {

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

            $this->module = $moduleModel;

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

            $row = (new \App\Db\Query())->from('s_#__fields_dependency')->where(['id' => $id])->one(\App\Db::getInstance('admin'));

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

            if ($recordId) {

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

         * Get display value.

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

                    break;

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

                case 'mandatory':

    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 save(): void

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

        /**

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

         * Function to delete the current Record Model.

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

                ->delete('s_#__fields_dependency', ['id' => $this->getId()])

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

        {

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

         */

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

        public function setModule($moduleModel): self

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

        /**

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

        public static function getInstanceById(int $id, string $qualifiedModuleName = 'Settings:FieldsDependency')

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

        }

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

                throw new \App\Exceptions\AppException('ERR_EXCEEDED_NUMBER_CHARACTERS||100', 406);

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

            $data['conditionsFields'] = \App\Json::encode(\App\Condition::getFieldsFromConditions($conditions)['baseModule'] ?? []);

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

            return $data;

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

         *

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

                case 'gui':

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

                    break;

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

        }

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

        public function getEditRecordUrl(int $recordId): string

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

                \App\EventHandler::deleteHandler('Vtiger_FieldsDependency_Handler');

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

                }

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

         * @param string $qualifiedModuleName

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

        {

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

                $instance->setData($row)->setModule(Settings_Vtiger_Module_Model::getInstance($qualifiedModuleName));

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

            $instance->setModule(Settings_Vtiger_Module_Model::getInstance('Settings:FieldsDependency'));

    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

        public function delete()

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

                case 'tabid':

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

            return 'index.php?parent=Settings&module=FieldsDependency&view=Edit&record=' . $recordId;

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

                foreach ($types as $type) {

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

                        \App\EventHandler::update($data, $handlers[$type]['eventhandler_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

         *

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

         * @return mixed

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

            }

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

         * Validate and sanitize record data.

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

            $data['status'] = $data['status'] ? 0 : 1;

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

                $data['fields'] = \App\Json::encode($data['fields']);

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

         *

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

                    $moduleModel = Vtiger_Module_Model::getInstance($this->get('tabid'));

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

         * Get edit record url.

    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

            if (isset($data['id'])) {

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

                case 'views':

    Line exceeds 120 characters; contains 171 characters
    Open

                    $value = implode(', ', array_map(fn ($fieldName) => $moduleModel->getFieldByName($fieldName)->getFullLabelTranslation(), \App\Json::decode($value) ?? []));

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

         *

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

        {

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

                    'linkclass' => 'btn btn-primary btn-sm'

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

            ];

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

                    ->where(['handler_class' => 'Vtiger_FieldsDependency_Handler', 'event_name' => $types])

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

         * @return \self

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

                $instance = new self();

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

                    } else {

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

            if (\App\TextUtils::getTextLength($data['name']) > 100) {

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

            }

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

            $conditions = \is_array($data['conditions']) ? $data['conditions'] : \App\Json::decode($data['conditions']);

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

         * Function to save.

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

         * @return void

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

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

    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\FieldsDependency::$recordModelCache = [];

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

        public function getDisplayValue(string $key)

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

                    $moduleName = \App\Module::getModuleName($value);

    Line exceeds 120 characters; contains 187 characters
    Open

                    $value = implode(', ', array_map(fn ($val) => \App\Language::translate(\App\FieldsDependency::VIEWS[$val], 'Settings:FieldsDependency'), \App\Json::decode($value) ?? []));

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

                    break;

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

        /**

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

                [

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

                    'linktype' => 'LISTVIEWRECORD',

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

                    'linklabel' => 'LBL_DELETE_RECORD',

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

            $tableName = $this->getModule()->baseTable;

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

            return $instance;

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

         *

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

            $data['conditions'] = \App\Json::encode($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

                ->execute();

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

        /**

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

         * @param string $key

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

         * @return mixed

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

                default:

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

        public function getRecordLinks(): array

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

            }

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

         */

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

                ->from($tableName)->innerJoin('vtiger_tab', "{$tableName}.tabid=vtiger_tab.tabid")

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

            if (!$modules) {

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

                $types = ['EditViewChangeValue', 'EditViewPreSave'];

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

         * @return array cleaned up data

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

        public static function sanitize(array $data): array

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

            $data = static::sanitize($this->getData());

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

                    $value = \App\Language::translate($value ? 'LBL_YES' : 'LBL_NO');

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

            return $value;

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

         */

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

            $recordLinks = [

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

                ],

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

                ->where(["{$tableName}.status" => 0])->distinct()->column();

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

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

            }

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

            $this->checkHandler();

    Line exceeds 120 characters; contains 180 characters
    Open

                    $value = "<div class=\"js-popover-tooltip ml-2 mr-2 d-inline mt-2\" data-js=\"popover\" data-content=\"$value\">" . \App\TextUtils::textTruncate($value) . '</div>';

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

         * @param int $recordId

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

        /**

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

         * @return Vtiger_Link_Model[] Associate array of Vtiger_Link_Model instances

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

            $links = [];

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

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

                    ->indexBy('event_name')->all();

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

         * @param array $data

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

            if (\is_array($data['views'])) {

    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

        {

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

            $this->checkHandler();

    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

            $value = $this->get($key);

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

                    break;

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

                    $value = "<div class=\"js-popover-tooltip ml-2 mr-2 d-inline mt-2\" data-js=\"popover\" data-content=\"$value\">" . \App\TextUtils::textTruncate($value) . '</div>';

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

                    break;

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

        {

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

                    'linkicon' => 'fas fa-trash-alt',

    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

                        \App\EventHandler::registerHandler($type, 'Vtiger_FieldsDependency_Handler', implode(',', $modules), '', 5, true, 0, \App\EventHandler::SYSTEM);

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

         * Function to get the instance of sla policy record model.

    Line exceeds 120 characters; contains 164 characters
    Open

                        \App\EventHandler::registerHandler($type, 'Vtiger_FieldsDependency_Handler', implode(',', $modules), '', 5, true, 0, \App\EventHandler::SYSTEM);

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

         * @return \static

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

        public static function getCleanInstance(): self

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

            $return = \App\Db::getInstance('admin')->createCommand()

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

         */

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

                    $value = \App\Language::translate($value ? 'LBL_NO' : 'LBL_YES');

    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 string

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

        }

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

        {

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

            return $instance;

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

        }

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

        /**

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

        }

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

                $db->createCommand()->insert('s_#__fields_dependency', $data)->execute();

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

            }

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

            \App\Cache::delete('FieldsDependency', $this->get('tabid'));

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

            \App\FieldsDependency::$recordModelCache = [];

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

                    $value = \App\Purifier::encodeHtml($value);

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

            }

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

         *

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

                    'linktype' => 'LISTVIEWRECORD',

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

            } else {

    Line exceeds 120 characters; contains 127 characters
    Open

            $row = (new \App\Db\Query())->from('s_#__fields_dependency')->where(['id' => $id])->one(\App\Db::getInstance('admin'));

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

            $instance = null;

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

         */

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

            $data['gui'] = (int) $data['gui'];

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

            $data['tabid'] = (int) $data['tabid'];

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

                $data['views'] = \App\Json::encode($data['views']);

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

            if (\is_array($data['fields'])) {

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

         *

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

                    $value = \App\Language::translate($moduleName, $moduleName);

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

                case 'fields':

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

                case 'status':

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

                    break;

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

                    'linkurl' => $this->getEditRecordUrl($this->getId()),

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

            foreach ($recordLinks as $recordLink) {

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

            return $links;

    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

                $links[] = Vtiger_Link_Model::getInstanceFromValues($recordLink);

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

                    if (isset($handlers[$type])) {

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

                        $data = ['include_modules' => implode(',', $modules), 'is_active' => 1];

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

         * @return void

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

            $modules = (new \App\Db\Query())->select(['vtiger_tab.name'])

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

                [

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

                    'linkicon' => 'yfi yfi-full-editing-view',

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

                    'linkurl' => 'javascript:Settings_Vtiger_List_Js.deleteById(' . $this->getId() . ', true)',

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

         * Check whether to activate/remove handler.

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

        }

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

        }

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

         * Function to get the list view actions for the record.

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

                    'linklabel' => 'LBL_EDIT_RECORD',

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

                    'linkclass' => 'btn text-white btn-danger btn-sm'

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

         *

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

                $handlers = (new \App\Db\Query())->from('vtiger_eventhandlers')

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

    class Settings_FieldsDependency_Record_Model extends Settings_Vtiger_Record_Model

    Space before opening parenthesis of function call prohibited
    Open

                    $value = implode(', ', array_map(fn ($val) => \App\Language::translate(\App\FieldsDependency::VIEWS[$val], 'Settings:FieldsDependency'), \App\Json::decode($value) ?? []));

    Space before opening parenthesis of function call prohibited
    Open

                    $value = implode(', ', array_map(fn ($fieldName) => $moduleModel->getFieldByName($fieldName)->getFullLabelTranslation(), \App\Json::decode($value) ?? []));

    There are no issues that match your filters.

    Category
    Status