YetiForceCompany/YetiForceCRM

View on GitHub
app/Colors.php

Summary

Maintainability
D
2 days
Test Coverage
A
92%

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

class Colors
{
    public const EMPTY_COLOR = 'rgba(0,0,0,0.1)';

    /**
Severity: Minor
Found in app/Colors.php by phpmd

Function generatePicklists has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    private static function generatePicklists()
    {
        $css = '';
        foreach (Fields\Picklist::getModules() as $module) {
            $fields = static::getPicklistFieldsByModule($module['tabname']);
Severity: Minor
Found in app/Colors.php - About 3 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Colors has 21 functions (exceeds 20 allowed). Consider refactoring.
Open

class Colors
{
    public const EMPTY_COLOR = 'rgba(0,0,0,0.1)';

    /**
Severity: Minor
Found in app/Colors.php - About 2 hrs to fix

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

        private static function generateOwners()
        {
            $css = '';
            $colors = [];
            foreach (static::getAllUserColor() as $item) {
    Severity: Minor
    Found in app/Colors.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 generate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function generate($type = 'all')
        {
            switch ($type) {
                case 'user':
                case 'group':
    Severity: Minor
    Found in app/Colors.php - About 25 mins to fix

    Cognitive Complexity

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

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

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

    Further reading

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

        private static function generatePicklists()
        {
            $css = '';
            foreach (Fields\Picklist::getModules() as $module) {
                $fields = static::getPicklistFieldsByModule($module['tabname']);
    Severity: Minor
    Found in app/Colors.php by phpmd

    CyclomaticComplexity

    Since: 0.1

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

    Example

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

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

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

        private static function generatePicklists()
    Severity: Critical
    Found in app/Colors.php by sonar-php

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

    See

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

    class Colors
    Severity: Major
    Found in app/Colors.php by sonar-php

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

    Missing class import via use statement (line '362', column '30').
    Open

                $result = $color === (new \App\Db\Query())->select(['color'])->from('vtiger_field')->where(['fieldid' => $fieldId])->scalar();
    Severity: Minor
    Found in app/Colors.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

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

            $query = (new \App\Db\Query())->select(['tabid', 'fieldname', 'color'])->from('vtiger_field')->where(['presence' => [0, 2]])->andWhere(['<>', 'color', '']);
    Severity: Minor
    Found in app/Colors.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

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

        public static function getAllFilterColors($byFilterValue = false)
    Severity: Minor
    Found in app/Colors.php by phpmd

    BooleanArgumentFlag

    Since: 1.4.0

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

    Example

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

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

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

        public static function getAllModuleColor($active = false)
    Severity: Minor
    Found in app/Colors.php by phpmd

    BooleanArgumentFlag

    Since: 1.4.0

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

    Example

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

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

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

        public static function getRandomColor($fromValue = false)
    Severity: Minor
    Found in app/Colors.php by phpmd

    BooleanArgumentFlag

    Since: 1.4.0

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

    Example

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

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

    Avoid using static access to class 'App\Utils' in method 'generateOwners'.
    Open

            file_put_contents(ROOT_DIRECTORY . '/app_data/owners_colors.php', '<?php return ' . Utils::varExport($colors) . ';', LOCK_EX);
    Severity: Minor
    Found in app/Colors.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 'getAllFilterColors'.
    Open

                return Cache::get('getAllFilterColors', $byFilterValue);
    Severity: Minor
    Found in app/Colors.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 'getAllFilterColors'.
    Open

            Cache::save('getAllFilterColors', $byFilterValue, $filterColors);
    Severity: Minor
    Found in app/Colors.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\Fields\Picklist' in method 'updatePicklistValueColor'.
    Open

            Db::getInstance()->createCommand()->update('vtiger_' . $table, ['color' => ltrim($color, '#')], [Fields\Picklist::getPickListId($table) => $picklistValueId])->execute();
    Severity: Minor
    Found in app/Colors.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\Fields\Picklist' in method 'generatePicklists'.
    Open

                    $values = \App\Fields\Picklist::getValues($field->getName());
    Severity: Minor
    Found in app/Colors.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 'activeModuleColor'.
    Open

            Cache::clear();
    Severity: Minor
    Found in app/Colors.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

    Avoid assigning values to variables in if clauses and the like (line '107', column '21').
    Open

        private static function generatePicklists()
        {
            $css = '';
            foreach (Fields\Picklist::getModules() as $module) {
                $fields = static::getPicklistFieldsByModule($module['tabname']);
    Severity: Minor
    Found in app/Colors.php by phpmd

    IfStatementAssignment

    Since: 2.7.0

    Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

    Example

    class Foo
    {
        public function bar($flag)
        {
            if ($foo = 'bar') { // possible typo
                // ...
            }
            if ($baz = 0) { // always false
                // ...
            }
        }
    }

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

    Avoid using static access to class 'App\Fields\Picklist' in method 'generatePicklists'.
    Open

            foreach (Fields\Picklist::getModules() as $module) {
    Severity: Minor
    Found in app/Colors.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\Utils' in method 'sanitizeValue'.
    Open

            return empty($value) ? '' : str_replace([' ', '-', '=', '+', '@', '*', '!', '#', '$', '%', '^', '&', '(', ')', '[', ']', '{', '}', ';', ':', "\\'", '"', ',', '<', '.', '>', '/', '?', '\\', '|'], '_', \App\Utils::sanitizeSpecialChars($value));
    Severity: Minor
    Found in app/Colors.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 'updateModuleColor'.
    Open

            Cache::clear();
    Severity: Minor
    Found in app/Colors.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

    Avoid assigning values to variables in if clauses and the like (line '109', column '12').
    Open

        private static function generatePicklists()
        {
            $css = '';
            foreach (Fields\Picklist::getModules() as $module) {
                $fields = static::getPicklistFieldsByModule($module['tabname']);
    Severity: Minor
    Found in app/Colors.php by phpmd

    IfStatementAssignment

    Since: 2.7.0

    Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

    Example

    class Foo
    {
        public function bar($flag)
        {
            if ($foo = 'bar') { // possible typo
                // ...
            }
            if ($baz = 0) { // always false
                // ...
            }
        }
    }

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

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

            Cache::clear();
    Severity: Minor
    Found in app/Colors.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 'updatePicklistValueColor'.
    Open

            Cache::clear();
    Severity: Minor
    Found in app/Colors.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\Module' in method 'generateFields'.
    Open

                    $css .= '.flCT_' . Module::getModuleName($row['tabid']) . '_' . $row['fieldname'] . '{ color: ' . $row['color'] . ' !important; }' . PHP_EOL;
    Severity: Minor
    Found in app/Colors.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 '\vtlib\Functions' in method 'getAllModuleColor'.
    Open

            $allModules = \vtlib\Functions::getAllModules(false, false, false, $active);
    Severity: Minor
    Found in app/Colors.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 'getAllFilterColors'.
    Open

            if (Cache::has('getAllFilterColors', $byFilterValue)) {
    Severity: Minor
    Found in app/Colors.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

                case 'picklist':
    Severity: Critical
    Found in app/Colors.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 "tabid" 4 times.
    Open

            Db::getInstance()->createCommand()->update('vtiger_tab', ['color' => ltrim($color, '#')], ['tabid' => $id])->execute();
    Severity: Critical
    Found in app/Colors.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 " !important; }" 7 times.
    Open

                    $css .= '.ownerCT_' . $item['id'] . ' { color: ' . $item['color'] . ' !important; }' . PHP_EOL;
    Severity: Critical
    Found in app/Colors.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 " { background: " 5 times.
    Open

                    $css .= '.ownerCBg_' . $item['id'] . ' { background: ' . $item['color'] . ' !important; font-weight: 500 !important; color: ' . static::getContrast($item['color']) . ' !important;}' . PHP_EOL;
    Severity: Critical
    Found in app/Colors.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 "getAllFilterColors" 3 times.
    Open

            if (Cache::has('getAllFilterColors', $byFilterValue)) {
    Severity: Critical
    Found in app/Colors.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 " { border-color: " 4 times.
    Open

                    $css .= '.ownerCBr_' . $item['id'] . ' { border-color: ' . $item['color'] . ' !important; }' . PHP_EOL;
    Severity: Critical
    Found in app/Colors.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 " !important; font-weight: 500 !important; color: " 5 times.
    Open

                    $css .= '.ownerCBg_' . $item['id'] . ' { background: ' . $item['color'] . ' !important; font-weight: 500 !important; color: ' . static::getContrast($item['color']) . ' !important;}' . PHP_EOL;
    Severity: Critical
    Found in app/Colors.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 "vtiger_field" 5 times.
    Open

            $table = (new Db\Query())->select(['fieldname'])->from('vtiger_field')->where(['fieldid' => $picklistId])->scalar();
    Severity: Critical
    Found in app/Colors.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 " !important;}" 4 times.
    Open

                    $css .= '.ownerCBg_' . $item['id'] . ' { background: ' . $item['color'] . ' !important; font-weight: 500 !important; color: ' . static::getContrast($item['color']) . ' !important;}' . PHP_EOL;
    Severity: Critical
    Found in app/Colors.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 "picklistValue" 4 times.
    Open

                                $css .= '.picklistCBr_' . $module['tabname'] . '_' . static::sanitizeValue($field->getName()) . '_' . static::sanitizeValue($item['picklistValue']) . ' { border-color: ' . $color . ' !important; }' . PHP_EOL;
    Severity: Critical
    Found in app/Colors.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 "module" 7 times.
    Open

                case 'module':
    Severity: Critical
    Found in app/Colors.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 " { color: " 4 times.
    Open

                    $css .= '.ownerCT_' . $item['id'] . ' { color: ' . $item['color'] . ' !important; }' . PHP_EOL;
    Severity: Critical
    Found in app/Colors.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 "fieldname" 4 times.
    Open

            $table = (new Db\Query())->select(['fieldname'])->from('vtiger_field')->where(['fieldid' => $picklistId])->scalar();
    Severity: Critical
    Found in app/Colors.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 "color" 40 times.
    Open

                if (null !== $item['color'] && ltrim($item['color'], '#')) {
    Severity: Critical
    Found in app/Colors.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 "tabname" 5 times.
    Open

                $fields = static::getPicklistFieldsByModule($module['tabname']);
    Severity: Critical
    Found in app/Colors.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 "fieldid" 4 times.
    Open

            $table = (new Db\Query())->select(['fieldname'])->from('vtiger_field')->where(['fieldid' => $picklistId])->scalar();
    Severity: Critical
    Found in app/Colors.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 false but \App\Cache::get() takes string defined at /code/app/Cache.php:61
    Open

                return Cache::get('getAllFilterColors', $byFilterValue);
    Severity: Minor
    Found in app/Colors.php by phan

    Returning type \Vtiger_Field_Model[] but getPicklistFieldsByModule() is declared to return \App\Vtiger_Field_Model[]
    Open

            return \Vtiger_Module_Model::getInstance($moduleName)->getFieldsByType($types, true);
    Severity: Minor
    Found in app/Colors.php by phan

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

            Db::getInstance()->createCommand()->update('vtiger_tab', ['color' => ltrim($color, '#')], ['tabid' => $id])->execute();
    Severity: Critical
    Found in app/Colors.php by phan

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

            $result = Db::getInstance()->createCommand()->update('vtiger_field', ['color' => $color], ['fieldid' => $fieldId])->execute();
    Severity: Critical
    Found in app/Colors.php by phan

    Call to method getName from undeclared class \App\Vtiger_Field_Model
    Open

                                $css .= '.picklistCBr_' . $module['tabname'] . '_' . static::sanitizeValue($field->getName()) . '_' . static::sanitizeValue($item['picklistValue']) . ' { border-color: ' . $color . ' !important; }' . PHP_EOL;
    Severity: Critical
    Found in app/Colors.php by phan

    Call to method getName from undeclared class \App\Vtiger_Field_Model
    Open

                                $css .= '.picklistCBg_' . $module['tabname'] . '_' . static::sanitizeValue($field->getName()) . '_' . static::sanitizeValue($item['picklistValue']) . ' { background: ' . $color . ' !important; font-weight: 500 !important; color: ' . $contrastColor . ' !important;}' . PHP_EOL;
    Severity: Critical
    Found in app/Colors.php by phan

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

            Db::getInstance()->createCommand()->update('vtiger_users', ['cal_color' => $color], ['id' => $id])->execute();
    Severity: Critical
    Found in app/Colors.php by phan

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

            Db::getInstance()->createCommand()->update('vtiger_groups', ['color' => $color], ['groupid' => $id])->execute();
    Severity: Critical
    Found in app/Colors.php by phan

    Saw an @param annotation for params, but it was not found in the param list of function updateModuleColor(mixed $id, mixed $color)
    Open

         * @param array $params
    Severity: Info
    Found in app/Colors.php by phan

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

                $result = $color === (new \App\Db\Query())->select(['color'])->from('vtiger_field')->where(['fieldid' => $fieldId])->scalar();
    Severity: Critical
    Found in app/Colors.php by phan

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

            $query = (new \App\Db\Query())->select(['tabid', 'fieldname', 'color'])->from('vtiger_field')->where(['presence' => [0, 2]])->andWhere(['<>', 'color', '']);
    Severity: Critical
    Found in app/Colors.php by phan

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

            Db::getInstance()->createCommand()->update('vtiger_' . $table, ['color' => ltrim($color, '#')], [Fields\Picklist::getPickListId($table) => $picklistValueId])->execute();
    Severity: Critical
    Found in app/Colors.php by phan

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

            $table = (new Db\Query())->select(['fieldname'])->from('vtiger_field')->where(['fieldid' => $fieldId])->scalar();
    Severity: Critical
    Found in app/Colors.php by phan

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

            return (new Db\Query())->select(['id', 'first' => 'first_name', 'last' => 'last_name', 'color' => 'cal_color'])->from('vtiger_users')->all();
    Severity: Critical
    Found in app/Colors.php by phan

    Call to method getName from undeclared class \App\Vtiger_Field_Model
    Open

                                $css .= '.picklistCT_' . $module['tabname'] . '_' . static::sanitizeValue($field->getName()) . '_' . static::sanitizeValue($item['picklistValue']) . ' { color: ' . $color . ' !important; }' . PHP_EOL;
    Severity: Critical
    Found in app/Colors.php by phan

    Call to method getName from undeclared class \App\Vtiger_Field_Model
    Open

                                $css .= '.picklistLb_' . $module['tabname'] . '_' . static::sanitizeValue($field->getName()) . '_' . static::sanitizeValue($item['picklistValue']) . ' { background: ' . $color . ' !important; font-weight: 500 !important; color: ' . $contrastColor . ' !important;  padding: 2px 7px 3px 7px;}' . PHP_EOL;
    Severity: Critical
    Found in app/Colors.php by phan

    Call to method getName from undeclared class \App\Vtiger_Field_Model
    Open

                    $values = \App\Fields\Picklist::getValues($field->getName());
    Severity: Critical
    Found in app/Colors.php by phan

    Return type of getPicklistFieldsByModule() is undeclared type \App\Vtiger_Field_Model[]
    Open

        public static function getPicklistFieldsByModule($moduleName)
    Severity: Minor
    Found in app/Colors.php by phan

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

            Db::getInstance()->createCommand()->update('vtiger_tab', $set, ['tabid' => $id])->execute();
    Severity: Critical
    Found in app/Colors.php by phan

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

            $table = (new Db\Query())->select(['fieldname'])->from('vtiger_field')->where(['fieldid' => $picklistId])->scalar();
    Severity: Critical
    Found in app/Colors.php by phan

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

            if (Cache::has('getAllFilterColors', $byFilterValue)) {
    Severity: Minor
    Found in app/Colors.php by phan

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

            $customViews = (new Db\Query())->select(['cvid', 'viewname', 'color'])->from('vtiger_customview')->all();
    Severity: Critical
    Found in app/Colors.php by phan

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

            Db::getInstance()->createCommand()->addColumn('vtiger_' . $table, 'color', 'string(25)')->execute();
    Severity: Critical
    Found in app/Colors.php by phan

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

            return (new Db\Query())->select(['id' => 'groupid', 'groupname', 'color'])->from('vtiger_groups')->all();
    Severity: Critical
    Found in app/Colors.php by phan

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

            Cache::save('getAllFilterColors', $byFilterValue, $filterColors);
    Severity: Minor
    Found in app/Colors.php by phan

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

            foreach (static::getAllGroupColor() as $item) {
                if (null !== $item['color'] && ltrim($item['color'], '#')) {
                    $css .= '.ownerCBg_' . $item['id'] . ' { background: ' . $item['color'] . ' !important; font-weight: 500 !important; color: ' . static::getContrast($item['color']) . ' !important;}' . PHP_EOL;
                    $css .= '.ownerCT_' . $item['id'] . ' { color: ' . $item['color'] . ' !important; }' . PHP_EOL;
                    $css .= '.ownerCBr_' . $item['id'] . ' { border-color: ' . $item['color'] . ' !important; }' . PHP_EOL;
    Severity: Major
    Found in app/Colors.php and 1 other location - About 5 hrs to fix
    app/Colors.php on lines 61..68

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

    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

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

            foreach (static::getAllUserColor() as $item) {
                if (null !== $item['color'] && ltrim($item['color'], '#')) {
                    $css .= '.ownerCBg_' . $item['id'] . ' { background: ' . $item['color'] . ' !important; font-weight: 500 !important; color: ' . static::getContrast($item['color']) . ' !important;}' . PHP_EOL;
                    $css .= '.ownerCT_' . $item['id'] . ' { color: ' . $item['color'] . ' !important; }' . PHP_EOL;
                    $css .= '.ownerCBr_' . $item['id'] . ' { border-color: ' . $item['color'] . ' !important; }' . PHP_EOL;
    Severity: Major
    Found in app/Colors.php and 1 other location - About 5 hrs to fix
    app/Colors.php on lines 69..76

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

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

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

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

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

    Refactorings

    Further Reading

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

        public static function updateGroupColor($id, $color)
    Severity: Minor
    Found in app/Colors.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

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

        public static function activeModuleColor($id, $active, $color)
    Severity: Minor
    Found in app/Colors.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

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

        public static function updateUserColor($id, $color)
    Severity: Minor
    Found in app/Colors.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

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

        public static function updateModuleColor($id, $color)
    Severity: Minor
    Found in app/Colors.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

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

            $by = $byFilterValue ? 'viewname' : 'cvid';
    Severity: Minor
    Found in app/Colors.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

                    break;
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

                    $css .= '.ownerCBg_' . $item['id'] . ' { background: ' . $item['color'] . ' !important; font-weight: 500 !important; color: ' . static::getContrast($item['color']) . ' !important;}' . PHP_EOL;
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

                    $colors[$item['id']] = $item['color'];
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

            switch ($type) {
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

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

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

                case 'user':
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

                    static::generateModules();
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

                    break;
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

                    static::generatePicklists();
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

                    $css .= '.ownerCBr_' . $item['id'] . ' { border-color: ' . $item['color'] . ' !important; }' . PHP_EOL;
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

                    static::generateOwners();
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

            $css = '';
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

            foreach (static::getAllUserColor() as $item) {
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

                    $colors[$item['id']] = $item['color'];
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

                    $css .= '.ownerCT_' . $item['id'] . ' { color: ' . $item['color'] . ' !important; }' . PHP_EOL;
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

            file_put_contents(ROOT_DIRECTORY . '/app_data/owners_colors.php', '<?php return ' . Utils::varExport($colors) . ';', LOCK_EX);
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

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

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

                case 'group':
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

                case 'owner':
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

                    static::generateFields();
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

                    static::generateModules();
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

    Line exceeds 120 characters; contains 208 characters
    Open

                    $css .= '.ownerCBg_' . $item['id'] . ' { background: ' . $item['color'] . ' !important; font-weight: 500 !important; color: ' . static::getContrast($item['color']) . ' !important;}' . PHP_EOL;
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

                    $css .= '.ownerCT_' . $item['id'] . ' { color: ' . $item['color'] . ' !important; }' . PHP_EOL;
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

            file_put_contents(ROOT_DIRECTORY . '/public_html/layouts/resources/colors/owners.css', $css, LOCK_EX);
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

         * @param string $type type to generate, default all
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

                case 'field':
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

                    static::generateFields();
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

                if (null !== $item['color'] && ltrim($item['color'], '#')) {
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

    Line exceeds 120 characters; contains 208 characters
    Open

                    $css .= '.ownerCBg_' . $item['id'] . ' { background: ' . $item['color'] . ' !important; font-weight: 500 !important; color: ' . static::getContrast($item['color']) . ' !important;}' . PHP_EOL;
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

         * Generate owners colors stylesheet.
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

            foreach (static::getAllGroupColor() as $item) {
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

                case 'module':
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

                    break;
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

                if (null !== $item['color'] && ltrim($item['color'], '#')) {
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

                    break;
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

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

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

            $colors = [];
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

        public static function generate($type = 'all')
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

                    static::generateOwners();
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

                case 'picklist':
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

                    static::generatePicklists();
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

        private static function generateOwners()
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

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

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

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

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

         * Generate modules colors stylesheet.
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

        public const EMPTY_COLOR = 'rgba(0,0,0,0.1)';
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

                default:
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

                    $css .= '.ownerCBg_' . $item['id'] . ' { background: ' . $item['color'] . ' !important; font-weight: 500 !important; color: ' . static::getContrast($item['color']) . ' !important;}' . PHP_EOL;
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

    Line exceeds 120 characters; contains 134 characters
    Open

            file_put_contents(ROOT_DIRECTORY . '/app_data/owners_colors.php', '<?php return ' . Utils::varExport($colors) . ';', LOCK_EX);
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

         * Generate stylesheet file.
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

                    break;
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

                    $css .= '.ownerCBr_' . $item['id'] . ' { border-color: ' . $item['color'] . ' !important; }' . PHP_EOL;
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

                if (ltrim($item['color'], '#')) {
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

    Line exceeds 120 characters; contains 210 characters
    Open

                    $css .= '.modCBg_' . $item['module'] . ' { background: ' . $item['color'] . ' !important; font-weight: 500 !important; color: ' . static::getContrast($item['color']) . ' !important;}' . PHP_EOL;
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

                                if (false === strpos($color, '#')) {
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

         * @param mixed  $value
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

                $hash = md5('color' . $fromValue);
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

    Line exceeds 120 characters; contains 124 characters
    Open

            $table = (new Db\Query())->select(['fieldname'])->from('vtiger_field')->where(['fieldid' => $picklistId])->scalar();
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

            foreach (static::getAllModuleColor() as $item) {
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

            foreach (Fields\Picklist::getModules() as $module) {
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

            return '#' . $color;
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

            return empty($value) ? '' : str_replace([' ', '-', '=', '+', '@', '*', '!', '#', '$', '%', '^', '&', '(', ')', '[', ']', '{', '}', ';', ':', "\\'", '"', ',', '<', '.', '>', '/', '?', '\\', '|'], '_', \App\Utils::sanitizeSpecialChars($value));
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

         * Get random color code.
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

         * @return string
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

            if (false !== $fromValue) {
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

            file_put_contents(ROOT_DIRECTORY . '/public_html/layouts/resources/colors/picklists.css', $css, LOCK_EX);
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

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

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

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

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

         * @param string $color
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

                return static::getRandomColor($value);
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

        public static function sanitizeValue($value): string
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

        public static function addPicklistColorColumn($fieldId)
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

            $css = '';
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

        private static function generateModules()
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

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

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

        private static function generatePicklists()
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

            $css = '';
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

                foreach ($fields as $field) {
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

                                $css .= '.picklistCBg_' . $module['tabname'] . '_' . static::sanitizeValue($field->getName()) . '_' . static::sanitizeValue($item['picklistValue']) . ' { background: ' . $color . ' !important; font-weight: 500 !important; color: ' . $contrastColor . ' !important;}' . PHP_EOL;
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

            $color = ltrim($color, "#\t ");
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

         * @return string
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

    Line exceeds 120 characters; contains 250 characters
    Open

            return empty($value) ? '' : str_replace([' ', '-', '=', '+', '@', '*', '!', '#', '$', '%', '^', '&', '(', ')', '[', ']', '{', '}', ';', ':', "\\'", '"', ',', '<', '.', '>', '/', '?', '\\', '|'], '_', \App\Utils::sanitizeSpecialChars($value));
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

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

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

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

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

         * Sanitize value for use in css class name.
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

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

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

            $types = ['picklist', 'multipicklist'];
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

         * Update user color code and generate stylesheet file.
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

            Cache::clear();
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

            $table = (new Db\Query())->select(['fieldname'])->from('vtiger_field')->where(['fieldid' => $fieldId])->scalar();
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

         * Function gives fields based on the module.
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

                                $css .= '.picklistCT_' . $module['tabname'] . '_' . static::sanitizeValue($field->getName()) . '_' . static::sanitizeValue($item['picklistValue']) . ' { color: ' . $color . ' !important; }' . PHP_EOL;
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

    Line exceeds 120 characters; contains 228 characters
    Open

                                $css .= '.picklistCT_' . $module['tabname'] . '_' . static::sanitizeValue($field->getName()) . '_' . static::sanitizeValue($item['picklistValue']) . ' { color: ' . $color . ' !important; }' . PHP_EOL;
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

    Line exceeds 120 characters; contains 330 characters
    Open

                                $css .= '.picklistLb_' . $module['tabname'] . '_' . static::sanitizeValue($field->getName()) . '_' . static::sanitizeValue($item['picklistValue']) . ' { background: ' . $color . ' !important; font-weight: 500 !important; color: ' . $contrastColor . ' !important;  padding: 2px 7px 3px 7px;}' . PHP_EOL;
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

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

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

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

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

        public static function updatePicklistValueColor($picklistId, $picklistValueId, $color)
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

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

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

         * Generate picklists colors stylesheet.
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

                    $values = \App\Fields\Picklist::getValues($field->getName());
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

    Line exceeds 120 characters; contains 304 characters
    Open

                                $css .= '.picklistCBg_' . $module['tabname'] . '_' . static::sanitizeValue($field->getName()) . '_' . static::sanitizeValue($item['picklistValue']) . ' { background: ' . $color . ' !important; font-weight: 500 !important; color: ' . $contrastColor . ' !important;}' . PHP_EOL;
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

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

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

         * @param string $value
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

         * @return Vtiger_Field_Model[] - list of field models
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

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

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

            file_put_contents(ROOT_DIRECTORY . '/public_html/layouts/resources/colors/modules.css', $css, LOCK_EX);
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

                        foreach ($values as $item) {
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

                    $css .= '.modCBg_' . $item['module'] . ' { background: ' . $item['color'] . ' !important; font-weight: 500 !important; color: ' . static::getContrast($item['color']) . ' !important;}' . PHP_EOL;
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

                                $css .= '.picklistLb_' . $module['tabname'] . '_' . static::sanitizeValue($field->getName()) . '_' . static::sanitizeValue($item['picklistValue']) . ' { background: ' . $color . ' !important; font-weight: 500 !important; color: ' . $contrastColor . ' !important;  padding: 2px 7px 3px 7px;}' . PHP_EOL;
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

        public static function get($color, $value)
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

            if (empty($color)) {
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

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

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

         * @param mixed $fromValue
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

            Db::getInstance()->createCommand()->update('vtiger_' . $table, ['color' => ltrim($color, '#')], [Fields\Picklist::getPickListId($table) => $picklistValueId])->execute();
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

            return \Vtiger_Module_Model::getInstance($moduleName)->getFieldsByType($types, true);
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

         * Function to add color column in picklist table.
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

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

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

         * Get all users colors.
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

        public static function getAllUserColor()
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

    Line exceeds 120 characters; contains 236 characters
    Open

                                $css .= '.picklistCBr_' . $module['tabname'] . '_' . static::sanitizeValue($field->getName()) . '_' . static::sanitizeValue($item['picklistValue']) . ' { border-color: ' . $color . ' !important; }' . PHP_EOL;
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

        public static function getRandomColor($fromValue = false)
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

            if (empty($table)) {
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

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

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

            Db::getInstance()->createCommand()->update('vtiger_users', ['cal_color' => $color], ['id' => $id])->execute();
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

                    if ($values && ($firstRow = reset($values)) && \array_key_exists('color', $firstRow)) {
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

         * Get normalized color or generate if empty.
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

         * @param string $color
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

                return static::getRandomColor($value);
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

         * Function to update color for picklist value.
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

            Cache::clear();
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

        public static function updateUserColor($id, $color)
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

                    $css .= '.modCT_' . $item['module'] . ' { color: ' . $item['color'] . '; }' . PHP_EOL;
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

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

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

            if (empty($color)) {
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

    Line exceeds 120 characters; contains 199 characters
    Open

            return '#' . str_pad(dechex(random_int(0, 255)), 2, '0', STR_PAD_LEFT) . str_pad(dechex(random_int(0, 255)), 2, '0', STR_PAD_LEFT) . str_pad(dechex(random_int(0, 255)), 2, '0', STR_PAD_LEFT);
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

            Db::getInstance()->createCommand()->addColumn('vtiger_' . $table, 'color', 'string(25)')->execute();
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

                                    $color = '#' . $color;
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

                                $css .= '.picklistCBr_' . $module['tabname'] . '_' . static::sanitizeValue($field->getName()) . '_' . static::sanitizeValue($item['picklistValue']) . ' { border-color: ' . $color . ' !important; }' . PHP_EOL;
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

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

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

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

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

            $table = (new Db\Query())->select(['fieldname'])->from('vtiger_field')->where(['fieldid' => $picklistId])->scalar();
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

                return;
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

            static::generate('picklist');
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

    Line exceeds 120 characters; contains 121 characters
    Open

            $table = (new Db\Query())->select(['fieldname'])->from('vtiger_field')->where(['fieldid' => $fieldId])->scalar();
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

                    $css .= '.modCrBr_' . $item['module'] . ' { border-color: ' . $item['color'] . '; }' . PHP_EOL;
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

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

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

        public static function getPicklistFieldsByModule($moduleName)
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

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

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

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

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

                return '#' . substr($hash, 0, 2) . substr($hash, 2, 2) . substr($hash, 4, 2);
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

            return '#' . str_pad(dechex(random_int(0, 255)), 2, '0', STR_PAD_LEFT) . str_pad(dechex(random_int(0, 255)), 2, '0', STR_PAD_LEFT) . str_pad(dechex(random_int(0, 255)), 2, '0', STR_PAD_LEFT);
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

                $fields = static::getPicklistFieldsByModule($module['tabname']);
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

                            if (($color = $item['color'] ?? '') && '#' !== $color) {
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

                                $contrastColor = static::getContrast($color);
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

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

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

         * @param string $color
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

    Line exceeds 120 characters; contains 177 characters
    Open

            Db::getInstance()->createCommand()->update('vtiger_' . $table, ['color' => ltrim($color, '#')], [Fields\Picklist::getPickListId($table) => $picklistValueId])->execute();
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

            static::generate('user');
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

         * Get all module color.
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

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

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

         * @param mixed $id
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

    Line exceeds 120 characters; contains 127 characters
    Open

            Db::getInstance()->createCommand()->update('vtiger_tab', ['color' => ltrim($color, '#')], ['tabid' => $id])->execute();
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

            return $color;
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

        public static function updateFieldColor($fieldId, $color): bool
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

                $result = $color === (new \App\Db\Query())->select(['color'])->from('vtiger_field')->where(['fieldid' => $fieldId])->scalar();
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

         * Update group color code and generate stylesheet file.
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

        public static function getAllGroupColor()
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

                    'module' => $module['name'],
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

         * Set module color active flag.
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

         * @param bool   $active
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

            $color = empty($color) && $active ? static::getRandomColor() : $color;
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

                return Cache::get('getAllFilterColors', $byFilterValue);
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

                $filterColors[$viewData[$by]] = $viewData['color'] ?: static::getRandomColor($viewData[$by]);
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

            $query = (new \App\Db\Query())->select(['tabid', 'fieldname', 'color'])->from('vtiger_field')->where(['presence' => [0, 2]])->andWhere(['<>', 'color', '']);
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

    Line exceeds 120 characters; contains 149 characters
    Open

            return (new Db\Query())->select(['id', 'first' => 'first_name', 'last' => 'last_name', 'color' => 'cal_color'])->from('vtiger_users')->all();
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

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

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

        public static function getAllFilterColors($byFilterValue = false)
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

            $css = '';
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

                if (ltrim($row['color'], '#')) {
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

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

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

            $allModules = \vtlib\Functions::getAllModules(false, false, false, $active);
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

         * @param mixed $hexColor
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

            $hexColor = ltrim(ltrim($hexColor), '#');
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

            return $result;
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

            static::generate('group');
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

         * @param bool $active
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

         * @param mixed $color
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

            $by = $byFilterValue ? 'viewname' : 'cvid';
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

                    'active' => $module['coloractive'],
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

        public static function updateModuleColor($id, $color)
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

         * @return string
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

    Line exceeds 120 characters; contains 138 characters
    Open

                $result = $color === (new \App\Db\Query())->select(['color'])->from('vtiger_field')->where(['fieldid' => $fieldId])->scalar();
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

    Line exceeds 120 characters; contains 157 characters
    Open

                    $css .= '.flCT_' . Module::getModuleName($row['tabid']) . '_' . $row['fieldname'] . '{ color: ' . $row['color'] . ' !important; }' . PHP_EOL;
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

         * @param string $color
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

         * Get all filter colors.
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

            $result = Db::getInstance()->createCommand()->update('vtiger_field', ['color' => $color], ['fieldid' => $fieldId])->execute();
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

            return $modules;
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

         * Update field color code and generate stylesheet file.
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

    Line exceeds 120 characters; contains 164 characters
    Open

            $query = (new \App\Db\Query())->select(['tabid', 'fieldname', 'color'])->from('vtiger_field')->where(['presence' => [0, 2]])->andWhere(['<>', 'color', '']);
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

                    'id' => $tabid,
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

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

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

            Db::getInstance()->createCommand()->update('vtiger_tab', ['color' => ltrim($color, '#')], ['tabid' => $id])->execute();
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

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

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

            return $filterColors;
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

         * @return string
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

        public static function getContrast($hexColor)
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

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

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

        public static function updateGroupColor($id, $color)
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

            return (new Db\Query())->select(['id' => 'groupid', 'groupname', 'color'])->from('vtiger_groups')->all();
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

                $modules[] = [
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

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

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

            static::generate('module');
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

                    $css .= '.flCT_' . Module::getModuleName($row['tabid']) . '_' . $row['fieldname'] . '{ color: ' . $row['color'] . ' !important; }' . PHP_EOL;
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

            Cache::clear();
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

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

    Line exceeds 120 characters; contains 179 characters
    Open

            return ((((hexdec(substr($hexColor, 0, 2)) * 299) + (hexdec(substr($hexColor, 2, 2)) * 587) + (hexdec(substr($hexColor, 4, 2)) * 114)) / 1000) >= 128) ? 'black' : 'white';
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

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

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

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

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

            if (Cache::has('getAllFilterColors', $byFilterValue)) {
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

            $customViews = (new Db\Query())->select(['cvid', 'viewname', 'color'])->from('vtiger_customview')->all();
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

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

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

            if (!$result) {
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

            while ($row = $dataReader->read()) {
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

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

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

            foreach ($allModules as $tabid => $module) {
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

            $set = ['coloractive' => (int) $active, 'color' => $active ? ltrim($color, '#') : null];
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

         * @param mixed $byFilterValue
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

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

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

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

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

            static::generate('field');
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

            $dataReader = $query->createCommand()->query();
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

            file_put_contents(ROOT_DIRECTORY . '/public_html/layouts/resources/colors/fields.css', $css, LOCK_EX);
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

            Db::getInstance()->createCommand()->update('vtiger_groups', ['color' => $color], ['groupid' => $id])->execute();
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

        public static function getAllModuleColor($active = false)
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

            $modules = [];
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

                    'color' => '' !== $module['color'] ? '#' . $module['color'] : '',
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

            static::generate('module');
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

            $filterColors = [];
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

            foreach ($customViews as $viewData) {
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

            Cache::save('getAllFilterColors', $byFilterValue, $filterColors);
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

    Line exceeds 120 characters; contains 134 characters
    Open

            $result = Db::getInstance()->createCommand()->update('vtiger_field', ['color' => $color], ['fieldid' => $fieldId])->execute();
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

            return (new Db\Query())->select(['id', 'first' => 'first_name', 'last' => 'last_name', 'color' => 'cal_color'])->from('vtiger_users')->all();
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

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

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

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

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

            Cache::clear();
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

        public static function activeModuleColor($id, $active, $color)
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

            Db::getInstance()->createCommand()->update('vtiger_tab', $set, ['tabid' => $id])->execute();
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

         * Get contrast color.
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

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

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

         * @return bool
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

         * Get all group color.
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

         * Function to update color for module.
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

         * @param string $color
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

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

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

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

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

            return ((((hexdec(substr($hexColor, 0, 2)) * 299) + (hexdec(substr($hexColor, 2, 2)) * 587) + (hexdec(substr($hexColor, 4, 2)) * 114)) / 1000) >= 128) ? 'black' : 'white';
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

         * @param string $color
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

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

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

         * Generate fields colors stylesheet.
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

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

        public static function generateFields()
    Severity: Minor
    Found in app/Colors.php by phpcodesniffer

    There are no issues that match your filters.

    Category
    Status