Method getFreeTimeInDay
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getFreeTimeInDay(string $day, string $activityType, int $ownerId = null)
{
$currentUser = empty($ownerId) ? \App\User::getCurrentUserModel() : \App\User::getUserModel($ownerId);
if (empty($activityType)) {
$activityType = $currentUser->get('defaultactivitytype');
Function getFreeTimeInDay
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function getFreeTimeInDay(string $day, string $activityType, int $ownerId = null)
{
$currentUser = empty($ownerId) ? \App\User::getCurrentUserModel() : \App\User::getUserModel($ownerId);
if (empty($activityType)) {
$activityType = $currentUser->get('defaultactivitytype');
- 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 getFreeTimeInDay() has an NPath complexity of 1824. The configured NPath complexity threshold is 200. Open
public function getFreeTimeInDay(string $day, string $activityType, int $ownerId = null)
{
$currentUser = empty($ownerId) ? \App\User::getCurrentUserModel() : \App\User::getUserModel($ownerId);
if (empty($activityType)) {
$activityType = $currentUser->get('defaultactivitytype');
- 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 getFreeTimeInDay() has a Cyclomatic Complexity of 17. The configured cyclomatic complexity threshold is 10. Open
public function getFreeTimeInDay(string $day, string $activityType, int $ownerId = null)
{
$currentUser = empty($ownerId) ? \App\User::getCurrentUserModel() : \App\User::getUserModel($ownerId);
if (empty($activityType)) {
$activityType = $currentUser->get('defaultactivitytype');
- 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
Reduce the number of returns of this function 4, down to the maximum allowed 3. Open
public function getFreeTimeInDay(string $day, string $activityType, int $ownerId = null)
- Read upRead up
- Exclude checks
Having too many return statements in a function increases the function's essential complexity because the flow of execution is broken each time a return statement is encountered. This makes it harder to read and understand the logic of the function.
Noncompliant Code Example
With the default threshold of 3:
function myFunction(){ // Noncompliant as there are 4 return statements if (condition1) { return true; } else { if (condition2) { return false; } else { return true; } } return false; }
Refactor this function to reduce its Cognitive Complexity from 16 to the 15 allowed. Open
public function getFreeTimeInDay(string $day, string $activityType, int $ownerId = null)
- 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
Avoid using undefined variables such as '$data' which will lead to PHP notices. Open
$data['date_start'] = $startDate['day'] ? DateTimeField::convertToUserFormat($startDate['day']) : null;
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$data' which will lead to PHP notices. Open
$data['time_start'] = $startWorkHour;
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$data' which will lead to PHP notices. Open
$data['date_start'] = $request->getByType('dateStart', 'DateInUserFormat');
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$data' which will lead to PHP notices. Open
$data['time_end'] = $startWorkHour;
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$data' which will lead to PHP notices. Open
$response->setResult($data);
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$data' which will lead to PHP notices. Open
$data['time_start'] = $startDate['time_start'];
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$data' which will lead to PHP notices. Open
$data['time_end'] = $startDate['time_end'];
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
The class Calendar_GetFreeTime_Action has a coupling between objects value of 15. Consider to reduce the number of dependencies under 13. Open
class Calendar_GetFreeTime_Action extends Vtiger_BasicAjax_Action
{
/**
* Function to check permission.
*
- 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 '115', column '18'). Open
$date->add(new DateInterval('PT' . $durationEvent . 'M0S'));
- 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 '101', column '20'). Open
$endTime = new DateTimeField($endHourFormat);
- 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 '102', column '22'). Open
$startTime = new DateTimeField($startTime);
- 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 '120', column '20'). Open
$date->add(new DateInterval('P1D'));
- 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 '81', column '18'). Open
['<=', new \yii\db\Expression('CONCAT(due_date, ' . $db->quoteValue(' ') . ', 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 '114', column '15'). Open
$date = new DateTime($day . ' ' . $startTime);
- 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 '147', column '19'). Open
$response = new Vtiger_Response();
- 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 '124', column '18'). Open
$endTime = new DateTimeField(date_format($date, 'H:i:s'));
- 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 '93', column '19'). Open
$date->add(new DateInterval('PT' . $durationEvent . 'M0S'));
- 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 '77', column '18'). Open
['<=', new \yii\db\Expression('CONCAT(date_start, ' . $db->quoteValue(' ') . ', 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 '63', column '22'). Open
$dataReader = (new \App\Db\Query())->select(['date_start', 'time_start', '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 '76', column '18'). Open
['>=', new \yii\db\Expression('CONCAT(date_start, ' . $db->quoteValue(' ') . ', 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 '125', column '20'). Open
$startTime = new DateTimeField($startTime);
- 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 '16'). Open
$date = new DateTime($row['date_start'] . ' ' . $startTime);
- 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 '26', 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
Missing class import via use statement (line '80', column '18'). Open
['>=', new \yii\db\Expression('CONCAT(due_date, ' . $db->quoteValue(' ') . ', 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 '118', column '19'). Open
$date->add(new DateInterval('P1D'));
- 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 using static access to class '\App\Fields\DateTime' in method 'process'. Open
if (\App\Fields\DateTime::getDiff($startWorkHour, $endWorkHour, 'minutes') > 0) {
- 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 'process'. Open
$data['date_start'] = $startDate['day'] ? DateTimeField::convertToUserFormat($startDate['day']) : null;
- 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
$currentUser = $request->isEmpty('ownerId') ? \App\User::getCurrentUserModel() : \App\User::getUserModel($request->getInteger('ownerId'));
- 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 'getFreeTimeInDay'. Open
while (\in_array(date_format($date, 'w'), App\Config::module('Calendar', 'HIDDEN_DAYS_IN_CALENDAR_VIEW'))) {
- 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 process uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$data['time_start'] = $startWorkHour;
$data['date_start'] = $request->getByType('dateStart', 'DateInUserFormat');
$data['time_end'] = $startWorkHour;
}
- 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 'Users_Privileges_Model' in method 'checkPermission'. Open
$userPrivilegesModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
- 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 'getFreeTimeInDay'. Open
$dbStartDateOject = DateTimeField::convertToDBTimeZone($day . ' ' . $startWorkHour, null, 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\Fields\DateTime' in method 'getFreeTimeInDay'. Open
\App\Fields\DateTime::getDiff($startTime, $row['time_start'], 'minutes') >= $durationEvent &&
- 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 'getFreeTimeInDay'. Open
$currentUser = empty($ownerId) ? \App\User::getCurrentUserModel() : \App\User::getUserModel($ownerId);
- 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 'getFreeTimeInDay'. Open
$dbEndDateObject = DateTimeField::convertToDBTimeZone($day . ' ' . $endWorkHour, null, 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\Fields\DateTime' in method 'getFreeTimeInDay'. Open
if (\App\Fields\DateTime::getDiff($dbStartDateTime, $dbEndDateTime, 'minutes') < $durationEvent || strtotime($dbEndDateTime) < strtotime($dbStartDateTime)) {
- 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 'process'. Open
$dateStart = DateTimeField::convertToDBFormat($request->getByType('dateStart', 'DateInUserFormat'));
- 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 'getFreeTimeInDay'. Open
$currentUser = empty($ownerId) ? \App\User::getCurrentUserModel() : \App\User::getUserModel($ownerId);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Json' in method 'getFreeTimeInDay'. Open
$typeByDuration = \App\Json::decode($currentUser->getDetail('othereventduration'));
- 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\Db' in method 'getFreeTimeInDay'. Open
$db = App\Db::getInstance();
- 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
$currentUser = $request->isEmpty('ownerId') ? \App\User::getCurrentUserModel() : \App\User::getUserModel($request->getInteger('ownerId'));
- 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 "date_start" 5 times. Open
$dataReader = (new \App\Db\Query())->select(['date_start', 'time_start', '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 "time_start" 9 times. Open
$dataReader = (new \App\Db\Query())->select(['date_start', 'time_start', '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 "H:i:s" 4 times. Open
$startTime = $dbStartDateOject->format('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 "Y-m-d" 3 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 "time_end" 9 times. Open
$dataReader = (new \App\Db\Query())->select(['date_start', 'time_start', '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 "minutes" 3 times. Open
if (\App\Fields\DateTime::getDiff($dbStartDateTime, $dbEndDateTime, 'minutes') < $durationEvent || strtotime($dbEndDateTime) < strtotime($dbStartDateTime)) {
- 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 "status" 3 times. Open
['<>', 'status', 'PLL_POSTPONED'],
- 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.
Argument 1 (mixed)
is string
but \Users_Privileges_Model::hasModulePermission()
takes int
defined at /code/modules/Users/models/Privileges.php:101
Open
if (!$userPrivilegesModel->hasModulePermission($moduleName)) {
- Exclude checks
Call to undeclared method \App\Db::quoteValue
Open
['<=', new \yii\db\Expression('CONCAT(date_start, ' . $db->quoteValue(' ') . ', time_start)'), $dbEndDateTime],
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$dataReader = (new \App\Db\Query())->select(['date_start', 'time_start', 'time_end'])
- Exclude checks
Call to undeclared method \App\Db::quoteValue
Open
['>=', new \yii\db\Expression('CONCAT(date_start, ' . $db->quoteValue(' ') . ', time_start)'), $dbStartDateTime],
- Exclude checks
Argument 1 (value)
is string
but \DateTimeField::__construct()
takes \type
defined at /code/include/fields/DateTimeField.php:31
Open
$startTime = new DateTimeField($startTime);
- Exclude checks
Variable $data
was undeclared, but array fields are being added to it. Open
$data['time_start'] = $startDate['time_start'];
- Exclude checks
Argument 2 (user)
is null
but \DateTimeField::convertToDBTimeZone()
takes \Users
defined at /code/include/fields/DateTimeField.php:234
Open
$dbEndDateObject = DateTimeField::convertToDBTimeZone($day . ' ' . $endWorkHour, null, false);
- Exclude checks
Call to method __construct
from undeclared class \yii\db\Expression
Open
['<=', new \yii\db\Expression('CONCAT(date_start, ' . $db->quoteValue(' ') . ', time_start)'), $dbEndDateTime],
- Exclude checks
Call to method getCurrentUserModel
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
$currentUser = empty($ownerId) ? \App\User::getCurrentUserModel() : \App\User::getUserModel($ownerId);
- Exclude checks
Call to method getCurrentUserModel
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
$currentUser = $request->isEmpty('ownerId') ? \App\User::getCurrentUserModel() : \App\User::getUserModel($request->getInteger('ownerId'));
- Exclude checks
Variable $data
was undeclared, but array fields are being added to it. Open
$data['time_start'] = $startWorkHour;
- Exclude checks
Call to method __construct
from undeclared class \yii\db\Expression
Open
['>=', new \yii\db\Expression('CONCAT(due_date, ' . $db->quoteValue(' ') . ', time_end)'), $dbStartDateTime],
- Exclude checks
Call to method __construct
from undeclared class \yii\db\Expression
Open
['<=', new \yii\db\Expression('CONCAT(due_date, ' . $db->quoteValue(' ') . ', time_end)'), $dbEndDateTime],
- Exclude checks
Call to undeclared method \App\Db::quoteValue
Open
['<=', new \yii\db\Expression('CONCAT(due_date, ' . $db->quoteValue(' ') . ', time_end)'), $dbEndDateTime],
- Exclude checks
Call to undeclared method \App\Db::quoteValue
Open
['>=', new \yii\db\Expression('CONCAT(due_date, ' . $db->quoteValue(' ') . ', time_end)'), $dbStartDateTime],
- Exclude checks
Call to method getUserModel
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
$currentUser = $request->isEmpty('ownerId') ? \App\User::getCurrentUserModel() : \App\User::getUserModel($request->getInteger('ownerId'));
- Exclude checks
Doc-block of $ownerId
in getFreeTimeInDay
is phpdoc param type int
which is not a permitted replacement of the nullable param type ?int
declared in the signature ('?T' should be documented as 'T|null' or '?T') Open
* @param int $ownerId
- Exclude checks
Argument 2 (user)
is null
but \DateTimeField::convertToDBTimeZone()
takes \Users
defined at /code/include/fields/DateTimeField.php:234
Open
$dbStartDateOject = DateTimeField::convertToDBTimeZone($day . ' ' . $startWorkHour, null, false);
- Exclude checks
Call to method __construct
from undeclared class \yii\db\Expression
Open
['>=', new \yii\db\Expression('CONCAT(date_start, ' . $db->quoteValue(' ') . ', time_start)'), $dbStartDateTime],
- Exclude checks
Argument 1 (value)
is string
but \DateTimeField::__construct()
takes \type
defined at /code/include/fields/DateTimeField.php:31
Open
$endTime = new DateTimeField(date_format($date, 'H:i:s'));
- Exclude checks
Call to method getUserModel
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
$currentUser = empty($ownerId) ? \App\User::getCurrentUserModel() : \App\User::getUserModel($ownerId);
- Exclude checks
Argument 1 (value)
is string
but \DateTimeField::__construct()
takes \type
defined at /code/include/fields/DateTimeField.php:31
Open
$endTime = new DateTimeField($endHourFormat);
- Exclude checks
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class Calendar_GetFreeTime_Action extends Vtiger_BasicAjax_Action
- Exclude checks
The class Calendar_GetFreeTime_Action is not named in CamelCase. Open
class Calendar_GetFreeTime_Action extends Vtiger_BasicAjax_Action
{
/**
* Function to check permission.
*
- 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
Avoid variables with short names like $db. Configured minimum length is 3. Open
$db = App\Db::getInstance();
- 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
Spaces must be used to indent lines; tabs are not allowed Open
* Function to check permission.
- 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
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
['and',
- 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
['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
$convertedStartTime = strtotime($startTime);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$endTime = new DateTimeField($endHourFormat);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordsEndTime = $row['time_end'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$date = new DateTime($day . ' ' . $startTime);
- 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\NoPermitted
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currentUser = empty($ownerId) ? \App\User::getCurrentUserModel() : \App\User::getUserModel($ownerId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbStartDate = $dbStartDateOject->format('Y-m-d');
- Exclude checks
Line exceeds 120 characters; contains 165 characters Open
if (\App\Fields\DateTime::getDiff($dbStartDateTime, $dbEndDateTime, 'minutes') < $durationEvent || strtotime($dbEndDateTime) < strtotime($dbStartDateTime)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
['<=', new \yii\db\Expression('CONCAT(due_date, ' . $db->quoteValue(' ') . ', time_end)'), $dbEndDateTime],
- 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
$recordsEndTime = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Fields\DateTime::getDiff($startTime, $row['time_start'], 'minutes') >= $durationEvent &&
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$endTime = new DateTimeField(date_format($date, 'H:i:s'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dateStart = DateTimeField::convertToDBFormat($request->getByType('dateStart', 'DateInUserFormat'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param \App\Request $request
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $ownerId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
['<=', new \yii\db\Expression('CONCAT(date_start, ' . $db->quoteValue(' ') . ', time_start)'), $dbEndDateTime],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$date->add(new DateInterval('PT' . $durationEvent . 'M0S'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->getFreeTimeInDay(date_format($date, 'Y-m-d'), $activityType, $currentUser->getId());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get free time in day.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$typeByDuration = \App\Json::decode($currentUser->getDetail('othereventduration'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
['<>', 'status', 'PLL_COMPLETED']
- 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
$startTime = new DateTimeField($startTime);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$startTime = $recordsEndTime;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($formattedDate > strtotime($endWorkHour) || $formattedDate < strtotime($startWorkHour)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function checkPermission(App\Request $request)
- 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
{
- 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(date_start, ' . $db->quoteValue(' ') . ', time_start)'), $dbStartDateTime],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
['>=', new \yii\db\Expression('CONCAT(due_date, ' . $db->quoteValue(' ') . ', time_end)'), $dbStartDateTime],
- 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
$date->add(new DateInterval('PT' . $durationEvent . 'M0S'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$startTime = new DateTimeField($startTime);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$userPrivilegesModel->hasModulePermission($moduleName)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbEndDateObject = DateTimeField::convertToDBTimeZone($day . ' ' . $endWorkHour, null, false);
- 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
if (\App\Fields\DateTime::getDiff($dbStartDateTime, $dbEndDateTime, 'minutes') < $durationEvent || strtotime($dbEndDateTime) < strtotime($dbStartDateTime)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
['smownerid' => $currentUser->getId()],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$date = new DateTime($row['date_start'] . ' ' . $startTime);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
strtotime($endWorkHour) >= strtotime($endHourFormat)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return ['day' => $day, 'time_start' => $startTime->getDisplayTime(), 'time_end' => $endTime->getDisplayTime()];
- 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
$endWorkHour = $currentUser->getDetail('end_hour');
- 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\AppException
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$endWorkHour = $currentUser->getDetail('end_hour');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->from('vtiger_activity')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
['deleted' => 0],
- Exclude checks
Line exceeds 120 characters; contains 131 characters Open
['<=', new \yii\db\Expression('CONCAT(due_date, ' . $db->quoteValue(' ') . ', 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
$startTime = $row['time_end'];
- 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
if (empty($activityType)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$activityType = $currentUser->get('defaultactivitytype');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbStartDateOject = DateTimeField::convertToDBTimeZone($day . ' ' . $startWorkHour, null, false);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where([
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
['<>', 'status', 'PLL_POSTPONED'],
- 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
$convertedStartTime <= strtotime($row['time_start']) &&
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($recordsEndTime)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$date->add(new DateInterval('P1D'));
- 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
$currentUser = $request->isEmpty('ownerId') ? \App\User::getCurrentUserModel() : \App\User::getUserModel($request->getInteger('ownerId'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userPrivilegesModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $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
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getFreeTimeInDay(string $day, string $activityType, int $ownerId = null)
- 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
Line exceeds 120 characters; contains 137 characters Open
['>=', new \yii\db\Expression('CONCAT(date_start, ' . $db->quoteValue(' ') . ', time_start)'), $dbStartDateTime],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->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
while (\in_array(date_format($date, 'w'), App\Config::module('Calendar', 'HIDDEN_DAYS_IN_CALENDAR_VIEW'))) {
- 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 $day
- 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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($recordsEndTime) || strtotime($row['time_end']) > strtotime($recordsEndTime)) {
- 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
$typeByDuration = array_column($typeByDuration, 'duration', 'activitytype');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db = App\Db::getInstance();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$startTime = $dbStartDateOject->format('H:i:s');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
['<>', 'status', 'PLL_CANCELLED'],
- Exclude checks
Line exceeds 120 characters; contains 135 characters Open
['<=', new \yii\db\Expression('CONCAT(date_start, ' . $db->quoteValue(' ') . ', time_start)'), $dbEndDateTime],
- Exclude checks
Line exceeds 120 characters; contains 133 characters Open
['>=', new \yii\db\Expression('CONCAT(due_date, ' . $db->quoteValue(' ') . ', time_end)'), $dbStartDateTime],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$startWorkHour = $currentUser->getDetail('start_hour');
- 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
$startWorkHour = $currentUser->getDetail('start_hour');
- 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
$convertedStartTime >= strtotime($recordsEndTime) &&
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$formattedDate = strtotime(date_format($date, '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
*
- 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
$durationEvent = $typeByDuration[$activityType] ?? 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader = (new \App\Db\Query())->select(['date_start', 'time_start', 'time_end'])
- Exclude checks
Line exceeds 120 characters; contains 127 characters Open
return ['day' => $day, 'time_start' => $startTime->getDisplayTime(), 'time_end' => $endTime->getDisplayTime()];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$date->add(new DateInterval('P1D'));
- Exclude checks
Line exceeds 120 characters; contains 146 characters Open
$currentUser = $request->isEmpty('ownerId') ? \App\User::getCurrentUserModel() : \App\User::getUserModel($request->getInteger('ownerId'));
- 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
])->orderBy(['time_start' => SORT_ASC])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$endHourFormat = date_format($date, 'H:i:s');
- 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
return ['day' => $day, 'time_start' => $startTime->getDisplayTime(), 'time_end' => $endTime->getDisplayTime()];
- 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
$startDate = $this->getFreeTimeInDay($dateStart, $activityType, $currentUser->getId());
- 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['time_start'] = $startDate['time_start'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$data['date_start'] = $request->getByType('dateStart', 'DateInUserFormat');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\App\Fields\DateTime::getDiff($startWorkHour, $endWorkHour, 'minutes') > 0) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (strtotime($startWorkHour) <= $convertedStartTime &&
- 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
$response = new Vtiger_Response();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$data['time_end'] = $startWorkHour;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$response->emit();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$data['date_start'] = $startDate['day'] ? DateTimeField::convertToUserFormat($startDate['day']) : null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$data['time_start'] = $startWorkHour;
- 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
$activityType = $request->getByType('activitytype', 'Standard');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$data['time_end'] = $startDate['time_end'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$response->setResult($data);
- Exclude checks
Class name "Calendar_GetFreeTime_Action" is not in camel caps format Open
class Calendar_GetFreeTime_Action extends Vtiger_BasicAjax_Action
- Exclude checks