YetiForceCompany/YetiForceCRM

View on GitHub
app/Fields/Tree.php

Summary

Maintainability
A
2 hrs
Test Coverage
D
65%

Method getPicklistValueImage has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function getPicklistValueImage($templateId, $moduleName, $treeId)
    {
        $value = ['name' => ''];
        $rows = self::getValuesById((int) $templateId);
        if (empty($rows[$treeId])) {
Severity: Minor
Found in app/Fields/Tree.php - About 1 hr to fix

    Function getPicklistValueImage has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function getPicklistValueImage($templateId, $moduleName, $treeId)
        {
            $value = ['name' => ''];
            $rows = self::getValuesById((int) $templateId);
            if (empty($rows[$treeId])) {
    Severity: Minor
    Found in app/Fields/Tree.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

    Missing class import via use statement (line '32', column '16').
    Open

            $rows = (new \App\Db\Query())
    Severity: Minor
    Found in app/Fields/Tree.php by phpmd

    MissingImport

    Since: 2.7.0

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

    Example

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

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

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

                return \App\Cache::get('TreeValuesById', $templateId);
    Severity: Minor
    Found in app/Fields/Tree.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

            $db = \App\Db::getInstance();
    Severity: Minor
    Found in app/Fields/Tree.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

                $values[$row['tree']] = $parentName . \App\Language::translate($row['name'], $moduleName, null, false);
    Severity: Minor
    Found in app/Fields/Tree.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

            \App\Cache::save('TreeValuesById', $templateId, $rows, \App\Cache::MEDIUM);
    Severity: Minor
    Found in app/Fields/Tree.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

                    $parentName = '(' . \App\Language::translate($parentName, $moduleName, null, false) . ') ';
    Severity: Minor
    Found in app/Fields/Tree.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

                $parentName = '(' . \App\Language::translate($parentName, $moduleName, null, false) . ') ';
    Severity: Minor
    Found in app/Fields/Tree.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

            if (\App\Cache::has('TreeValuesById', $templateId)) {
    Severity: Minor
    Found in app/Fields/Tree.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

            $value['name'] = $parentName . \App\Language::translate($row['name'], $moduleName, null, false);
    Severity: Minor
    Found in app/Fields/Tree.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

                    'text' => \App\Language::translate($row['name'], $moduleName, null, false),
    Severity: Minor
    Found in app/Fields/Tree.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

                } else {
                    $value['icon'] = '<span class="mr-1 ' . $row['icon'] . '"></span>';
                }
    Severity: Minor
    Found in app/Fields/Tree.php by phpmd

    ElseExpression

    Since: 1.4.0

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

    Example

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

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

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

            if (\App\Cache::has('TreeValuesById', $templateId)) {
    Severity: Critical
    Found in app/Fields/Tree.php by sonar-php

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

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

    Noncompliant Code Example

    With the default threshold of 3:

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

    Compliant Solution

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

    Exceptions

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

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

                    $parentTrre = $row['parentTree'];
    Severity: Critical
    Found in app/Fields/Tree.php by sonar-php

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

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

    Noncompliant Code Example

    With the default threshold of 3:

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

    Compliant Solution

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

    Exceptions

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

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

            \App\Cache::save('TreeValuesById', $templateId, $rows, \App\Cache::MEDIUM);
    Severity: Minor
    Found in app/Fields/Tree.php by phan

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

                return \App\Cache::get('TreeValuesById', $templateId);
    Severity: Minor
    Found in app/Fields/Tree.php by phan

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

            $rows = (new \App\Db\Query())
    Severity: Critical
    Found in app/Fields/Tree.php by phan

    Return type of getParentIdx() is undeclared type \App\Fields\flase
    Open

        public static function getParentIdx(array $itemTree)
    Severity: Minor
    Found in app/Fields/Tree.php by phan

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

            $db->createCommand()->delete('vtiger_trees_templates', ['tabid' => $moduleId])->execute();
    Severity: Critical
    Found in app/Fields/Tree.php by phan

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

            if (\App\Cache::has('TreeValuesById', $templateId)) {
    Severity: Minor
    Found in app/Fields/Tree.php by phan

    Returning type false but getParentIdx() is declared to return \App\Fields\flase|string
    Open

            return $parentIdx < 0 ? false : $parentItem[$parentIdx];
    Severity: Minor
    Found in app/Fields/Tree.php by phan

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

            $db = \App\Db::getInstance();
    Severity: Minor
    Found in app/Fields/Tree.php by phpmd

    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

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

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

         * Get tree values by tree ID.
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

        public static function getPicklistValue($templateId, $moduleName)
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

                $parentName = '';
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

                    $parentName = '(' . \App\Language::translate($parentName, $moduleName, null, false) . ') ';
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

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

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

            return $tree;
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

            $parentName = '';
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

                if ($row['icon'] && false !== strpos($row['icon'], '/')) {
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

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

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

         * @param int $moduleId
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

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

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

         * @param int $templateId
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

         * @param int    $templateId
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

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

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

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

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

                $parentName = static::getPicklistValue($templateId, $moduleName)[$parent];
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

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

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

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

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

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

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

            return $values;
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

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

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

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

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

            $row = $rows[$treeId];
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

            $parent = '';
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

        public static function getValuesById($templateId)
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

                ->from('vtiger_trees_templates_data')
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

         * @param int    $templateId
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

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

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

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

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

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

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

            if ($row['depth'] > 0) {
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

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

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

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

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

                $tree = $row['tree'];
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

                    $parentTrre = $row['parentTree'];
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

                    $parentTrre = substr($parentTrre, 0, -$cut);
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

                    $parent = end($pieces);
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

         * Get tree values for jstree.
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

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

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

                $parentIdx = static::getParentIdx($row);
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

         * @param string $treeId
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

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

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

                        $basePath = 'public_html/';
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

                    $value['icon'] = '<img class="icon-img--picklist mr-1" src="' . $basePath . $row['icon'] . '" />';
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

         * Get tree values by ID.
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

         * @return array[]
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

            \App\Cache::save('TreeValuesById', $templateId, $rows, \App\Cache::MEDIUM);
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

                $parent = '';
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

         * @param string $moduleName
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

         * @return string[]
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

                return $value;
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

                $cut = \strlen('::' . $treeId);
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

                $parentName = '(' . \App\Language::translate($parentName, $moduleName, null, false) . ') ';
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

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

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

            foreach ($dataTree as $row) {
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

        public static function getTreeValues(int $templateId, string $moduleName): array
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

                    'id' => (int) str_replace('T', '', $row['tree']),
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

            $parentItem = explode('::', $itemTree['parentTree']);
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

        public static function getPicklistValueImage($templateId, $moduleName, $treeId)
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

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

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

                    $basePath = '';
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

                    $value['icon'] = '<span class="mr-1 ' . $row['icon'] . '"></span>';
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

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

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

         * @param string $moduleName
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

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

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

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

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

            $dataTree = static::getValuesById($templateId);
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

         * @return flase|string
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

         * @param int    $templateId
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

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

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

            if (\App\Cache::has('TreeValuesById', $templateId)) {
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

         * @param int    $templateId
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

         * @return string[]
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

            $dataTree = self::getValuesById((int) $templateId);
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

                    $pieces = explode('::', $parentTrre);
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

                    if (!IS_PUBLIC_DIR) {
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

         * Delete trees of the module.
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

            $db->createCommand()->delete('vtiger_trees_templates', ['tabid' => $moduleId])->execute();
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

         * @param string $tree
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

        public static function getValueByTreeId($templateId, $tree)
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

                if ($row['depth'] > 0) {
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

                $values[$row['tree']] = $parentName . \App\Language::translate($row['name'], $moduleName, null, false);
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

            $tree = [];
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

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

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

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

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

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

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

            $db = \App\Db::getInstance();
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

                ->where(['templateid' => $templateId])->indexBy('tree')->all();
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

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

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

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

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

            $values = [];
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

                    $cut = \strlen('::' . $tree);
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

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

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

                $parentTrre = $row['parentTree'];
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

                return \App\Cache::get('TreeValuesById', $templateId);
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

            $rows = (new \App\Db\Query())
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

         * @return array
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

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

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

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

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

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

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

                $tree[] = [
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

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

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

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

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

                $pieces = explode('::', $parentTrre);
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

            if ($row['icon']) {
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

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

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

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

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

        public static function deleteForModule($moduleId)
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

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

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

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

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

            $rows = static::getValuesById($templateId);
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

            return $rows[$tree];
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

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

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

         * @param string $moduleName
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

         * @return array
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

         * @param array $itemTree
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

            return $parentIdx < 0 ? false : $parentItem[$parentIdx];
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

            $value = ['name' => ''];
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

            $rows = self::getValuesById((int) $templateId);
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

            $value['name'] = $parentName . \App\Language::translate($row['name'], $moduleName, null, false);
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

            return $rows;
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

         * Get picklist values.
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

                    $parentName = $dataTree[$parent]['name'];
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

                    'text' => \App\Language::translate($row['name'], $moduleName, null, false),
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

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

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

        public static function getParentIdx(array $itemTree)
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

            $parentIdx = \count($parentItem) - 2;
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

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

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

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

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

         * Get picklist value with graphics.
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

                $parentTrre = substr($parentTrre, 0, -$cut);
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

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

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

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

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

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

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

                    'tree' => $row['tree'],
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

                ];
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

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

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

                $parent = end($pieces);
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

            foreach ($dataTree as $row) {
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

                    'parent' => false === $parentIdx ? '#' : (int) str_replace('T', '', $dataTree[$parentIdx]['tree']),
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

         * Get parent index.
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

            if (empty($rows[$treeId])) {
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

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

            return $value;
    Severity: Minor
    Found in app/Fields/Tree.php by phpcodesniffer

    There are no issues that match your filters.

    Category
    Status