Method process
has 98 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function process(App\Request $request)
{
$userId = \App\User::getCurrentUserId();
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
Function process
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function process(App\Request $request)
{
$userId = \App\User::getCurrentUserId();
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
- 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 process() has 106 lines of code. Current threshold is set to 100. Avoid really long methods. Open
public function process(App\Request $request)
{
$userId = \App\User::getCurrentUserId();
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
- Exclude checks
The method process() has an NPath complexity of 540. The configured NPath complexity threshold is 200. Open
public function process(App\Request $request)
{
$userId = \App\User::getCurrentUserId();
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
- 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 process() has a Cyclomatic Complexity of 17. The configured cyclomatic complexity threshold is 10. Open
public function process(App\Request $request)
{
$userId = \App\User::getCurrentUserId();
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
- 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 process(App\Request $request)
- 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
Missing class import via use statement (line '106', column '26'). Open
$queryGenerator = (new \App\QueryGenerator($moduleName))
- 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 '108', column '38'). Open
->setCustomColumn(['count' => new \yii\db\Expression('COUNT(*)')])
- 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 '48', column '14'). Open
throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406);
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
The method process uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$dateFilter['start'] = $today;
$dateFilter['end'] = $today;
}
- 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
The method process uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$data = strtotime('last Monday', strtotime($today));
$dateFilter['start'] = date('Y-m-d', $data);
}
- 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
The method process uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$viewer->view('dashboards/Graf.tpl', $moduleName);
}
- 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 'process'. Open
$colors = \App\Fields\Picklist::getValues($fieldName);
- 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 'process'. Open
$data['labels'][$i] = \App\Language::translate($row[$fieldName], $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 '\App\Fields\DateTime' in method 'getSearchParams'. Open
$conditions[] = ['createdtime', 'bw', \App\Fields\DateTime::formatToDisplay($dates['start']) . ',' . \App\Fields\DateTime::formatToDisplay($dates['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 'Vtiger_Widget_Model' in method 'process'. Open
$viewer->assign('WIDGET', Vtiger_Widget_Model::getInstance($linkId, $userId));
- 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\DateTime' in method 'getSearchParams'. Open
$conditions[] = ['createdtime', 'bw', \App\Fields\DateTime::formatToDisplay($dates['start']) . ',' . \App\Fields\DateTime::formatToDisplay($dates['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 '\App\User' in method 'process'. Open
$userId = \App\User::getCurrentUserId();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Colors' in method 'process'. Open
$color = !empty($colors[$row[$fieldName]]) ? '#' . $colors[$row[$fieldName]] : \App\Colors::getRandomColor($i);
- 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 "start" 10 times. Open
$conditions[] = ['createdtime', 'bw', \App\Fields\DateTime::formatToDisplay($dates['start']) . ',' . \App\Fields\DateTime::formatToDisplay($dates['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 "Y-m-d" 12 times. Open
$today = date('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 "last Monday" 3 times. Open
$data = strtotime('last Monday', strtotime($today));
- 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 setFields
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$queryGenerator = (new \App\QueryGenerator($moduleName))
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('ACCESSIBLE_USERS', $userList);
- Exclude checks
Suspicious type void
of a variable or expression used to build a string. (Expected type to be able to cast to a string) Open
$dataSets[0]['links'][$i] = $listViewUrl . $this->getSearchParams($row[$fieldName], $owner, $dateFilter);
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('ACCESSIBLE_GROUPS', $groupList);
- Exclude checks
Variable $dateFilter
was undeclared, but array fields are being added to it. Open
$dateFilter['start'] = date('Y-m-d', $data);
- Exclude checks
Call to method getInstance
from undeclared class \Vtiger_Widget_Model
Open
$viewer->assign('WIDGET', Vtiger_Widget_Model::getInstance($linkId, $userId));
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('DATA', $data);
- Exclude checks
Argument 4 (mon)
is string
but \mktime()
takes int
Open
$dateFilter['start'] = date('Y-m-d', mktime(0, 0, 0, date('m'), 1, date('Y')));
- Exclude checks
Call to method getInstance
from undeclared class \App\Fields\Owner
Open
$userList = \App\Fields\Owner::getInstance($moduleName, $userId)->getAccessibleUsersForModule();
- Exclude checks
When fetching an array index from a value of type string,
found an array index of type 'end',
but expected the index to be of type int
Open
$conditions[] = ['createdtime', 'bw', \App\Fields\DateTime::formatToDisplay($dates['start']) . ',' . \App\Fields\DateTime::formatToDisplay($dates['end'])];
- Exclude checks
Variable $dateFilter
was undeclared, but array fields are being added to it. Open
$dateFilter['start'] = date('Y-m-d', mktime(0, 0, 0, date('m'), 1, date('Y')));
- Exclude checks
Argument 6 (year)
is string
but \mktime()
takes int
Open
$dateFilter['end'] = date('Y-m-d', mktime(23, 59, 59, date('m'), 0, date('Y')));
- Exclude checks
When fetching an array index from a value of type string,
found an array index of type 'start',
but expected the index to be of type int
Open
$conditions[] = ['createdtime', 'bw', \App\Fields\DateTime::formatToDisplay($dates['start']) . ',' . \App\Fields\DateTime::formatToDisplay($dates['end'])];
- Exclude checks
Variable $dateFilter
was undeclared, but array fields are being added to it. Open
$dateFilter['start'] = date('Y-m-d', $data);
- Exclude checks
Argument 6 (year)
is string
but \mktime()
takes int
Open
$dateFilter['start'] = date('Y-m-d', mktime(0, 0, 0, date('m') - 1, 1, date('Y')));
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('MODULE_NAME', $moduleName);
- Exclude checks
Returning type string
but getSearchParams()
is declared to return void
Open
return '&search_params=' . json_encode([$conditions]);
- Exclude checks
Call to method getInstance
from undeclared class \App\Fields\Owner
Open
$groupList = \App\Fields\Owner::getInstance($moduleName, $userId)->getAccessibleGroupForModule();
- Exclude checks
Variable $dateFilter
was undeclared, but array fields are being added to it. Open
$dateFilter['start'] = date('Y-m-d', $data);
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('WIDGET', Vtiger_Widget_Model::getInstance($linkId, $userId));
- Exclude checks
Call to method getCurrentUserId
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
$userId = \App\User::getCurrentUserId();
- Exclude checks
Variable $dateFilter
was undeclared, but array fields are being added to it. Open
$dateFilter['start'] = date('Y-m-d', mktime(0, 0, 0, date('m') - 1, 1, date('Y')));
- Exclude checks
Variable $dateFilter
was undeclared, but array fields are being added to it. Open
$dateFilter['start'] = $today;
- Exclude checks
Call to method __construct
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$queryGenerator = (new \App\QueryGenerator($moduleName))
- Exclude checks
Argument 6 (year)
is string
but \mktime()
takes int
Open
$dateFilter['start'] = date('Y-m-d', mktime(0, 0, 0, date('m'), 1, date('Y')));
- Exclude checks
Argument 4 (mon)
is string
but \mktime()
takes int
Open
$dateFilter['end'] = date('Y-m-d', mktime(23, 59, 59, date('m'), 0, date('Y')));
- Exclude checks
Call to method __construct
from undeclared class \yii\db\Expression
Open
->setCustomColumn(['count' => new \yii\db\Expression('COUNT(*)')])
- Exclude checks
Variable $dateFilter
was undeclared, but array fields are being added to it. Open
$dateFilter['start'] = date('Y-m-d');
- Exclude checks
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class OSSMailView_Graf_Dashboard extends Vtiger_IndexAjax_View
- Exclude checks
Avoid variables with short names like $i. Configured minimum length is 3. Open
$i = 0;
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
The class OSSMailView_Graf_Dashboard is not named in CamelCase. Open
class OSSMailView_Graf_Dashboard extends Vtiger_IndexAjax_View
{
/**
* Return params to search.
*
- 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
$conditions[] = ['createdtime', 'bw', \App\Fields\DateTime::formatToDisplay($dates['start']) . ',' . \App\Fields\DateTime::formatToDisplay($dates['end'])];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return '&search_params=' . json_encode([$conditions]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dateFilter['start'] = date('Y-m-d', $data);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Return params to search.
- 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
$linkId = $request->getInteger('linkid');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$owner = $userId;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dateFilter['end'] = date('Y-m-d');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dateFilter['start'] = date('Y-m-d', mktime(0, 0, 0, date('m'), 1, date('Y')));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ('Previous month' === $dates) {
- 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
$dateFilter['start'] = date('Y-m-d', $data);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ('Current month' === $dates) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dateFilter['start'] .= ' 00:00:00';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'data' => [],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$owner = $request->getByType('owner', 'Alnum');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$today = date('Y-m-d');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$data = strtotime('-1 day', strtotime($today));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$data = strtotime('last Monday', strtotime(date('Y-m-d', $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
$dataSets = [[
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $assignedTo
- 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' !== $assignedTo) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dateFilter['end'] = $today;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dateFilter['start'] = date('Y-m-d', mktime(0, 0, 0, date('m') - 1, 1, date('Y')));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dateFilter['end'] = date('Y-m-d', mktime(23, 59, 59, date('m'), 0, date('Y')));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ('All' === $dates) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dateFilter['start'] = $today;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'backgroundColor' => [],
- 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
$groupList = \App\Fields\Owner::getInstance($moduleName, $userId)->getAccessibleGroupForModule();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif (is_numeric($owner) && !isset($userList[$owner]) && !isset($groupList[$owner])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ('Previous week' === $dates) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('Mon' != date('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
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function process(App\Request $request)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dateFilter['start'] = date('Y-m-d', $data);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dateFilter['end'] = date('Y-m-d', $data);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dateFilter = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406);
- 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
$data = strtotime('last Monday', strtotime($today));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $dates
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Line exceeds 120 characters; contains 167 characters Open
$conditions[] = ['createdtime', 'bw', \App\Fields\DateTime::formatToDisplay($dates['start']) . ',' . \App\Fields\DateTime::formatToDisplay($dates['end'])];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$data = strtotime('last Sunday', strtotime($today));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'show_chart' => false,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->addCondition($fieldName, '', 'ny')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader = $queryGenerator->createQuery()->createCommand()->query();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'borderColor' => [],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'links' => []
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$color = !empty($colors[$row[$fieldName]]) ? '#' . $colors[$row[$fieldName]] : \App\Colors::getRandomColor($i);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataSets[0]['links'][$i] = $listViewUrl . $this->getSearchParams($row[$fieldName], $owner, $dateFilter);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleName = $request->getModule();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userList = \App\Fields\Owner::getInstance($moduleName, $userId)->getAccessibleUsersForModule();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('Yesterday' === $dates) {
- 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
$dateFilter['end'] = $today;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'labels' => [],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$data['show_chart'] = true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('WIDGET', Vtiger_Widget_Model::getInstance($linkId, $userId));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$conditions[] = ['ossmailview_sendtype', 'e', $stage];
- 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
$userId = \App\User::getCurrentUserId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dates = $request->getByType('dateFilter', 'Text');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ('Current week' === $dates) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dateFilter['start'] = date('Y-m-d');
- 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
$dataSets[0]['data'][$i] = $row['count'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'datasets' => &$dataSets,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('ACCESSIBLE_GROUPS', $groupList);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->view('dashboards/DashBoardWidgetContents.tpl', $moduleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
++$i;
- 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
public function getSearchParams($stage, $assignedTo, $dates)
- 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
$conditions[] = ['assigned_user_id', 'e', $assignedTo];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($dates)) {
- 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 ('Mon' == date('D')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$data = strtotime('last Monday', strtotime($today));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dateFilter['end'] = date('Y-m-d', $data);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->setFields([$fieldName])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->setGroup($fieldName)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $stage
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer = $this->getViewer($request);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$owner) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dateFilter['end'] .= ' 23:59:59';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($request->has('content')) {
- 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
->addCondition('createdtime', $dateFilter['start'] . ',' . $dateFilter['end'], 'bw');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldName = 'ossmailview_sendtype';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->setCustomColumn(['count' => new \yii\db\Expression('COUNT(*)')])
- Exclude checks
Line exceeds 120 characters; contains 123 characters Open
$color = !empty($colors[$row[$fieldName]]) ? '#' . $colors[$row[$fieldName]] : \App\Colors::getRandomColor($i);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataSets[0]['backgroundColor'][$i] = $color;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$colors = array_column($colors, 'color', $fieldName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$listViewUrl = Vtiger_Module_Model::getInstance($moduleName)->getListViewUrl();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$queryGenerator->addCondition('assigned_user_id', $owner, '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
$data['labels'][$i] = \App\Language::translate($row[$fieldName], $moduleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataSets[0]['names'][$i] = $row[$fieldName];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->view('dashboards/Graf.tpl', $moduleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'tooltips' => [],
- 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 = (new \App\QueryGenerator($moduleName))
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataSets[0]['borderColor'][$i] = $color;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('ACCESSIBLE_USERS', $userList);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('DATA', $data);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'names' => [],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$data = [
- 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
$colors = \App\Fields\Picklist::getValues($fieldName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('all' !== $owner) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$i = 0;
- 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
$viewer->assign('MODULE_NAME', $moduleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Class name "OSSMailView_Graf_Dashboard" is not in camel caps format Open
class OSSMailView_Graf_Dashboard extends Vtiger_IndexAjax_View
- Exclude checks