YetiForceCompany/YetiForceCRM

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

Summary

Maintainability
D
1 day
Test Coverage
F
0%

Function getRecords has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    public function getRecords($user)
    {
        $this->initListViewController();
        if (!$user) {
            $user = App\User::getCurrentUserId();
Severity: Minor
Found in modules/Vtiger/models/MiniList.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

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

class Vtiger_MiniList_Model extends Vtiger_Widget_Model
{
    protected $widgetModel;
    protected $extraData;
    protected $queryGenerator;
Severity: Minor
Found in modules/Vtiger/models/MiniList.php by phpmd

Method getRecords has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getRecords($user)
    {
        $this->initListViewController();
        if (!$user) {
            $user = App\User::getCurrentUserId();
Severity: Minor
Found in modules/Vtiger/models/MiniList.php - About 1 hr to fix

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

        public function getTargetFields($extraField = false)
        {
            $fields = $this->extraData['fields'];
            $moduleName = $this->getTargetModule();
            if (!\in_array('id', $fields)) {
    Severity: Minor
    Found in modules/Vtiger/models/MiniList.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 getHeaders has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getHeaders()
        {
            $this->initListViewController();
            if (!$this->listviewHeaders) {
                foreach ($this->getTargetFields() as $fieldName) {
    Severity: Minor
    Found in modules/Vtiger/models/MiniList.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 getTotalCountURL has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getTotalCountURL($user = false)
        {
            $url = 'index.php?module=' . $this->getTargetModule() . '&action=Pagination&mode=getTotalCount&viewname=' . $this->widgetModel->get('filterid');
            if (!$user) {
                $user = App\User::getCurrentUserId();
    Severity: Minor
    Found in modules/Vtiger/models/MiniList.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

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

        public function getListViewURL($user = false)
        {
            $url = 'index.php?module=' . $this->getTargetModule() . '&view=List&viewname=' . $this->widgetModel->get('filterid');
            if (!$user) {
                $user = App\User::getCurrentUserId();
    Severity: Minor
    Found in modules/Vtiger/models/MiniList.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 getRecords() has an NPath complexity of 267. The configured NPath complexity threshold is 200.
    Open

        public function getRecords($user)
        {
            $this->initListViewController();
            if (!$user) {
                $user = App\User::getCurrentUserId();
    Severity: Minor
    Found in modules/Vtiger/models/MiniList.php by phpmd

    NPathComplexity

    Since: 0.1

    The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

    Example

    class Foo {
        function bar() {
            // lots of complicated code
        }
    }

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

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

        public function getTargetFields($extraField = false)
        {
            $fields = $this->extraData['fields'];
            $moduleName = $this->getTargetModule();
            if (!\in_array('id', $fields)) {
    Severity: Minor
    Found in modules/Vtiger/models/MiniList.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

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

        public function getRecords($user)
        {
            $this->initListViewController();
            if (!$user) {
                $user = App\User::getCurrentUserId();
    Severity: Minor
    Found in modules/Vtiger/models/MiniList.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 26 to the 15 allowed.
    Open

        public function getRecords($user)
    Severity: Critical
    Found in modules/Vtiger/models/MiniList.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

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

        public function getTargetFields($extraField = false)
    Severity: Minor
    Found in modules/Vtiger/models/MiniList.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

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

                $this->queryGenerator = new \App\QueryGenerator($this->getTargetModule());
    Severity: Minor
    Found in modules/Vtiger/models/MiniList.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 '38', column '14').
    Open

                throw new \App\Exceptions\AppException('Invalid data');
    Severity: Minor
    Found in modules/Vtiger/models/MiniList.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 getTotalCountURL has a boolean flag argument $user, which is a certain sign of a Single Responsibility Principle violation.
    Open

        public function getTotalCountURL($user = false)
    Severity: Minor
    Found in modules/Vtiger/models/MiniList.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 getListViewURL has a boolean flag argument $user, which is a certain sign of a Single Responsibility Principle violation.
    Open

        public function getListViewURL($user = false)
    Severity: Minor
    Found in modules/Vtiger/models/MiniList.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\CustomView' in method 'getTitle'.
    Open

    }
    Severity: Minor
    Found in modules/Vtiger/models/MiniList.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\Json' in method 'setWidgetModel'.
    Open

                $this->extraData = \App\Json::decode(App\Purifier::decodeHtml($this->extraData));
    Severity: Minor
    Found in modules/Vtiger/models/MiniList.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 '66', column '45').
    Open

        public function getTargetFields($extraField = false)
        {
            $fields = $this->extraData['fields'];
            $moduleName = $this->getTargetModule();
            if (!\in_array('id', $fields)) {
    Severity: Minor
    Found in modules/Vtiger/models/MiniList.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 'Vtiger_Module_Model' in method 'getTargetModuleModel'.
    Open

                $this->targetModuleModel = Vtiger_Module_Model::getInstance($this->getTargetModule());
    Severity: Minor
    Found in modules/Vtiger/models/MiniList.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\User' in method 'getRecords'.
    Open

                $user = App\User::getCurrentUserId();
    Severity: Minor
    Found in modules/Vtiger/models/MiniList.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 'CustomView_Record_Model' in method 'getRecords'.
    Open

                $filterModel = CustomView_Record_Model::getInstanceById($this->widgetModel->get('filterid'));
    Severity: Minor
    Found in modules/Vtiger/models/MiniList.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\Purifier' in method 'setWidgetModel'.
    Open

                $this->extraData = \App\Json::decode(App\Purifier::decodeHtml($this->extraData));
    Severity: Minor
    Found in modules/Vtiger/models/MiniList.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\Log' in method 'getHeaders'.
    Open

                        \App\Log::warning('Field not found:' . $fieldName . ' | Module: ' . $this->getTargetModuleModel()->getName(), __METHOD__);
    Severity: Minor
    Found in modules/Vtiger/models/MiniList.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 'CRMEntity' in method 'getRecords'.
    Open

                $targetModuleFocus = CRMEntity::getInstance($targetModuleName);
    Severity: Minor
    Found in modules/Vtiger/models/MiniList.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 '116', column '33').
    Open

        public function getHeaders()
        {
            $this->initListViewController();
            if (!$this->listviewHeaders) {
                foreach ($this->getTargetFields() as $fieldName) {
    Severity: Minor
    Found in modules/Vtiger/models/MiniList.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\User' in method 'getListViewURL'.
    Open

                $user = App\User::getCurrentUserId();
    Severity: Minor
    Found in modules/Vtiger/models/MiniList.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

                    $suffix = ' - ' . \App\Language::translate($viewName, $this->getTargetModule());
    Severity: Minor
    Found in modules/Vtiger/models/MiniList.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

                return $prefix . \App\Language::translate($this->getTargetModuleModel()->label, $this->getTargetModule()) . $suffix;
    Severity: Minor
    Found in modules/Vtiger/models/MiniList.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 '156', column '25').
    Open

        public function getRecords($user)
        {
            $this->initListViewController();
            if (!$user) {
                $user = App\User::getCurrentUserId();
    Severity: Minor
    Found in modules/Vtiger/models/MiniList.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\User' in method 'getTotalCountURL'.
    Open

                $user = App\User::getCurrentUserId();
    Severity: Minor
    Found in modules/Vtiger/models/MiniList.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 '69', column '42').
    Open

        public function getTargetFields($extraField = false)
        {
            $fields = $this->extraData['fields'];
            $moduleName = $this->getTargetModule();
            if (!\in_array('id', $fields)) {
    Severity: Minor
    Found in modules/Vtiger/models/MiniList.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

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

                    } else {
                        \App\Log::warning('Field not found:' . $fieldName . ' | Module: ' . $this->getTargetModuleModel()->getName(), __METHOD__);
                    }
    Severity: Minor
    Found in modules/Vtiger/models/MiniList.php by phpmd

    ElseExpression

    Since: 1.4.0

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

    Example

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

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

    Define a constant instead of duplicating this literal "filterid" 5 times.
    Open

                $this->queryGenerator->initForCustomViewById($this->widgetModel->get('filterid'));
    Severity: Critical
    Found in modules/Vtiger/models/MiniList.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 "assigned_user_id" 3 times.
    Open

                    $this->queryGenerator->addCondition('assigned_user_id', $user, 'e');
    Severity: Critical
    Found in modules/Vtiger/models/MiniList.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.

    Call to method createQuery from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
    Open

                $query = $this->queryGenerator->createQuery();
    Severity: Critical
    Found in modules/Vtiger/models/MiniList.php by phan

    Suspicious array access to null
    Open

                    $this->listviewRecords[$row['id']] = $this->getTargetModuleModel()->getRecordFromArray($row);
    Severity: Minor
    Found in modules/Vtiger/models/MiniList.php by phan

    Call to method setFields from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
    Open

                $this->queryGenerator->setFields($this->getTargetFields(true));
    Severity: Critical
    Found in modules/Vtiger/models/MiniList.php by phan

    Call to undeclared method \Vtiger_MiniListModel_Dashboard::get
    Open

            return $this->widgetModel->get('limit');
    Severity: Critical
    Found in modules/Vtiger/models/MiniList.php by phan

    Call to undeclared method \Vtiger_MiniListModel_Dashboard::get
    Open

            $url = 'index.php?module=' . $this->getTargetModule() . '&view=List&viewname=' . $this->widgetModel->get('filterid');
    Severity: Critical
    Found in modules/Vtiger/models/MiniList.php by phan

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

            return \count($this->getHeaders());
    Severity: Minor
    Found in modules/Vtiger/models/MiniList.php by phan

    Assigning \Vtiger_Field_Model[] to property but \Vtiger_MiniList_Model->listviewHeaders is null
    Open

                        $this->listviewHeaders[$fieldName] = $fieldModel;
    Severity: Minor
    Found in modules/Vtiger/models/MiniList.php by phan

    Call to method parseBaseSearchParamsToCondition from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
    Open

                    $searchParamsCondition = $this->queryGenerator->parseBaseSearchParamsToCondition($this->searchParams);
    Severity: Critical
    Found in modules/Vtiger/models/MiniList.php by phan

    Call to method parseAdvFilter from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
    Open

                    $this->queryGenerator->parseAdvFilter($searchParamsCondition);
    Severity: Critical
    Found in modules/Vtiger/models/MiniList.php by phan

    Reference to undeclared property \CRMEntity->default_order_by
    Open

                    foreach ((array) $targetModuleFocus->default_order_by as $value) {
    Severity: Minor
    Found in modules/Vtiger/models/MiniList.php by phan

    Call to undeclared method \Vtiger_MiniListModel_Dashboard::get
    Open

            $url = 'index.php?module=' . $this->getTargetModule() . '&action=Pagination&mode=getTotalCount&viewname=' . $this->widgetModel->get('filterid');
    Severity: Critical
    Found in modules/Vtiger/models/MiniList.php by phan

    Call to undeclared method \Vtiger_MiniListModel_Dashboard::get
    Open

                $this->queryGenerator->initForCustomViewById($this->widgetModel->get('filterid'));
    Severity: Critical
    Found in modules/Vtiger/models/MiniList.php by phan

    Class extends undeclared class \Vtiger_Widget_Model
    Open

    class Vtiger_MiniList_Model extends Vtiger_Widget_Model
    Severity: Critical
    Found in modules/Vtiger/models/MiniList.php by phan

    Call to method getCurrentUserId from undeclared class \App\User (Did you mean class \Tests\App\User)
    Open

                $user = App\User::getCurrentUserId();
    Severity: Critical
    Found in modules/Vtiger/models/MiniList.php by phan

    Call to method getModuleModel from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
    Open

                    $fields = $this->queryGenerator->getModuleModel()->getFields();
    Severity: Critical
    Found in modules/Vtiger/models/MiniList.php by phan

    Call to method setOrder from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
    Open

                            $this->queryGenerator->setOrder($fieldName, $sortFlag);
    Severity: Critical
    Found in modules/Vtiger/models/MiniList.php by phan

    Call to undeclared method \Vtiger_MiniListModel_Dashboard::get
    Open

            $this->extraData = $this->widgetModel->get('data');
    Severity: Critical
    Found in modules/Vtiger/models/MiniList.php by phan

    Call to undeclared method \Vtiger_MiniListModel_Dashboard::get
    Open

                $cvId = (int) $this->widgetModel->get('filterid');
    Severity: Critical
    Found in modules/Vtiger/models/MiniList.php by phan

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

                        \App\Log::warning('Field not found:' . $fieldName . ' | Module: ' . $this->getTargetModuleModel()->getName(), __METHOD__);
    Severity: Critical
    Found in modules/Vtiger/models/MiniList.php by phan

    Assigning array{} to property but \Vtiger_MiniList_Model->listviewRecords is null
    Open

                $this->listviewRecords = [];
    Severity: Minor
    Found in modules/Vtiger/models/MiniList.php by phan

    Assigning \Vtiger_Record_Model[] to property but \Vtiger_MiniList_Model->listviewRecords is null
    Open

                    $this->listviewRecords[$row['id']] = $this->getTargetModuleModel()->getRecordFromArray($row);
    Severity: Minor
    Found in modules/Vtiger/models/MiniList.php by phan

    Suspicious type false of a variable or expression used to build a string. (Expected type to be able to cast to a string)
    Open

                        \App\Log::warning('Field not found:' . $fieldName . ' | Module: ' . $this->getTargetModuleModel()->getName(), __METHOD__);
    Severity: Minor
    Found in modules/Vtiger/models/MiniList.php by phan

    Reference to undeclared property \CRMEntity->default_order_by
    Open

                } elseif ($targetModuleFocus->default_order_by && $targetModuleFocus->default_sort_order) {
    Severity: Minor
    Found in modules/Vtiger/models/MiniList.php by phan

    Call to undeclared method \Vtiger_MiniListModel_Dashboard::get
    Open

            $title = $this->widgetModel->get('title');
    Severity: Critical
    Found in modules/Vtiger/models/MiniList.php by phan

    Call to method setOrder from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
    Open

                        $this->queryGenerator->setOrder($value, $targetModuleFocus->default_sort_order);
    Severity: Critical
    Found in modules/Vtiger/models/MiniList.php by phan

    Reference to undeclared property \CRMEntity->default_sort_order
    Open

                        $this->queryGenerator->setOrder($value, $targetModuleFocus->default_sort_order);
    Severity: Minor
    Found in modules/Vtiger/models/MiniList.php by phan

    Call to method __construct from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
    Open

                $this->queryGenerator = new \App\QueryGenerator($this->getTargetModule());
    Severity: Critical
    Found in modules/Vtiger/models/MiniList.php by phan

    Call to method initForCustomViewById from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
    Open

                $this->queryGenerator->initForCustomViewById($this->widgetModel->get('filterid'));
    Severity: Critical
    Found in modules/Vtiger/models/MiniList.php by phan

    Call to method addCondition from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
    Open

                    $this->queryGenerator->addCondition('assigned_user_id', $user, 'e');
    Severity: Critical
    Found in modules/Vtiger/models/MiniList.php by phan

    Call to method setRelatedOrder from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
    Open

                            $this->queryGenerator->setRelatedOrder([
    Severity: Critical
    Found in modules/Vtiger/models/MiniList.php by phan

    Reference to undeclared property \CRMEntity->default_sort_order
    Open

                } elseif ($targetModuleFocus->default_order_by && $targetModuleFocus->default_sort_order) {
    Severity: Minor
    Found in modules/Vtiger/models/MiniList.php by phan

    Call to method getCurrentUserId from undeclared class \App\User (Did you mean class \Tests\App\User)
    Open

                $user = App\User::getCurrentUserId();
    Severity: Critical
    Found in modules/Vtiger/models/MiniList.php by phan

    Argument 1 (key) is false but \App\Language::translate() takes string defined at /code/app/Language.php:161
    Open

                return $prefix . \App\Language::translate($this->getTargetModuleModel()->label, $this->getTargetModule()) . $suffix;
    Severity: Minor
    Found in modules/Vtiger/models/MiniList.php by phan

    Suspicious array access to null
    Open

                        $this->listviewHeaders[$fieldName] = $fieldModel;
    Severity: Minor
    Found in modules/Vtiger/models/MiniList.php by phan

    Call to undeclared method \Vtiger_MiniListModel_Dashboard::get
    Open

                $filterModel = CustomView_Record_Model::getInstanceById($this->widgetModel->get('filterid'));
    Severity: Critical
    Found in modules/Vtiger/models/MiniList.php by phan

    Call to method getCurrentUserId from undeclared class \App\User (Did you mean class \Tests\App\User)
    Open

                $user = App\User::getCurrentUserId();
    Severity: Critical
    Found in modules/Vtiger/models/MiniList.php by phan

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

        public function getListViewURL($user = false)
        {
            $url = 'index.php?module=' . $this->getTargetModule() . '&view=List&viewname=' . $this->widgetModel->get('filterid');
            if (!$user) {
                $user = App\User::getCurrentUserId();
    Severity: Major
    Found in modules/Vtiger/models/MiniList.php and 1 other location - About 4 hrs to fix
    modules/Vtiger/models/MiniList.php on lines 194..213

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

    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

        public function getTotalCountURL($user = false)
        {
            $url = 'index.php?module=' . $this->getTargetModule() . '&action=Pagination&mode=getTotalCount&viewname=' . $this->widgetModel->get('filterid');
            if (!$user) {
                $user = App\User::getCurrentUserId();
    Severity: Major
    Found in modules/Vtiger/models/MiniList.php and 1 other location - About 4 hrs to fix
    modules/Vtiger/models/MiniList.php on lines 222..241

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

    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 excessively long variable names like $searchParamsCondition. Keep variable name length under 20.
    Open

                    $searchParamsCondition = $this->queryGenerator->parseBaseSearchParamsToCondition($this->searchParams);
    Severity: Minor
    Found in modules/Vtiger/models/MiniList.php by phpmd

    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 Vtiger_MiniList_Model extends Vtiger_Widget_Model

    The class Vtiger_MiniList_Model is not named in CamelCase.
    Open

    class Vtiger_MiniList_Model extends Vtiger_Widget_Model
    {
        protected $widgetModel;
        protected $extraData;
        protected $queryGenerator;
    Severity: Minor
    Found in modules/Vtiger/models/MiniList.php by phpmd

    CamelCaseClassName

    Since: 0.2

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

    Example

    class class_name {
    }

    Source

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

        protected $queryGenerator;

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

        protected $extraData;

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

        protected $listviewHeaders;

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

            }

    Line exceeds 120 characters; contains 174 characters
    Open

                if (\in_array('date_start', $fields) && ($fieldModel = $moduleModel->getFieldByName('time_start')) && $fieldModel->isActiveField() && $fieldModel->isViewable()) {

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

        public function getTargetModuleModel()

    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

            $title = $this->widgetModel->get('title');

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

            return $title;

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

        {

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

                $targetModuleFocus = CRMEntity::getInstance($targetModuleName);

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

                                'relatedSortOrder' => $sortFlag,

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

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

                $user = App\User::getCurrentUserId();

    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, $moduleName, $sourceFieldName] = array_pad(explode(':', $fieldName), 3, false);

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

                            $this->queryGenerator->setRelatedOrder([

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

                    }

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

            // Decode data if not done already.

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

            if (null === $this->extraData) {

    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 getTargetFields($extraField = false)

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

            $this->initListViewController();

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

                $suffix = '';

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

                foreach ($this->getTargetFields() as $fieldName) {

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

            $this->initListViewController();

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

                if (!empty($user)) {

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

                            $this->queryGenerator->setOrder($fieldName, $sortFlag);

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

                } elseif ($targetModuleFocus->default_order_by && $targetModuleFocus->default_sort_order) {

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

        protected $targetModuleModel;

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

        protected function initListViewController()

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

                        \App\Log::warning('Field not found:' . $fieldName . ' | Module: ' . $this->getTargetModuleModel()->getName(), __METHOD__);

    Line exceeds 120 characters; contains 142 characters
    Open

                        \App\Log::warning('Field not found:' . $fieldName . ' | Module: ' . $this->getTargetModuleModel()->getName(), __METHOD__);

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

                    }

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

            return \count($this->getHeaders());

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

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

                }

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

        protected $widgetModel;

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

         * @var array

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

         * Set search condition.

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

                }

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

                $this->targetModuleModel = Vtiger_Module_Model::getInstance($this->getTargetModule());

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

            return $this->targetModuleModel;

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

                if ($viewName) {

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

                return $prefix . \App\Language::translate($this->getTargetModuleModel()->label, $this->getTargetModule()) . $suffix;

    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 ($sourceFieldName && isset($fields[$sourceFieldName])) {

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

                        } elseif (isset($fields[$fieldName])) {

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

        /**

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

            }

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

            $moduleName = $this->getTargetModule();

    Line exceeds 120 characters; contains 169 characters
    Open

                if (\in_array('due_end', $fields) && ($fieldModel = $moduleModel->getFieldByName('time_end')) && $fieldModel->isActiveField() && $fieldModel->isViewable()) {

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

                $this->listviewHeaders = $this->listviewRecords = null;

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

        public function getTitle($prefix = '')

    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

         * @param array $searchParams

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

                if (\in_array('due_end', $fields) && ($fieldModel = $moduleModel->getFieldByName('time_end')) && $fieldModel->isActiveField() && $fieldModel->isViewable()) {

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

                $this->queryGenerator->setFields($this->getTargetFields(true));

    Line exceeds 120 characters; contains 128 characters
    Open

                return $prefix . \App\Language::translate($this->getTargetModuleModel()->label, $this->getTargetModule()) . $suffix;

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

        public function getHeaders()

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

        public function getRecords($user)

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

                    $this->queryGenerator->addCondition('assigned_user_id', $user, 'e');

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

                $targetModuleName = $this->getTargetModule();

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

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

                $moduleModel = $this->getTargetModuleModel();

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

            if (empty($title)) {

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

                    $suffix = ' - ' . \App\Language::translate($viewName, $this->getTargetModule());

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

            }

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

            return $this->widgetModel->get('limit');

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

                $user = '';

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

                                'relatedModule' => $moduleName,

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

                    }

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

        public function setWidgetModel($widgetModel)

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

            $this->widgetModel = $widgetModel;

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

            }

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

                    $fields[] = 'time_end';

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

            }

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

            return $this->listviewHeaders;

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

        public function getRecordLimit()

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

                $this->listviewRecords = [];

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

            $this->extraData = $this->widgetModel->get('data');

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

         *

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

            $fields = $this->extraData['fields'];

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

            if (!\in_array('id', $fields)) {

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

                if (\in_array('date_start', $fields) && ($fieldModel = $moduleModel->getFieldByName('time_start')) && $fieldModel->isActiveField() && $fieldModel->isViewable()) {

    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 ('id' !== $fieldName && ($fieldModel = $this->getTargetModuleModel()->getFieldByName($fieldName))) {

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

                        $this->listviewHeaders[$fieldName] = $fieldModel;

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

                if (!empty($this->searchParams)) {

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

                    $this->queryGenerator->parseAdvFilter($searchParamsCondition);

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

                $filterModel = CustomView_Record_Model::getInstanceById($this->widgetModel->get('filterid'));

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

                                'sourceField' => $sourceFieldName,

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

                $this->extraData = \App\Json::decode(App\Purifier::decodeHtml($this->extraData));

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

        {

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

                    $fields[] = 'time_start';

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

                }

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

            $this->initListViewController();

    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->limit($this->getRecordLimit());

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

                $fields[] = 'id';

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

                $cvId = (int) $this->widgetModel->get('filterid');

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

                    } else {

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

            }

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

            if (!$this->listviewRecords) {

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

                    $fields = $this->queryGenerator->getModuleModel()->getFields();

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

                throw new \App\Exceptions\AppException('Invalid data');

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

        {

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

            }

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

            if (!$this->listviewHeaders) {

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

        {

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

         * Search condition.

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

         *

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

         */

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

        public function setSearchParams($searchParams)

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

        }

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

        }

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

        public function getHeaderCount()

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

                    foreach ($orderBy as $fieldName => $sortFlag) {

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

                        $this->queryGenerator->setOrder($value, $targetModuleFocus->default_sort_order);

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

            if (\is_string($this->extraData)) {

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

            if ('Calendar' === $moduleName && $extraField) {

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

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

                $this->queryGenerator->initForCustomViewById($this->widgetModel->get('filterid'));

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

                }

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

            } elseif ('all' === $user) {

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

                                'relatedField' => $fieldName,

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

                    foreach ((array) $targetModuleFocus->default_order_by as $value) {

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

                $query = $this->queryGenerator->createQuery();

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

        protected $listviewRecords;

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

        protected $searchParams = [];

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

        /**

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

            $this->searchParams = $searchParams;

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

        {

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

            return $this->extraData['module'];

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

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

                $this->queryGenerator = new \App\QueryGenerator($this->getTargetModule());

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

                $viewName = \App\CustomView::getCVDetails($cvId, $this->getTargetModule())['viewname'] ?? '';

    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

                    $searchParamsCondition = $this->queryGenerator->parseBaseSearchParamsToCondition($this->searchParams);

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

                if ($filterModel && ($orderBy = $filterModel->getSortOrderBy()) && \is_array($orderBy)) {

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

         * Get total count URL.

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

         */

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

        public function getTotalCountURL($user = 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

            }

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

            $url = 'index.php?module=' . $this->getTargetModule() . '&action=Pagination&mode=getTotalCount&viewname=' . $this->widgetModel->get('filterid');

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

            $url = 'index.php?module=' . $this->getTargetModule() . '&view=List&viewname=' . $this->widgetModel->get('filterid');

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

                $user = App\User::getCurrentUserId();

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

    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

            if (!empty($this->searchParams)) {

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

            return $url;

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

         *

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

                $searcParams[] = ['assigned_user_id', 'e', $user];

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

        }

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

                $searcParams[] = ['assigned_user_id', 'e', $user];

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

            if ($searcParams) {

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

        }

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

                }

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

                    $this->listviewRecords[$row['id']] = $this->getTargetModuleModel()->getRecordFromArray($row);

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

         *

    Line exceeds 120 characters; contains 152 characters
    Open

            $url = 'index.php?module=' . $this->getTargetModule() . '&action=Pagination&mode=getTotalCount&viewname=' . $this->widgetModel->get('filterid');

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

            $searcParams = [];

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

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

            return $this->listviewRecords;

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

            if ($searcParams) {

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

         * @return string

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

                    $searcParams[] = $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

         * Get list view URL.

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

         * @return string

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

        public function getListViewURL($user = false)

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

                foreach (reset($this->searchParams) as $value) {

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

                return $url .= '&search_params=[' . json_encode($searcParams) . ']';

    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

         * @param mixed $user

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

            $searcParams = [];

    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 (reset($this->searchParams) as $value) {

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

            if ('all' !== $user) {

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

                return $url .= '&search_params=[' . json_encode($searcParams) . ']';

    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 (!empty($this->searchParams)) {

    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

            $url = 'index.php?module=' . $this->getTargetModule() . '&view=List&viewname=' . $this->widgetModel->get('filterid');

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

            if (!$user) {

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

                $user = App\User::getCurrentUserId();

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

            if ('all' !== $user) {

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

                }

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

         * @param mixed $user

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

        {

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

                    $searcParams[] = $value;

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

            }

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

    class Vtiger_MiniList_Model extends Vtiger_Widget_Model

    There are no issues that match your filters.

    Category
    Status