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();
- Read upRead up
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;
- Exclude checks
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();
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)) {
- Read upRead up
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) {
- Read upRead up
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();
- Read upRead up
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();
- Read upRead up
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();
- Read upRead up
- Exclude checks
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)) {
- Read upRead up
- Exclude checks
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();
- Read upRead up
- Exclude checks
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)
- Read upRead up
- Exclude checks
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)
- Read upRead up
- Exclude checks
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());
- Read upRead up
- Exclude checks
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');
- Read upRead up
- Exclude checks
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)
- Read upRead up
- Exclude checks
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)
- Read upRead up
- Exclude checks
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
}
- Read upRead up
- Exclude checks
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));
- Read upRead up
- Exclude checks
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)) {
- Read upRead up
- Exclude checks
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());
- Read upRead up
- Exclude checks
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();
- Read upRead up
- Exclude checks
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'));
- Read upRead up
- Exclude checks
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));
- Read upRead up
- Exclude checks
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__);
- Read upRead up
- Exclude checks
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);
- Read upRead up
- Exclude checks
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) {
- Read upRead up
- Exclude checks
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();
- Read upRead up
- Exclude checks
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());
- Read upRead up
- Exclude checks
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;
- Read upRead up
- Exclude checks
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();
- Read upRead up
- Exclude checks
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();
- Read upRead up
- Exclude checks
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)) {
- Read upRead up
- Exclude checks
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__);
}
- Read upRead up
- Exclude checks
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'));
- Read upRead up
- Exclude checks
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');
- Read upRead up
- Exclude checks
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();
- Exclude checks
Suspicious array access to null
Open
$this->listviewRecords[$row['id']] = $this->getTargetModuleModel()->getRecordFromArray($row);
- Exclude checks
Call to method setFields
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$this->queryGenerator->setFields($this->getTargetFields(true));
- Exclude checks
Call to undeclared method \Vtiger_MiniListModel_Dashboard::get
Open
return $this->widgetModel->get('limit');
- Exclude checks
Call to undeclared method \Vtiger_MiniListModel_Dashboard::get
Open
$url = 'index.php?module=' . $this->getTargetModule() . '&view=List&viewname=' . $this->widgetModel->get('filterid');
- Exclude checks
Argument 1 (var)
is null
but \count()
takes \Countable|array
Open
return \count($this->getHeaders());
- Exclude checks
Assigning \Vtiger_Field_Model[]
to property but \Vtiger_MiniList_Model->listviewHeaders
is null
Open
$this->listviewHeaders[$fieldName] = $fieldModel;
- Exclude checks
Call to method parseBaseSearchParamsToCondition
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$searchParamsCondition = $this->queryGenerator->parseBaseSearchParamsToCondition($this->searchParams);
- Exclude checks
Call to method parseAdvFilter
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$this->queryGenerator->parseAdvFilter($searchParamsCondition);
- Exclude checks
Reference to undeclared property \CRMEntity->default_order_by
Open
foreach ((array) $targetModuleFocus->default_order_by as $value) {
- Exclude checks
Call to undeclared method \Vtiger_MiniListModel_Dashboard::get
Open
$url = 'index.php?module=' . $this->getTargetModule() . '&action=Pagination&mode=getTotalCount&viewname=' . $this->widgetModel->get('filterid');
- Exclude checks
Call to undeclared method \Vtiger_MiniListModel_Dashboard::get
Open
$this->queryGenerator->initForCustomViewById($this->widgetModel->get('filterid'));
- Exclude checks
Class extends undeclared class \Vtiger_Widget_Model
Open
class Vtiger_MiniList_Model extends Vtiger_Widget_Model
- Exclude checks
Call to method getCurrentUserId
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
$user = App\User::getCurrentUserId();
- Exclude checks
Call to method getModuleModel
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$fields = $this->queryGenerator->getModuleModel()->getFields();
- Exclude checks
Call to method setOrder
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$this->queryGenerator->setOrder($fieldName, $sortFlag);
- Exclude checks
Call to undeclared method \Vtiger_MiniListModel_Dashboard::get
Open
$this->extraData = $this->widgetModel->get('data');
- Exclude checks
Call to undeclared method \Vtiger_MiniListModel_Dashboard::get
Open
$cvId = (int) $this->widgetModel->get('filterid');
- Exclude checks
Call to method warning
from undeclared class \App\Log
Open
\App\Log::warning('Field not found:' . $fieldName . ' | Module: ' . $this->getTargetModuleModel()->getName(), __METHOD__);
- Exclude checks
Assigning array{}
to property but \Vtiger_MiniList_Model->listviewRecords
is null
Open
$this->listviewRecords = [];
- Exclude checks
Assigning \Vtiger_Record_Model[]
to property but \Vtiger_MiniList_Model->listviewRecords
is null
Open
$this->listviewRecords[$row['id']] = $this->getTargetModuleModel()->getRecordFromArray($row);
- Exclude checks
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__);
- Exclude checks
Reference to undeclared property \CRMEntity->default_order_by
Open
} elseif ($targetModuleFocus->default_order_by && $targetModuleFocus->default_sort_order) {
- Exclude checks
Call to undeclared method \Vtiger_MiniListModel_Dashboard::get
Open
$title = $this->widgetModel->get('title');
- Exclude checks
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);
- Exclude checks
Reference to undeclared property \CRMEntity->default_sort_order
Open
$this->queryGenerator->setOrder($value, $targetModuleFocus->default_sort_order);
- Exclude checks
Call to method __construct
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$this->queryGenerator = new \App\QueryGenerator($this->getTargetModule());
- Exclude checks
Call to method initForCustomViewById
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$this->queryGenerator->initForCustomViewById($this->widgetModel->get('filterid'));
- Exclude checks
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');
- Exclude checks
Call to method setRelatedOrder
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$this->queryGenerator->setRelatedOrder([
- Exclude checks
Reference to undeclared property \CRMEntity->default_sort_order
Open
} elseif ($targetModuleFocus->default_order_by && $targetModuleFocus->default_sort_order) {
- Exclude checks
Call to method getCurrentUserId
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
$user = App\User::getCurrentUserId();
- Exclude checks
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;
- Exclude checks
Suspicious array access to null
Open
$this->listviewHeaders[$fieldName] = $fieldModel;
- Exclude checks
Call to undeclared method \Vtiger_MiniListModel_Dashboard::get
Open
$filterModel = CustomView_Record_Model::getInstanceById($this->widgetModel->get('filterid'));
- Exclude checks
Call to method getCurrentUserId
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
$user = App\User::getCurrentUserId();
- Exclude checks
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();
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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();
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Avoid excessively long variable names like $searchParamsCondition. Keep variable name length under 20. Open
$searchParamsCondition = $this->queryGenerator->parseBaseSearchParamsToCondition($this->searchParams);
- Read upRead up
- Exclude checks
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
- Exclude checks
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;
- Read upRead up
- Exclude checks
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;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $extraData;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $listviewHeaders;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 174 characters Open
if (\in_array('date_start', $fields) && ($fieldModel = $moduleModel->getFieldByName('time_start')) && $fieldModel->isActiveField() && $fieldModel->isViewable()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getTargetModuleModel()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$title = $this->widgetModel->get('title');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $title;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$targetModuleFocus = CRMEntity::getInstance($targetModuleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'relatedSortOrder' => $sortFlag,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$this->targetModuleModel) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$user = App\User::getCurrentUserId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
[$fieldName, $moduleName, $sourceFieldName] = array_pad(explode(':', $fieldName), 3, false);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->queryGenerator->setRelatedOrder([
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// Decode data if not done already.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (null === $this->extraData) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getTargetFields($extraField = false)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->initListViewController();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$suffix = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($this->getTargetFields() as $fieldName) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->initListViewController();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($user)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->queryGenerator->setOrder($fieldName, $sortFlag);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ($targetModuleFocus->default_order_by && $targetModuleFocus->default_sort_order) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $targetModuleModel;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected function initListViewController()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::warning('Field not found:' . $fieldName . ' | Module: ' . $this->getTargetModuleModel()->getName(), __METHOD__);
- Exclude checks
Line exceeds 120 characters; contains 142 characters Open
\App\Log::warning('Field not found:' . $fieldName . ' | Module: ' . $this->getTargetModuleModel()->getName(), __METHOD__);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return \count($this->getHeaders());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$user) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $widgetModel;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Set search condition.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->targetModuleModel = Vtiger_Module_Model::getInstance($this->getTargetModule());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->targetModuleModel;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($viewName) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $prefix . \App\Language::translate($this->getTargetModuleModel()->label, $this->getTargetModule()) . $suffix;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($sourceFieldName && isset($fields[$sourceFieldName])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif (isset($fields[$fieldName])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleName = $this->getTargetModule();
- Exclude checks
Line exceeds 120 characters; contains 169 characters Open
if (\in_array('due_end', $fields) && ($fieldModel = $moduleModel->getFieldByName('time_end')) && $fieldModel->isActiveField() && $fieldModel->isViewable()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->listviewHeaders = $this->listviewRecords = null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getTitle($prefix = '')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $searchParams
- Exclude checks
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()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->queryGenerator->setFields($this->getTargetFields(true));
- Exclude checks
Line exceeds 120 characters; contains 128 characters Open
return $prefix . \App\Language::translate($this->getTargetModuleModel()->label, $this->getTargetModule()) . $suffix;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getHeaders()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getRecords($user)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->queryGenerator->addCondition('assigned_user_id', $user, 'e');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$targetModuleName = $this->getTargetModule();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getTargetModule()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleModel = $this->getTargetModuleModel();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($title)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$suffix = ' - ' . \App\Language::translate($viewName, $this->getTargetModule());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->widgetModel->get('limit');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$user = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'relatedModule' => $moduleName,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function setWidgetModel($widgetModel)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->widgetModel = $widgetModel;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fields[] = 'time_end';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->listviewHeaders;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getRecordLimit()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->listviewRecords = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->extraData = $this->widgetModel->get('data');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fields = $this->extraData['fields'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!\in_array('id', $fields)) {
- Exclude checks
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()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('id' !== $fieldName && ($fieldModel = $this->getTargetModuleModel()->getFieldByName($fieldName))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->listviewHeaders[$fieldName] = $fieldModel;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($this->searchParams)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->queryGenerator->parseAdvFilter($searchParamsCondition);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$filterModel = CustomView_Record_Model::getInstanceById($this->widgetModel->get('filterid'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'sourceField' => $sourceFieldName,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->extraData = \App\Json::decode(App\Purifier::decodeHtml($this->extraData));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fields[] = 'time_start';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->initListViewController();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->limit($this->getRecordLimit());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fields[] = 'id';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$cvId = (int) $this->widgetModel->get('filterid');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$this->listviewRecords) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fields = $this->queryGenerator->getModuleModel()->getFields();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new \App\Exceptions\AppException('Invalid data');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$this->listviewHeaders) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Search condition.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function setSearchParams($searchParams)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getHeaderCount()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($orderBy as $fieldName => $sortFlag) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->queryGenerator->setOrder($value, $targetModuleFocus->default_sort_order);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\is_string($this->extraData)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('Calendar' === $moduleName && $extraField) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $fields;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->queryGenerator->initForCustomViewById($this->widgetModel->get('filterid'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ('all' === $user) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'relatedField' => $fieldName,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ((array) $targetModuleFocus->default_order_by as $value) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query = $this->queryGenerator->createQuery();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $listviewRecords;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $searchParams = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->searchParams = $searchParams;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->extraData['module'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$this->queryGenerator) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->queryGenerator = new \App\QueryGenerator($this->getTargetModule());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewName = \App\CustomView::getCVDetails($cvId, $this->getTargetModule())['viewname'] ?? '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$searchParamsCondition = $this->queryGenerator->parseBaseSearchParamsToCondition($this->searchParams);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($filterModel && ($orderBy = $filterModel->getSortOrderBy()) && \is_array($orderBy)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get total count URL.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getTotalCountURL($user = false)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
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');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Line exceeds 120 characters; contains 125 characters Open
$url = 'index.php?module=' . $this->getTargetModule() . '&view=List&viewname=' . $this->widgetModel->get('filterid');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$user = App\User::getCurrentUserId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $url;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
while ($row = $dataReader->read()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($this->searchParams)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $url;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$searcParams[] = ['assigned_user_id', 'e', $user];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$searcParams[] = ['assigned_user_id', 'e', $user];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($searcParams) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->listviewRecords[$row['id']] = $this->getTargetModuleModel()->getRecordFromArray($row);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Line exceeds 120 characters; contains 152 characters Open
$url = 'index.php?module=' . $this->getTargetModule() . '&action=Pagination&mode=getTotalCount&viewname=' . $this->widgetModel->get('filterid');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$searcParams = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$user) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->listviewRecords;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($searcParams) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$searcParams[] = $value;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get list view URL.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getListViewURL($user = false)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach (reset($this->searchParams) as $value) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $url .= '&search_params=[' . json_encode($searcParams) . ']';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $user
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$searcParams = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach (reset($this->searchParams) as $value) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('all' !== $user) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $url .= '&search_params=[' . json_encode($searcParams) . ']';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader = $query->createCommand()->query();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($this->searchParams)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
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');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$user) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$user = App\User::getCurrentUserId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('all' !== $user) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $user
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$searcParams[] = $value;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Class name "Vtiger_MiniList_Model" is not in camel caps format Open
class Vtiger_MiniList_Model extends Vtiger_Widget_Model
- Exclude checks