YetiForceCompany/YetiForceCRM

View on GitHub
modules/Settings/Picklist/models/Field.php

Summary

Maintainability
A
2 hrs
Test Coverage
F
0%

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

    public function getPicklistValuesForRole($roleIdList, $groupMode = 'INTERSECTION')
    {
        if (!$this->isRoleBased()) {
            $fieldModel = new Vtiger_Field_Model();
            return $fieldModel->getPicklistValues();
Severity: Minor
Found in modules/Settings/Picklist/models/Field.php - About 1 hr to fix

    Function getPicklistValuesForRole has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getPicklistValuesForRole($roleIdList, $groupMode = 'INTERSECTION')
        {
            if (!$this->isRoleBased()) {
                $fieldModel = new Vtiger_Field_Model();
                return $fieldModel->getPicklistValues();
    Severity: Minor
    Found in modules/Settings/Picklist/models/Field.php - About 55 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

    Missing class import via use statement (line '54', column '22').
    Open

                $fieldModel = new Vtiger_Field_Model();

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

                throw new \App\Exceptions\AppException(\App\Language::translateArgs('ERR_SPECIAL_CHARACTERS_NOT_ALLOWED', 'Other.Exceptions', '<>"#'), 512);

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

                throw new \App\Exceptions\AppException(\App\Language::translate('ERR_EXCEEDED_NUMBER_CHARACTERS', 'Other.Exceptions'), 512);

    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 '65', column '42').
    Open

                $query->addSelect(['rolecount' => new yii\db\Expression('COUNT(roleid)')]);

    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 validate has a boolean flag argument $id, which is a certain sign of a Single Responsibility Principle violation.
    Open

        public function validate($value, $id = false)

    BooleanArgumentFlag

    Since: 1.4.0

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

    Example

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

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

    Missing class import via use statement (line '144', column '14').
    Open

                throw new \App\Exceptions\AppException(\App\Language::translateArgs('ERR_DUPLICATES_VALUES_FOUND', 'Other.Exceptions', $value), 513);

    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 '63', column '17').
    Open

            $query = (new App\Db\Query())->select(["{$tableName}.{$fieldName}"]);

    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 getInstance has a boolean flag argument $module, which is a certain sign of a Single Responsibility Principle violation.
    Open

        public static function getInstance($value, $module = false)

    BooleanArgumentFlag

    Since: 1.4.0

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

    Example

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

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

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

                throw new \App\Exceptions\AppException(\App\Language::translate('ERR_EXCEEDED_NUMBER_CHARACTERS', 'Other.Exceptions'), 512);

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

            } else {
                $nonEditablePickListValues = ['duration_minutes', 'payment_duration', 'recurring_frequency', 'visibility'];
                $permissions = \in_array($this->get('displaytype'), [1, 10]) && \in_array($this->get('presence'), [0, 2]) && !\in_array($this->getName(), $nonEditablePickListValues) && \in_array($this->getFieldDataType(), ['picklist', 'multipicklist']) && 'Users' !== $this->getModuleName();
            }

    ElseExpression

    Since: 1.4.0

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

    Example

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

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

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

            return \App\Fields\Picklist\Item::getInstance($this, $itemId);

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

                $pickListValues[] = \App\Purifier::decodeHtml(\App\Purifier::decodeHtml($row[$fieldName]));

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

                throw new \App\Exceptions\AppException(\App\Language::translateArgs('ERR_SPECIAL_CHARACTERS_NOT_ALLOWED', 'Other.Exceptions', '<>"#'), 512);

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

                throw new \App\Exceptions\AppException(\App\Language::translateArgs('ERR_DUPLICATES_VALUES_FOUND', 'Other.Exceptions', $value), 513);

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

                $pickListValues[] = \App\Purifier::decodeHtml(\App\Purifier::decodeHtml($row[$fieldName]));

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

            $picklistValues = \App\Fields\Picklist::getValuesName($this->getName());

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

                throw new \App\Exceptions\AppException(\App\Language::translateArgs('ERR_SPECIAL_CHARACTERS_NOT_ALLOWED', 'Other.Exceptions', '<>"#'), 512);

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

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

    Noncompliant Code Example

    With the default threshold of 3:

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

    Compliant Solution

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

    Exceptions

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

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

            $query = (new App\Db\Query())->select(["{$tableName}.{$fieldName}"]);
    Severity: Critical
    Found in modules/Settings/Picklist/models/Field.php by phan

    Return type of getItemModel() is undeclared type \App\Fields\Picklist\Item
    Open

        public function getItemModel(?int $itemId = null): App\Fields\Picklist\Item

    Call to method __construct from undeclared class \yii\db\Expression
    Open

                $query->addSelect(['rolecount' => new yii\db\Expression('COUNT(roleid)')]);
    Severity: Critical
    Found in modules/Settings/Picklist/models/Field.php by phan

    Return type of getPicklistValuesForRole() is undeclared type \type
    Open

        public function getPicklistValuesForRole($roleIdList, $groupMode = 'INTERSECTION')

    Returning type array{}|string[] but getPicklistValuesForRole() is declared to return \type
    Open

                return $fieldModel->getPicklistValues();

    Returning type array<int>|array{}</int> but getPicklistValuesForRole() is declared to return \type
    Open

            return $pickListValues;

    Parameter $roleIdList has undeclared type \type
    Open

        public function getPicklistValuesForRole($roleIdList, $groupMode = 'INTERSECTION')

    Returning type false but getInstance() is declared to return \Settings_Picklist_Field_Model
    Open

            return false;

    Default value for \type $groupMode can't be string
    Open

        public function getPicklistValuesForRole($roleIdList, $groupMode = 'INTERSECTION')

    Call to method getInstance from undeclared class \App\Fields\Picklist\Item
    Open

            return \App\Fields\Picklist\Item::getInstance($this, $itemId);
    Severity: Critical
    Found in modules/Settings/Picklist/models/Field.php by phan

    Argument 1 (var) is \type but \count() takes \Countable|array
    Open

                if ($intersectionMode && (int) $row['rolecount'] !== \count($roleIdList)) {

    Reference to undeclared property \Settings_Picklist_Field_Model->validator
    Open

            return $this->validator ?? parent::getValidator();

    Default value for int $id can't be false
    Open

        public function validate($value, $id = false)

    Parameter $groupMode has undeclared type \type
    Open

        public function getPicklistValuesForRole($roleIdList, $groupMode = 'INTERSECTION')

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

                $nonEditablePickListValues = ['duration_minutes', 'payment_duration', 'recurring_frequency', 'visibility'];

    LongVariable

    Since: 0.2

    Detects when a field, formal or local variable is declared with a long name.

    Example

    class Something {
        protected $reallyLongIntName = -3; // VIOLATION - Field
        public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
            $otherReallyLongName = -5; // VIOLATION - Local
            for ($interestingIntIndex = 0; // VIOLATION - For
                 $interestingIntIndex < 10;
                 $interestingIntIndex++ ) {
            }
        }
    }

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

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

    class Settings_Picklist_Field_Model extends Settings_Vtiger_Field_Model

    The class Settings_Picklist_Field_Model is not named in CamelCase.
    Open

    class Settings_Picklist_Field_Model extends Settings_Vtiger_Field_Model
    {
        /**
         * Function to check whether the current field is editable.
         *

    CamelCaseClassName

    Since: 0.2

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

    Example

    class class_name {
    }

    Source

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

        public function validate($value, $id = false)

    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 function isDuplicateValue(string $value, ?int $id = null): bool

    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

        /**

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

            $fieldName = $this->getName();

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

            if ($intersectionMode) {

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

                $query->addSelect(['rolecount' => new yii\db\Expression('COUNT(roleid)')]);

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

         */

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

        public function getValidator()

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

         * @param string $value

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

        {

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

         * Check if picklist value exists.

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

         * Function to check whether the current field is editable.

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

        public function getItemModel(?int $itemId = null): App\Fields\Picklist\Item

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

         *

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

            $query = (new App\Db\Query())->select(["{$tableName}.{$fieldName}"]);

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

            if ($intersectionMode) {

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

            $dataReader->close();

    Line exceeds 120 characters; contains 152 characters
    Open

                throw new \App\Exceptions\AppException(\App\Language::translateArgs('ERR_SPECIAL_CHARACTERS_NOT_ALLOWED', 'Other.Exceptions', '<>"#'), 512);

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

         *

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

        {

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

        }

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

            $query->from('vtiger_role2picklist')

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

        /**

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

         * @param Settings_Picklist_Module_Model|Vtiger_Module_Model|bool $module module instance

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

            }

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

        public static function getInstanceFromFieldObject(vtlib\Field $fieldObj)

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

        public function isDuplicateValue(string $value, ?int $id = null): bool

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

         *

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

            } else {

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

            if (!$this->isRoleBased()) {

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

                $pickListValues[] = \App\Purifier::decodeHtml(\App\Purifier::decodeHtml($row[$fieldName]));

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

        public static function getInstance($value, $module = false)

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

         *

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

            $fieldModel = new self();

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

        /**

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

         * @param type $groupMode  -- Intersection/Conjuction , intersection will give only picklist values that exist for all roles

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

         *

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

            }

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

         * Function to get instance.

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

         *

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

        {

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

        {

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

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

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

            return $fieldModel;

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

            return $this->validator ?? parent::getValidator();

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

                throw new \App\Exceptions\AppException(\App\Language::translateArgs('ERR_DUPLICATES_VALUES_FOUND', 'Other.Exceptions', $value), 513);

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

        /**

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

         * @param int|null $id

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

            if ($this->get('sourceFieldModel')) {

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

                $permissions = \in_array($this->get('displaytype'), [1, 10]) && \in_array($this->get('presence'), [0, 2]) && !\in_array($this->getName(), $nonEditablePickListValues) && \in_array($this->getFieldDataType(), ['picklist', 'multipicklist']) && 'Users' !== $this->getModuleName();

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

         * Get picklist value model.

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

        /**

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

                ->where(['vtiger_role2picklist.roleid' => $roleIdList])->orderBy(['vtiger_role2picklist.sortid' => SORT_ASC]);

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

            $dataReader = $query->createCommand()->query();

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

        }

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

            if ($this->getMaxValue() && \strlen($value) > $this->getMaxValue()) {

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

         *

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

         */

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

            $picklistValues = \App\Fields\Picklist::getValuesName($this->getName());

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

        public function getPicklistValuesForRole($roleIdList, $groupMode = 'INTERSECTION')

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

            }

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

                //second not equal if specify that the picklistvalue is not present for all the roles

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

                    continue;

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

        /**

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

        }

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

         *

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

                throw new \App\Exceptions\AppException(\App\Language::translate('ERR_EXCEEDED_NUMBER_CHARACTERS', 'Other.Exceptions'), 512);

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

            }

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

                $nonEditablePickListValues = ['duration_minutes', 'payment_duration', 'recurring_frequency', 'visibility'];

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

         * @param int|null $itemId

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

            return \App\Fields\Picklist\Item::getInstance($this, $itemId);

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

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

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

         *

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

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

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

         * @param int    $id

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

        public function validate($value, $id = false)

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

            }

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

            return \in_array(strtolower($value), array_map('strtolower', $picklistValues));

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

         */

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

        public function isEditable(): bool

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

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

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

         * @return App\Fields\Picklist\Item

    Line exceeds 120 characters; contains 128 characters
    Open

         * @param type $groupMode  -- Intersection/Conjuction , intersection will give only picklist values that exist for all roles

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

                $intersectionMode = true;

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

        /**

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

            }

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

            }

    Line exceeds 120 characters; contains 145 characters
    Open

                throw new \App\Exceptions\AppException(\App\Language::translateArgs('ERR_DUPLICATES_VALUES_FOUND', 'Other.Exceptions', $value), 513);

    Line exceeds 120 characters; contains 287 characters
    Open

                $permissions = \in_array($this->get('displaytype'), [1, 10]) && \in_array($this->get('presence'), [0, 2]) && !\in_array($this->getName(), $nonEditablePickListValues) && \in_array($this->getFieldDataType(), ['picklist', 'multipicklist']) && 'Users' !== $this->getModuleName();

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

            }

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

        }

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

         */

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

                return $fieldModel->getPicklistValues();

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

                }

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

            if ($fieldObject) {

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

         * Static Function to get the instance fo Vtiger Field Model from a given vtlib\Field object.

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

         * @return Vtiger_Field_Model instance

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

         */

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

            }

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

         *

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

        }

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

            return $permissions;

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

         *

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

            if ('INTERSECTION' == $groupMode) {

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

            }

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

        }

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

         * @param string|int                                              $value  fieldname or fieldid

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

                return self::getInstanceFromFieldObject($fieldObject);

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

         * @return bool

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

         * @return bool

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

         * @param type $roleIdList -- array of role ids

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

            $intersectionMode = false;

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

                //Need to decode the picklist values twice which are saved from old ui

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

            }

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

        {

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

         */

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

            if (preg_match('/[\<\>\"\#]/', $value)) {

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

        }

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

        {

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

        {

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

                $fieldModel = new Vtiger_Field_Model();

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

            $tableName = 'vtiger_' . $fieldName;

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

                if ($intersectionMode && (int) $row['rolecount'] !== \count($roleIdList)) {

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

         * @throws Exception

    Line exceeds 120 characters; contains 136 characters
    Open

                throw new \App\Exceptions\AppException(\App\Language::translate('ERR_EXCEEDED_NUMBER_CHARACTERS', 'Other.Exceptions'), 512);

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

            if ($this->isDuplicateValue($value, $id)) {

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

         * @param string   $value

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

         * Function which will give the picklistvalues for given roleids.

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

         */

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

            }

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

                $query->groupBy(['picklistvalueid']);

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

            return $pickListValues;

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

         * Verification of data.

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

                throw new \App\Exceptions\AppException(\App\Language::translateArgs('ERR_SPECIAL_CHARACTERS_NOT_ALLOWED', 'Other.Exceptions', '<>"#'), 512);

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

            if ($id) {

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

                unset($picklistValues[$id]);

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

         * @return type -- array

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

            $pickListValues = [];

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

            $fieldObject = parent::getInstance($value, $module);

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

            return false;

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

         * @param vtlib\Field $fieldObj - vtlib field object

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

            $objectProperties = get_object_vars($fieldObj);

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

        {

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

         *

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

                ->innerJoin($tableName, "vtiger_role2picklist.picklistvalueid = {$tableName}.picklist_valueid")

    Line exceeds 120 characters; contains 122 characters
    Open

                ->where(['vtiger_role2picklist.roleid' => $roleIdList])->orderBy(['vtiger_role2picklist.sortid' => SORT_ASC]);

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

         * @return self

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

        }

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

         *

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

        /** {@inheritdoc} */

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

    class Settings_Picklist_Field_Model extends Settings_Vtiger_Field_Model

    There are no issues that match your filters.

    Category
    Status