Function getQuery
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public function getQuery()
{
$queryGenerator = new App\QueryGenerator($this->getModuleName());
if ($this->has('customFilter')) {
$queryGenerator->initForCustomViewById($this->get('customFilter'));
- 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
Method getQuery
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getQuery()
{
$queryGenerator = new App\QueryGenerator($this->getModuleName());
if ($this->has('customFilter')) {
$queryGenerator->initForCustomViewById($this->get('customFilter'));
File Calendar.php
has 262 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Calendar Model Class.
*
Method getEntity
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getEntity()
{
$return = [];
$currentUser = \App\User::getCurrentUserModel();
$moduleModel = Vtiger_Module_Model::getInstance($this->getModuleName());
Method getEntityCount
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getEntityCount(): array
{
$colors = \App\Fields\Picklist::getColors('activitytype', false);
$currentUser = Users_Record_Model::getCurrentUserModel();
$startDate = DateTimeField::convertToDBTimeZone($this->get('start'));
Function getEntityCount
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function getEntityCount(): array
{
$colors = \App\Fields\Picklist::getColors('activitytype', false);
$currentUser = Users_Record_Model::getCurrentUserModel();
$startDate = DateTimeField::convertToDBTimeZone($this->get('start'));
- 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 getEntity
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getEntity()
{
$return = [];
$currentUser = \App\User::getCurrentUserModel();
$moduleModel = Vtiger_Module_Model::getInstance($this->getModuleName());
- 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 getQuery() has an NPath complexity of 5760. The configured NPath complexity threshold is 200. Open
public function getQuery()
{
$queryGenerator = new App\QueryGenerator($this->getModuleName());
if ($this->has('customFilter')) {
$queryGenerator->initForCustomViewById($this->get('customFilter'));
- 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 getQuery() has a Cyclomatic Complexity of 18. The configured cyclomatic complexity threshold is 10. Open
public function getQuery()
{
$queryGenerator = new App\QueryGenerator($this->getModuleName());
if ($this->has('customFilter')) {
$queryGenerator->initForCustomViewById($this->get('customFilter'));
- 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 21 to the 15 allowed. Open
public function getQuery()
- 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 class Calendar_Calendar_Model has a coupling between objects value of 24. Consider to reduce the number of dependencies under 13. Open
class Calendar_Calendar_Model extends Vtiger_Calendar_Model
{
public $moduleName = 'Calendar';
public $module;
public $relationAcounts = [
- Read upRead up
- Exclude checks
CouplingBetweenObjects
Since: 1.1.0
A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability
Example
class Foo {
/**
* @var \foo\bar\X
*/
private $x = null;
/**
* @var \foo\bar\Y
*/
private $y = null;
/**
* @var \foo\bar\Z
*/
private $z = null;
public function setFoo(\Foo $foo) {}
public function setBar(\Bar $bar) {}
public function setBaz(\Baz $baz) {}
/**
* @return \SplObjectStorage
* @throws \OutOfRangeException
* @throws \InvalidArgumentException
* @throws \ErrorException
*/
public function process(\Iterator $it) {}
// ...
}
Source https://phpmd.org/rules/design.html#couplingbetweenobjects
Missing class import via use statement (line '28', column '25'). Open
$queryGenerator = new App\QueryGenerator($this->getModuleName());
- 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 '193', column '33'). Open
$dateTimeFieldInstance = new DateTimeField($record['date_start'] . ' ' . $record['time_start']);
- 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 '66', column '17'). Open
['>=', new \yii\db\Expression("CONCAT(due_date, ' ', time_end)"), $dbStartDateTime],
- 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 '199', column '33'). Open
$dateTimeFieldInstance = new DateTimeField($record['due_date'] . ' ' . $record['time_end']);
- 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 '67', column '17'). Open
['<=', new \yii\db\Expression("CONCAT(due_date, ' ', time_end)"), $dbEndDateTime],
- 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 '133', column '33'). Open
$dateTimeFieldInstance = new DateTimeField($row['date_start'] . ' ' . $row['time_start']);
- 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 '62', column '17'). Open
['<=', new \yii\db\Expression("CONCAT(date_start, ' ', time_start)"), $dbEndDateTime],
- 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 '92', column '22'). Open
$subQuery = (new \App\Db\Query())->select(['crmid'])->from('u_#__crmentity_showners')->where(['userid' => $selectedIds]);
- 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 '206', column '15'). Open
$end = new DateTime($endDateFormated);
- 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 '61', column '17'). Open
['>=', new \yii\db\Expression("CONCAT(date_start, ' ', time_start)"), $dbStartDateTime],
- 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 '205', column '17'). Open
$begin = new DateTime($startDateFormated);
- 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 '143', column '33'). Open
$dateTimeFieldInstance = new DateTimeField($row['due_date'] . ' ' . $row['time_end']);
- 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 '209', column '17'). Open
foreach (new DatePeriod($begin, $interval, $end) as $dt) {
- 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
Avoid assigning values to variables in if clauses and the like (line '81', column '48'). Open
public function getQuery()
{
$queryGenerator = new App\QueryGenerator($this->getModuleName());
if ($this->has('customFilter')) {
$queryGenerator->initForCustomViewById($this->get('customFilter'));
- 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 assigning values to variables in if clauses and the like (line '34', column '7'). Open
public function getQuery()
{
$queryGenerator = new App\QueryGenerator($this->getModuleName());
if ($this->has('customFilter')) {
$queryGenerator->initForCustomViewById($this->get('customFilter'));
- 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_Link_Model' in method 'getSideBarLinks'. 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 'DateTimeField' in method 'getQuery'. Open
$dbStartDateOject = DateTimeField::convertToDBTimeZone($this->get('start'));
- 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 'DateTimeField' in method 'getEntity'. Open
$endDateFormated = DateTimeField::__convertToDBFormat($dateComponent, $currentUser->getDetail('date_format'));
- 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 'Users_Record_Model' in method 'getEntityCount'. Open
$currentUser = Users_Record_Model::getCurrentUserModel();
- 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 'updateEvent'. Open
\App\Log::error($e->__toString());
- 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 '291', column '8'). Open
public function updateEvent(int $recordId, string $start, string $end, App\Request $request): bool
{
try {
$recordModel = Vtiger_Record_Model::getInstanceById($recordId, $this->getModuleName());
if ($success = $recordModel->isEditable()) {
- 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 'Calendar_Module_Model' in method 'getQuery'. Open
$queryGenerator->addCondition('activitystatus', implode('##', Calendar_Module_Model::getComponentActivityStateLabel('current')), 'e');
- 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 'DateInterval' in method 'getEntityCount'. Open
$interval = DateInterval::createFromDateString('1 day');
- 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 'getEntityCount'. Open
$return[$dateKey]['label'] = \App\Language::translate($activityType, $this->getModuleName());
- 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 'Vtiger_Link_Model' in method 'getSideBarLinks'. Open
$links[] = Vtiger_Link_Model::getInstanceFromValues([
'linktype' => 'SIDEBARWIDGET',
'linklabel' => 'LBL_USERS',
'linkclass' => 'js-users-form usersForm ',
'template' => 'Filters/Users.tpl',
- 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 'DateTimeField' in method 'updateEvent'. Open
$end = DateTimeField::convertToDBTimeZone($end);
- 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
The method getEntityCount uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$return[$dateKey]['title'] = 1;
}
- 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
Avoid using static access to class 'Vtiger_Cache' in method 'getCleanInstance'. Open
Vtiger_Cache::set('calendarModels', 'Calendar', clone $instance);
- 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\Request' in method 'getSideBarLinks'. Open
$request = \App\Request::init();
- 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 'Vtiger_Module_Model' in method 'getEntity'. Open
$moduleModel = Vtiger_Module_Model::getInstance($this->getModuleName());
- 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\Config' in method 'getEntity'. Open
$editForm = \App\Config::module('Calendar', 'SHOW_EDIT_FORM');
- 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
The method getEntity uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$item['start'] = $startDateFormated . ' ' . $startTimeFormated;
$item['end'] = $endDateFormated . ' ' . $endTimeFormated;
}
- 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
Avoid using static access to class 'DateTimeField' in method 'getEntityCount'. Open
$startDateFormated = DateTimeField::__convertToDBFormat($dateComponent, $currentUser->get('date_format'));
- 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 'Vtiger_Cache' in method 'getCleanInstance'. Open
$instance = Vtiger_Cache::get('calendarModels', 'Calendar');
- 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 'Vtiger_Link_Model' in method 'getSideBarLinks'. Open
$links[] = Vtiger_Link_Model::getInstanceFromValues([
'linktype' => 'SIDEBARWIDGET',
'linklabel' => 'LBL_GROUPS',
'linkclass' => 'js-group-form groupForm',
'template' => 'Filters/Groups.tpl',
- 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 'DateTimeField' in method 'getQuery'. Open
$dbEndDateObject = DateTimeField::convertToDBTimeZone($this->get('end'));
- 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 'DateTimeField' in method 'getEntityCount'. Open
$startDate = DateTimeField::convertToDBTimeZone($this->get('start'));
- 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 'DateTimeField' in method 'getEntityCount'. Open
$endDateFormated = DateTimeField::__convertToDBFormat($dateComponent, $currentUser->get('date_format'));
- 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 'Vtiger_Record_Model' in method 'updateEvent'. Open
$recordModel = Vtiger_Record_Model::getInstanceById($recordId, $this->getModuleName());
- 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
The method updateEvent uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$recordModel->set('time_start', $start->format('H:i:s'));
$recordModel->set('time_end', $end->format('H:i:s'));
$recordModel->set('allday', 0);
}
- 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
Avoid using static access to class '\App\Fields\Picklist' in method 'getEntity'. Open
$colors = \App\Fields\Picklist::getColors('activitytype', false);
- 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 'getEntity'. Open
$item['title'] = \App\Purifier::encodeHtml($row['subject']);
- 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\Fields\Picklist' in method 'getEntityCount'. Open
$colors = \App\Fields\Picklist::getColors('activitytype', false);
- 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 'Calendar_Module_Model' in method 'getQuery'. Open
$queryGenerator->addCondition('activitystatus', implode('##', Calendar_Module_Model::getComponentActivityStateLabel('history')), 'e');
- 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 'DateTimeField' in method 'getEntityCount'. Open
$endDate = DateTimeField::convertToDBTimeZone($this->get('end'));
- 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 'DateTimeField' in method 'getEntity'. Open
$startDateFormated = DateTimeField::__convertToDBFormat($dateComponent, $currentUser->getDetail('date_format'));
- 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 'Vtiger_CalendarRightPanel_Model' in method 'getSideBarLinks'. Open
'filterData' => Vtiger_CalendarRightPanel_Model::getGroupsList($this->moduleName),
- 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 'Vtiger_Loader' in method 'getQuery'. Open
$filterClassName = Vtiger_Loader::getComponentClassName('CalendarFilter', $filter['name'], 'Calendar');
- 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 'getEntity'. Open
$currentUser = \App\User::getCurrentUserModel();
- 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
The method getEntity uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$item['url'] = 'index.php?module=' . $this->getModuleName() . '&view=ActivityState&record=' . $row['id'];
}
- 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
Avoid using static access to class 'Vtiger_CalendarRightPanel_Model' in method 'getSideBarLinks'. Open
'filterData' => Vtiger_CalendarRightPanel_Model::getUsersList($this->moduleName),
- 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 'DateTimeField' in method 'updateEvent'. Open
$start = DateTimeField::convertToDBTimeZone($start);
- 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
Define a constant instead of duplicating this literal "activitytype" 7 times. Open
$queryGenerator->addCondition('activitytype', implode('##', $types), '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.
Define a constant instead of duplicating this literal "time_start" 3 times. Open
$dateTimeFieldInstance = new DateTimeField($row['date_start'] . ' ' . $row['time_start']);
- 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 "Y-m-d H:i:s" 4 times. Open
$dbStartDateTime = $dbStartDateOject->format('Y-m-d H:i:s');
- 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 "time_end" 3 times. Open
$dateTimeFieldInstance = new DateTimeField($row['due_date'] . ' ' . $row['time_end']);
- 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 "start" 6 times. Open
if ($this->get('start') && $this->get('end')) {
- 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 "allDay" 4 times. Open
$item['allDay'] = 1 == $row['allday'];
- 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 "SIDEBARWIDGET" 4 times. Open
$links = Vtiger_Link_Model::getAllByType($this->getModule()->getId(), ['SIDEBARWIDGET'], $linkParams)['SIDEBARWIDGET'] ?? [];
- 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 "index.php?module=" 3 times. Open
$item['url'] = 'index.php?module=' . $this->getModuleName() . '&view=EventForm&record=' . $row['id'];
- 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 "Calendar" 5 times. Open
public $moduleName = 'Calendar';
- 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 "allday" 3 times. Open
$item['allDay'] = 1 == $row['allday'];
- 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 "date_format" 4 times. Open
$startDateFormated = DateTimeField::__convertToDBFormat($dateComponent, $currentUser->getDetail('date_format'));
- 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 "Y-m-d" 6 times. Open
$dbStartDate = $dbStartDateOject->format('Y-m-d');
- 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 "title" 4 times. Open
$item['title'] = \App\Purifier::encodeHtml($row['subject']);
- 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 "activitystatus" 4 times. Open
$queryGenerator->addCondition('activitystatus', implode('##', Calendar_Module_Model::getComponentActivityStateLabel('current')), '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.
Define a constant instead of duplicating this literal "due_date" 4 times. Open
['>', 'due_date', $dbEndDate],
- 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 "date_start" 5 times. Open
['<', 'date_start', $dbStartDate],
- 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 getCurrentUserModel
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
$currentUser = \App\User::getCurrentUserModel();
- Exclude checks
Call to method __construct
from undeclared class \yii\db\Expression
Open
['>=', new \yii\db\Expression("CONCAT(due_date, ' ', time_end)"), $dbStartDateTime],
- Exclude checks
Call to method __construct
from undeclared class \yii\db\Expression
Open
['<=', new \yii\db\Expression("CONCAT(due_date, ' ', time_end)"), $dbEndDateTime],
- Exclude checks
Call to method __construct
from undeclared class \yii\db\Expression
Open
['>=', new \yii\db\Expression("CONCAT(date_start, ' ', time_start)"), $dbStartDateTime],
- Exclude checks
Call to method setFields
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$queryGenerator->setFields(array_keys($queryGenerator->getModuleFields()));
- Exclude checks
Call to method addNativeCondition
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$queryGenerator->addNativeCondition([
- Exclude checks
Call to method createQuery
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$query = $queryGenerator->createQuery();
- Exclude checks
Call to method setField
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$queryGenerator->setField('id');
- Exclude checks
Call to method addCondition
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$queryGenerator->addCondition('activitystatus', implode('##', Calendar_Module_Model::getComponentActivityStateLabel('history')), 'e');
- Exclude checks
Call to method read
from undeclared class \yii\db\DataReader
Open
while ($row = $dataReader->read()) {
- Exclude checks
Call to method initForCustomViewById
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$queryGenerator->initForCustomViewById($this->get('customFilter'));
- Exclude checks
Call to method getModuleFields
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$queryGenerator->setFields(array_keys($queryGenerator->getModuleFields()));
- Exclude checks
Call to method addCondition
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$queryGenerator->addCondition('activitystatus', implode('##', Calendar_Module_Model::getComponentActivityStateLabel('current')), 'e');
- Exclude checks
Call to method addCondition
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$queryGenerator->addCondition('activitytype', implode('##', $types), 'e');
- Exclude checks
Call to method __construct
from undeclared class \yii\db\Expression
Open
['<=', new \yii\db\Expression("CONCAT(date_start, ' ', time_start)"), $dbEndDateTime],
- Exclude checks
Argument 1 (value)
is string
but \DateTimeField::__construct()
takes \type
defined at /code/include/fields/DateTimeField.php:31
Open
$dateTimeFieldInstance = new DateTimeField($row['due_date'] . ' ' . $row['time_end']);
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$subQuery = (new \App\Db\Query())->select(['crmid'])->from('u_#__crmentity_showners')->where(['userid' => $selectedIds]);
- Exclude checks
Call to method __construct
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$queryGenerator = new App\QueryGenerator($this->getModuleName());
- Exclude checks
Call to method addNativeCondition
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$queryGenerator->addNativeCondition(['vtiger_activity.status' => $this->get('activitystatus')]);
- Exclude checks
Call to method getUsersList
from undeclared class \Vtiger_CalendarRightPanel_Model
Open
'filterData' => Vtiger_CalendarRightPanel_Model::getUsersList($this->moduleName),
- Exclude checks
Call to method error
from undeclared class \App\Log
Open
\App\Log::error($e->__toString());
- Exclude checks
Argument 1 (value)
is string
but \DateTimeField::__construct()
takes \type
defined at /code/include/fields/DateTimeField.php:31
Open
$dateTimeFieldInstance = new DateTimeField($record['due_date'] . ' ' . $record['time_end']);
- Exclude checks
Argument 1 (value)
is string
but \DateTimeField::__construct()
takes \type
defined at /code/include/fields/DateTimeField.php:31
Open
$dateTimeFieldInstance = new DateTimeField($row['date_start'] . ' ' . $row['time_start']);
- Exclude checks
Call to method close
from undeclared class \yii\db\DataReader
Open
$dataReader->close();
- Exclude checks
Invalid operator: unary operand of ++(expr)
is null
(expected int or string or float) Open
++$return[$dateKey]['title'];
- Exclude checks
Call to method getGroupsList
from undeclared class \Vtiger_CalendarRightPanel_Model
Open
'filterData' => Vtiger_CalendarRightPanel_Model::getGroupsList($this->moduleName),
- Exclude checks
Invalid offset "title"
of array type array{allDay:true}|array{start:string}
Open
++$return[$dateKey]['title'];
- Exclude checks
Call to method close
from undeclared class \yii\db\DataReader
Open
$dataReader->close();
- Exclude checks
Call to method read
from undeclared class \yii\db\DataReader
Open
while ($record = $dataReader->read()) {
- Exclude checks
Saw possibly unextractable annotation for a fragment of comment '* @param mixed id or name of the module':
after mixed,
did not see an element name (will guess based on comment order) Open
* @param mixed id or name of the module
- Exclude checks
Argument 1 (value)
is string
but \DateTimeField::__construct()
takes \type
defined at /code/include/fields/DateTimeField.php:31
Open
$dateTimeFieldInstance = new DateTimeField($record['date_start'] . ' ' . $record['time_start']);
- Exclude checks
Avoid excessively long variable names like $dateTimeFieldInstance. Keep variable name length under 20. Open
$dateTimeFieldInstance = new DateTimeField($row['date_start'] . ' ' . $row['time_start']);
- 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
Avoid excessively long variable names like $dateTimeFieldInstance. Keep variable name length under 20. Open
$dateTimeFieldInstance = new DateTimeField($record['date_start'] . ' ' . $record['time_start']);
- 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 Calendar_Calendar_Model extends Vtiger_Calendar_Model
- Exclude checks
The class Calendar_Calendar_Model is not named in CamelCase. Open
class Calendar_Calendar_Model extends Vtiger_Calendar_Model
{
public $moduleName = 'Calendar';
public $module;
public $relationAcounts = [
- 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
'Project' => ['vtiger_project', 'projectid', 'linktoaccountscontacts'],
- 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
$dbEndDate = $dbEndDateObject->format('Y-m-d');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
['<', 'date_start', $dbStartDate],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$conditions[] = ['vtiger_crmentity.smownerid' => $selectedIds];
- 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
$item['start'] = $startDateFormated;
- 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 query.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$queryGenerator->addNativeCondition(['vtiger_activity.status' => $this->get('activitystatus')]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$filterInstance = new $filterClassName();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$subQuery = (new \App\Db\Query())->select(['crmid'])->from('u_#__crmentity_showners')->where(['userid' => $selectedIds]);
- Exclude checks
Line exceeds 120 characters; contains 137 characters Open
$subQuery = (new \App\Db\Query())->select(['crmid'])->from('u_#__crmentity_showners')->where(['userid' => $selectedIds]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getEntity()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleModel = Vtiger_Module_Model::getInstance($this->getModuleName());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$item['url'] = 'index.php?module=' . $this->getModuleName() . '&view=EventForm&record=' . $row['id'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$startTimeDisplay = $dateTimeFieldInstance->getDisplayTime();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$endTimeFormated = $dateTimeComponents[1];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$item['end_display'] = $endDateTimeDisplay;
- 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
$queryGenerator->addCondition('activitytype', implode('##', $types), 'e');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'and',
- 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 ($this->get('filters') as $filter) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$filterClassName = Vtiger_Loader::getComponentClassName('CalendarFilter', $filter['name'], 'Calendar');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Gets entity data.
- 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
$endDateFormated = DateTimeField::__convertToDBFormat($dateComponent, $currentUser->getDetail('date_format'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$item['start'] = $startDateFormated . ' ' . $startTimeFormated;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
['<=', new \yii\db\Expression("CONCAT(date_start, ' ', time_start)"), $dbEndDateTime],
- 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 array
- 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
$dateComponent = $dateTimeComponents[0];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$item['allDay'] = 1 == $row['allday'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $relationAcounts = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getQuery()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->get('start') && $this->get('end')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$queryGenerator->addNativeCondition([
- 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
$item['module'] = $this->getModuleName();
- 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
'and',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($filterInstance->checkPermissions() && $conditions = $filterInstance->getCondition($filter['value'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$item['title'] = \App\Purifier::encodeHtml($row['subject']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dateTimeFieldInstance = new DateTimeField($row['due_date'] . ' ' . $row['time_end']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $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
* @return \App\Db\Query
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($this->get('activitystatus'))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbStartDateOject = DateTimeField::convertToDBTimeZone($this->get('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
$conditions = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
switch ($this->get('time')) {
- 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
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$colors = \App\Fields\Picklist::getColors('activitytype', false);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
default:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$item['set'] = 'Task' == $row['activitytype'] ? 'Task' : 'Event';
- 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 = $queryGenerator->createQuery();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$conditions[] = ['vtiger_crmentity.crmid' => $subQuery];
- Exclude checks
Line exceeds 120 characters; contains 121 characters Open
$item['url'] = 'index.php?module=' . $this->getModuleName() . '&view=ActivityState&record=' . $row['id'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dateTimeFieldInstance = new DateTimeField($row['date_start'] . ' ' . $row['time_start']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$startDateFormated = DateTimeField::__convertToDBFormat($dateComponent, $currentUser->getDetail('date_format'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//Conveting the date format in to Y-m-d . since full calendar expects in the same format
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$end = new DateTime($endDateFormated);
- Exclude checks
Line exceeds 120 characters; contains 124 characters Open
$startDateFormated = DateTimeField::__convertToDBFormat($dateComponent, $currentUser->getDetail('date_format'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach (new DatePeriod($begin, $interval, $end) as $dt) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$item['end'] = $endDateFormated;
- 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[$dateKey]['title'] = 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
while ($record = $dataReader->read()) {
- 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
$dateComponent = $dateTimeComponents[0];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$interval = DateInterval::createFromDateString('1 day');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$date = strtotime($dt->format('Y-m-d'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (false === $instance) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$return[$dateKey]['activityType'] = $activityType;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return array_values($return);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$links[] = Vtiger_Link_Model::getInstanceFromValues([
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance = new self();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'template' => 'Filters/Groups.tpl',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Vtiger_Cache::set('calendarModels', 'Calendar', clone $instance);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel = Vtiger_Record_Model::getInstanceById($recordId, $this->getModuleName());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $instance;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($success = $recordModel->isEditable()) {
- 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
$queryGenerator->setField('id');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'history':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$queryGenerator->addCondition('activitystatus', implode('##', Calendar_Module_Model::getComponentActivityStateLabel('history')), 'e');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbStartDate = $dbStartDateOject->format('Y-m-d');
- 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 $moduleName = 'Calendar';
- 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
$item['url'] = 'index.php?module=' . $this->getModuleName() . '&view=ActivityState&record=' . $row['id'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->has('customFilter')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userDateTimeString = $dateTimeFieldInstance->getFullcalenderDateTimevalue();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$queryGenerator->addCondition('activitystatus', implode('##', Calendar_Module_Model::getComponentActivityStateLabel('current')), 'e');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($item['allDay']) {
- Exclude checks
Line exceeds 120 characters; contains 150 characters Open
$queryGenerator->addCondition('activitystatus', implode('##', Calendar_Module_Model::getComponentActivityStateLabel('current')), 'e');
- 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
} 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
$item['start_display'] = $startDateTimeDisplay;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
['>', 'due_date', $dbEndDate],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->andWhere($conditions);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$return[] = $item;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$selectedIds = $selectedUsers['selectedIds'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getEntityCount(): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$conditions[] = ['not in', 'vtiger_crmentity.smownerid', $selectedUsers['excludedIds']];
- 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
* @throws \App\Exceptions\NoPermittedToRecord
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$return = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currentUser = \App\User::getCurrentUserModel();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$request = \App\Request::init();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$editForm = \App\Config::module('Calendar', 'SHOW_EDIT_FORM');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$item = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dateComponent = $dateTimeComponents[0];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//Conveting the date format in to Y-m-d . since full calendar expects in the same format
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$item['className'] = 'js-popover-tooltip--record ownerCBg_' . $row['assigned_user_id'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$return[$dateKey]['type'] = 'widget';
- 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 [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$links = Vtiger_Link_Model::getAllByType($this->getModule()->getId(), ['SIDEBARWIDGET'], $linkParams)['SIDEBARWIDGET'] ?? [];
- 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
$queryGenerator->setFields(array_keys($queryGenerator->getModuleFields()));
- 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
$dbEndDateTime = $dbEndDateObject->format('Y-m-d H:i:s');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
['>=', new \yii\db\Expression("CONCAT(date_start, ' ', time_start)"), $dbStartDateTime],
- 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
'and',
- 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
$return = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($editForm && $moduleModel->getRecordFromArray($row)->setId($row['id'])->isEditable()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$startTimeFormated = $dateTimeComponents[1];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dateTimeComponents = explode(' ', $userDateTimeString);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $return;
- 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
$colors = \App\Fields\Picklist::getColors('activitytype', false);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$endDateFormated = DateTimeField::__convertToDBFormat($dateComponent, $currentUser->get('date_format'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$return[$dateKey]['borderColor'] = $colors[$record['activitytype']] ?? '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Static Function to get the instance of Vtiger Module Model for the given id or name.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Line exceeds 120 characters; contains 133 characters Open
$links = Vtiger_Link_Model::getAllByType($this->getModule()->getId(), ['SIDEBARWIDGET'], $linkParams)['SIDEBARWIDGET'] ?? [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'filterData' => Vtiger_CalendarRightPanel_Model::getUsersList($this->moduleName),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function updateEvent(int $recordId, string $start, string $end, App\Request $request): bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $success;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'ServiceContracts' => ['vtiger_servicecontracts', 'servicecontractsid', 'sc_related_to'],
- 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
case 'current':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbEndDateObject = DateTimeField::convertToDBTimeZone($this->get('end'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->has('filters')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($selectedUsers['excludedIds']) && 'all' === $selectedIds[0]) {
- 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 $query;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dateTimeComponents = explode(' ', $userDateTimeString);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userDateTimeString = $dateTimeFieldInstance->getFullcalenderDateTimevalue();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$item['start_date'] = $row['date_start'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$startDateFormated = DateTimeField::__convertToDBFormat($dateComponent, $currentUser->get('date_format'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$links[] = Vtiger_Link_Model::getInstanceFromValues([
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'historyUsers' => $historyUsers,
- 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
$recordModel->set('allday', 1);
- 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
['<=', new \yii\db\Expression("CONCAT(due_date, ' ', time_end)"), $dbEndDateTime],
- 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
$selectedUsers = $this->get('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
$startDateTimeDisplay = $dateTimeFieldInstance->getDisplayDateTimeValue();
- 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
->createCommand()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dateTimeComponents = explode(' ', $userDateTimeString);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$date = date('Y-m-d', $date);
- 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 ($request->getBoolean('allDay')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->set('time_start', $start->format('H:i:s'));
- 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
$recordModel->save();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$queryGenerator->initForCustomViewById($this->get('customFilter'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($types = $this->get('types')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($this->get('user')) && isset($this->get('user')['selectedIds'][0])) {
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
$endDateFormated = DateTimeField::__convertToDBFormat($dateComponent, $currentUser->getDetail('date_format'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$item['hour_start'] = $startTimeDisplay;
- 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
$endDate = strtotime($endDate->format('Y-m-d H:i:s'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader = $this->getQuery()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dateTimeComponents = explode(' ', $userDateTimeString);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dateKey = $date . '__' . $activityType;
- 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
$historyUsers = $request->has('user') ? $request->get('user') : [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linktype' => 'SIDEBARWIDGET',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linklabel' => 'LBL_USERS',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkclass' => 'js-group-form groupForm',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $links;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$success = true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$success = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$queryGenerator = new App\QueryGenerator($this->getModuleName());
- Exclude checks
Line exceeds 120 characters; contains 150 characters Open
$queryGenerator->addCondition('activitystatus', implode('##', Calendar_Module_Model::getComponentActivityStateLabel('history')), 'e');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'or',
- 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 ('all' !== $selectedIds[0]) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->andWhere(array_merge(['or'], $conditions));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->orderBy('vtiger_activity.date_start,vtiger_activity.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
$startDate = strtotime($startDate->format('Y-m-d H:i:s'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userDateTimeString = $dateTimeFieldInstance->getDisplayDateTimeValue($currentUser);
- 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
'template' => 'Filters/Users.tpl',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'historyUsers' => $historyUsers,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->set('due_date', $end->format('Y-m-d'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Contacts' => ['vtiger_contactdetails', 'contactid', 'parentid'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'HelpDesk' => ['vtiger_troubletickets', 'ticketid', 'parent_id'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbStartDateTime = $dbStartDateOject->format('Y-m-d H:i:s');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
['>=', new \yii\db\Expression("CONCAT(due_date, ' ', time_end)"), $dbStartDateTime],
- Exclude checks
Line exceeds 120 characters; contains 123 characters Open
if ($filterInstance->checkPermissions() && $conditions = $filterInstance->getCondition($filter['value'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($conditions) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader = $this->getQuery()->createCommand()->query();
- 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
$item['id'] = $row['id'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$endDateTimeDisplay = $dateTimeFieldInstance->getDisplayDateTimeValue();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$item['end'] = $endDateFormated . ' ' . $endTimeFormated;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dateTimeFieldInstance = new DateTimeField($record['date_start'] . ' ' . $record['time_start']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$end->modify('+1 day');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($date >= $startDate && $date <= $endDate) {
- 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
$instance = Vtiger_Cache::get('calendarModels', 'Calendar');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'PLL_WORKING_TIME',
- 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
'filterData' => Vtiger_CalendarRightPanel_Model::getGroupsList($this->moduleName),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->set('allday', 0);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$item['borderColor'] = $colors[$row['activitytype']] ?? '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$endDate = DateTimeField::convertToDBTimeZone($this->get('end'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userDateTimeString = $dateTimeFieldInstance->getDisplayDateTimeValue($currentUser);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$return[$dateKey]['allDay'] = true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$return[$dateKey]['start'] = $date;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($return[$dateKey]['title'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
++$return[$dateKey]['title'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$return[$dateKey]['url'] = 'index.php?module=' . $this->getModuleName() . '&view=List&entityState=Active';
- 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 static function getCleanInstance()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linktype' => 'SIDEBARWIDGET',
- 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
try {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$start = DateTimeField::convertToDBTimeZone($start);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$end = DateTimeField::convertToDBTimeZone($end);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Gets number of events.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$startDate = DateTimeField::convertToDBTimeZone($this->get('start'));
- Exclude checks
Line exceeds 120 characters; contains 126 characters Open
$return[$dateKey]['url'] = 'index.php?module=' . $this->getModuleName() . '&view=List&entityState=Active';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return clone $instance;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'PLL_HOLIDAY',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->set('time_end', $end->format('H:i:s'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->query();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$activityType = $record['activitytype'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$begin = new DateTime($startDateFormated);
- 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
/** {@inheritdoc} */
- 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
$dataReader->close();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currentUser = Users_Record_Model::getCurrentUserModel();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$return[$dateKey]['label'] = \App\Language::translate($activityType, $this->getModuleName());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader->close();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'PLL_BREAK_TIME',
- 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
$dateTimeFieldInstance = new DateTimeField($record['due_date'] . ' ' . $record['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[$dateKey]['className'] = 'fc-draggable picklistCBg_Calendar_activitytype_' . $activityType;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed id or name of the module
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getCalendarTypes()
- 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
\App\Log::error($e->__toString());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dateComponent = $dateTimeComponents[0];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getSideBarLinks($linkParams)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkclass' => 'js-users-form usersForm ',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linklabel' => 'LBL_GROUPS',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->set('date_start', $start->format('Y-m-d'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} catch (Exception $e) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Class name "Calendar_Calendar_Model" is not in camel caps format Open
class Calendar_Calendar_Model extends Vtiger_Calendar_Model
- Exclude checks