The class DateTimeField has an overall complexity of 55 which is very high. The configured complexity threshold is 50. Open
class DateTimeField
{
protected $datetime;
private static $cache = [];
- Exclude checks
Function __convertToUserFormat
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public static function __convertToUserFormat($date, $format)
{
\App\Log::trace('Start ' . __METHOD__ . ' ' . serialize($date) . ' | ' . $format);
if (!\is_array($date)) {
$date = explode(' ', $date);
- 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 __convertToUserFormat
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function __convertToUserFormat($date, $format)
{
\App\Log::trace('Start ' . __METHOD__ . ' ' . serialize($date) . ' | ' . $format);
if (!\is_array($date)) {
$date = explode(' ', $date);
The method __convertToUserFormat() has an NPath complexity of 240. The configured NPath complexity threshold is 200. Open
public static function __convertToUserFormat($date, $format)
{
\App\Log::trace('Start ' . __METHOD__ . ' ' . serialize($date) . ' | ' . $format);
if (!\is_array($date)) {
$date = explode(' ', $date);
- 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 __convertToUserFormat() has a Cyclomatic Complexity of 16. The configured cyclomatic complexity threshold is 10. Open
public static function __convertToUserFormat($date, $format)
{
\App\Log::trace('Start ' . __METHOD__ . ' ' . serialize($date) . ' | ' . $format);
if (!\is_array($date)) {
$date = explode(' ', $date);
- 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
Missing class import via use statement (line '304', column '17'). Open
$date = new DateTime($this->datetime);
- 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 '325', column '16'). Open
$date = new DateTime($this->datetime);
- 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 getDisplayDate has a boolean flag argument $convertTimeZone, which is a certain sign of a Single Responsibility Principle violation. Open
public function getDisplayDate($user = null, bool $convertTimeZone = true): string
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Missing class import via use statement (line '264', column '25'). Open
$targetTimeZone = new DateTimeZone($targetTimeZoneName);
- 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 convertToDBTimeZone has a boolean flag argument $formatDate, which is a certain sign of a Single Responsibility Principle violation. Open
public static function convertToDBTimeZone($value, $user = null, $formatDate = true)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
The method getDBInsertTimeValue has a boolean flag argument $convertTimeZone, which is a certain sign of a Single Responsibility Principle violation. Open
public function getDBInsertTimeValue(bool $convertTimeZone = true)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Missing class import via use statement (line '256', column '25'). Open
$sourceTimeZone = new DateTimeZone($sourceTimeZoneName);
- 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 '262', column '21'). Open
$myDateTime = new DateTime($time, $sourceTimeZone);
- 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 '284', column '16'). Open
$date = new DateTime($this->datetime);
- 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 getDisplayTime has a boolean flag argument $convertTimeZone, which is a certain sign of a Single Responsibility Principle violation. Open
public function getDisplayTime($user = null, bool $convertTimeZone = true, bool $fullTime = false): string
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
The method getDisplayTime has a boolean flag argument $fullTime, which is a certain sign of a Single Responsibility Principle violation. Open
public function getDisplayTime($user = null, bool $convertTimeZone = true, bool $fullTime = false): string
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Avoid using static access to class '\App\Log' in method '__convertToDBFormat'. Open
\App\Log::trace('End ' . __METHOD__);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'Users_Privileges_Model' in method 'convertToUserTimeZone'. Open
$current_user = 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 '\App\Log' in method 'getFullcalenderTime'. Open
\App\Log::trace('Exiting getDisplayTime method ...');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Log' in method 'convertToDBFormat'. Open
\App\Log::trace('Start ' . __METHOD__ . ' ' . serialize($date));
- 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 'convertToDBFormat'. Open
$user = \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
Avoid using static access to class '\App\Log' in method 'convertTimeZone'. Open
\App\Log::trace('End ' . __METHOD__);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\User' in method 'sanitizeDate'. Open
$user = \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
Avoid using static access to class '\App\Log' in method 'getDBInsertDateTimeValue'. Open
\App\Log::trace(__METHOD__);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Log' in method 'convertToDBFormat'. Open
\App\Log::trace('End ' . __METHOD__);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Log' in method 'convertToUserTimeZone'. Open
\App\Log::trace('Start ' . __METHOD__ . "($value) method ...");
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method getDBInsertTimeValue uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$date = new DateTime($this->datetime);
}
- 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_Time_UIType' in method 'getDisplayTime'. Open
$time = Vtiger_Time_UIType::getTimeValueInAMorPM($time);
- 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 'sanitizeDate'. Open
return \App\Fields\DateTime::sanitizeDbFormat($value, $user->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 '\App\Log' in method 'getDisplayDateTimeValue'. Open
\App\Log::trace(__METHOD__);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'App\Config' in method 'convertToUserTimeZone'. Open
$timeZone = \is_object($user) ? $user->time_zone : App\Config::main('default_timezone');
- 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 getDisplayDate uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$date = new DateTime($this->datetime);
}
- 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\Log' in method '__convertToUserFormat'. Open
\App\Log::trace('End ' . __METHOD__);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method getDBInsertDateValue uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$insert_date = self::convertToDBFormat($value[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
The method __convertToUserFormat uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$userDate = $date[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\DateTime' in method 'convertToUserTimeZone'. Open
$return = self::convertTimeZone($value, App\Fields\DateTime::getTimeZone(), $timeZone);
- 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 'getFullcalenderTime'. Open
\App\Log::trace('Entering getDisplayTime(' . $this->datetime . ') method ...');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'App\Fields\DateTime' in method 'convertToDBTimeZone'. Open
return self::convertTimeZone($value, $timeZone, App\Fields\DateTime::getTimeZone());
- 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 getDisplayTime uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$date = new DateTime($this->datetime);
}
- 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\Log' in method 'convertTimeZone'. Open
\App\Log::trace('Start ' . __METHOD__ . "($time, $sourceTimeZoneName, $targetTimeZoneName)");
- 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\Date' in method '__convertToDBFormat'. Open
return \App\Fields\Date::sanitizeDbFormat($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 '\App\Log' in method '__convertToUserFormat'. Open
\App\Log::trace('Start ' . __METHOD__ . ' ' . serialize($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 '\App\Log' in method 'convertToUserTimeZone'. Open
\App\Log::trace('End ' . __METHOD__);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\User' in method 'convertToDBTimeZone'. Open
$user = \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
Define a constant instead of duplicating this literal "Start " 4 times. Open
\App\Log::trace('Start ' . __METHOD__ . ' ' . serialize($date));
- 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 "yyyy-mm-dd" 4 times. Open
$format = 'yyyy-mm-dd';
- 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" 3 times. Open
return $date->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 "date_format" 3 times. Open
$format = $user->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.
Call to method getCurrentUserModel
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
if ('12' === \App\User::getCurrentUserModel()->getDetail('hour_format')) {
- Exclude checks
Parameter $user
has undeclared type \App\User
(Did you mean class \Tests\App\User) Open
private static function sanitizeDate(string $value, $user): string
- Exclude checks
Call to method getCurrentUserModel
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
$user = \App\User::getCurrentUserModel();
- Exclude checks
Reference to undeclared property \Users->time_zone
Open
$timeZone = \is_object($user) ? $user->time_zone : App\Config::main('default_timezone');
- Exclude checks
Argument 2 (user)
is \CRMEntity|\Users
but \DateTimeField::sanitizeDate()
takes \App\User|null
defined at /code/include/fields/DateTimeField.php:353
Open
$value = self::sanitizeDate($value, $user);
- Exclude checks
Argument 1 (timezone)
is \type
but \DateTimeZone::__construct()
takes string
Open
$targetTimeZone = new DateTimeZone($targetTimeZoneName);
- Exclude checks
Reference to undeclared property \DateTimeField->date
Open
$this->date = null;
- Exclude checks
Saw an @param annotation for user,
but it was not found in the param list of function convertToUserFormat(string $date) : string
Open
* @param Users $user
- Exclude checks
When fetching an array index from a value of type \DateTime[],
found an array index of type \type,
but expected the index to be of type int|string
Open
$myDateTime = self::$cache[$time][$targetTimeZoneName];
- Exclude checks
Saw an @param annotation for user,
but the param list of function getDBInsertDateValue()
is empty Open
* @param $user -- value :: Type Users
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('End ' . __METHOD__);
- Exclude checks
Suspicious type \type
of a variable or expression used to build a string. (Expected type to be able to cast to a string) Open
\App\Log::trace('Start ' . __METHOD__ . "($time, $sourceTimeZoneName, $targetTimeZoneName)");
- Exclude checks
Argument 1 (time)
is string
but \DateTimeField::convertTimeZone()
takes \type
defined at /code/include/fields/DateTimeField.php:253
Open
$return = self::convertTimeZone($value, App\Fields\DateTime::getTimeZone(), $timeZone);
- Exclude checks
Argument 1 (time)
is string
but \DateTimeField::convertTimeZone()
takes \type
defined at /code/include/fields/DateTimeField.php:253
Open
return self::convertTimeZone($value, $timeZone, App\Fields\DateTime::getTimeZone());
- Exclude checks
Parameter $value
has undeclared type \type
Open
public function __construct($value)
- Exclude checks
Call to method getCurrentUserModel
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
$user = \App\User::getCurrentUserModel();
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Start ' . __METHOD__ . "($value) method ...");
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Start ' . __METHOD__ . ' ' . serialize($date) . ' | ' . $format);
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('End ' . __METHOD__);
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Start ' . __METHOD__ . ' ' . serialize($date));
- Exclude checks
Call to undeclared method \Users::getDetail
Open
$timeZone = $user->getDetail('time_zone');
- Exclude checks
Argument 3 (targetTimeZoneName)
is string
but \DateTimeField::convertTimeZone()
takes \type
defined at /code/include/fields/DateTimeField.php:253
Open
return self::convertTimeZone($value, $timeZone, App\Fields\DateTime::getTimeZone());
- Exclude checks
Parameter $sourceTimeZoneName
has undeclared type \type
Open
public static function convertTimeZone($time, $sourceTimeZoneName, $targetTimeZoneName)
- Exclude checks
Parameter $user
has undeclared type \App\User
(Did you mean class \Tests\App\User) Open
public function getDisplayDate($user = null, bool $convertTimeZone = true): string
- Exclude checks
Argument 2 (user)
is \App\User|null
but \DateTimeField::convertToUserTimeZone()
takes \Users
defined at /code/include/fields/DateTimeField.php:216
Open
$date = self::convertToUserTimeZone($this->datetime, $user);
- Exclude checks
Reference to undeclared property \DateTimeField->time
Open
$this->time = null;
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Start ' . __METHOD__ . "($time, $sourceTimeZoneName, $targetTimeZoneName)");
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Entering getDisplayTime(' . $this->datetime . ') method ...');
- Exclude checks
Parameter $targetTimeZoneName
has undeclared type \type
Open
public static function convertTimeZone($time, $sourceTimeZoneName, $targetTimeZoneName)
- Exclude checks
Parameter $time
has undeclared type \type
Open
public static function convertTimeZone($time, $sourceTimeZoneName, $targetTimeZoneName)
- Exclude checks
Argument 1 (timezone)
is \type
but \DateTimeZone::__construct()
takes string
Open
$sourceTimeZone = new DateTimeZone($sourceTimeZoneName);
- Exclude checks
Saw misspelled annotation @returns.
Did you mean @return?
Open
* @returns $insert_date -- insert_date :: Type string
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('End ' . __METHOD__);
- Exclude checks
Saw an @param annotation for user,
but the param list of function getDBInsertDateTimeValue() : string
is empty Open
* @param Users $user
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace(__METHOD__);
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace(__METHOD__);
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('End ' . __METHOD__);
- Exclude checks
Argument 2 (user)
is \App\User|null
but \DateTimeField::convertToUserTimeZone()
takes \Users
defined at /code/include/fields/DateTimeField.php:216
Open
$date = self::convertToUserTimeZone($this->datetime, $user);
- Exclude checks
Call to method getCurrentUserModel
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
$user = \App\User::getCurrentUserModel();
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('End ' . __METHOD__);
- Exclude checks
Parameter $user
has undeclared type \App\User
(Did you mean class \Tests\App\User) Open
public function getDisplayTime($user = null, bool $convertTimeZone = true, bool $fullTime = false): string
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting getDisplayTime method ...');
- Exclude checks
Call to method getDetail
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
return \App\Fields\DateTime::sanitizeDbFormat($value, $user->getDetail('date_format'));
- Exclude checks
Parameter $user
has undeclared type \App\User
(Did you mean class \Tests\App\User) Open
public function getDisplayFullDateTimeValue($user = null): string
- Exclude checks
Parameter $user
has undeclared type \App\User
(Did you mean class \Tests\App\User) Open
public static function convertToDBFormat($date, $user = null)
- Exclude checks
Argument 2 (sourceTimeZoneName)
is string
but \DateTimeField::convertTimeZone()
takes \type
defined at /code/include/fields/DateTimeField.php:253
Open
$return = self::convertTimeZone($value, App\Fields\DateTime::getTimeZone(), $timeZone);
- Exclude checks
Call to method getDetail
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
$format = $user->getDetail('date_format');
- Exclude checks
Call to method getCurrentUserModel
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
$format = \App\User::getCurrentUserModel()->getDetail('date_format') ?: 'yyyy-mm-dd';
- Exclude checks
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class DateTimeField
- Exclude checks
A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 23 and the first side effect is on line 11. Open
<?php
- Exclude checks
Avoid variables with short names like $m. Configured minimum length is 3. Open
[$y, $m, $d] = array_pad(explode($separator, $date[0]), 3, null);
- 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
Avoid variables with short names like $y. Configured minimum length is 3. Open
[$y, $m, $d] = array_pad(explode($separator, $date[0]), 3, null);
- 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
Avoid variables with short names like $d. Configured minimum length is 3. Open
[$y, $m, $d] = array_pad(explode($separator, $date[0]), 3, null);
- 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
{
- 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
$insert_date = self::convertToDBFormat($value[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 $this->getDisplayDate($user) . ' ' . $this->getDisplayTime($user, true, true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param \App\User $user
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function __construct($value)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace(__METHOD__);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get full datetime value (with seconds).
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $datetime;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->date = null;
- 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
$insert_date = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getDisplayDateTimeValue($user = null)
- 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 getDisplayFullDateTimeValue($user = null): string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->time = null;
- 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 $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
* @param $user -- value :: Type Users
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->getDisplayDate($user) . ' ' . $this->getDisplayTime($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
{
- 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 Users $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
*/
- 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 (empty($value)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->datetime = $value;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($value[1])) {
- 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
* @returns $insert_date -- insert_date :: Type string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$date = self::convertToDBTimeZone($this->datetime);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$insert_date = $date->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
* @param type $value
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getDBInsertDateValue()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $insert_date;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getDBInsertDateTimeValue()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->getDisplayDate($user) . ' ' . $this->getFullcalenderTime($user);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private static $cache = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = explode(' ', $this->datetime, 2);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace(__METHOD__);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param App\User|null $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
public function getFullcalenderDateTimevalue($user = null)
- 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 $this->getDBInsertDateValue() . ' ' . $this->getDBInsertTimeValue();
- 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
$value = date('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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** Function to set date values compatible to database (YY_MM_DD).
- 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 string
- 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
$format = 'yyyy-mm-dd';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userDate = self::__convertToUserFormat($date, $format);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function __convertToUserFormat($date, $format)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Start ' . __METHOD__ . ' ' . serialize($date));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif (false !== strpos($date[0], '/')) {
- 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
if (empty($user)) {
- 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
$current_user = Users_Privileges_Model::getCurrentUserPrivilegesModel();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$user = $current_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
/**
- 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 $date
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function convertToDBFormat($date, $user = null)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param Users $user
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$format = $user->getDetail('date_format');
- 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
$userDate = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'dd-mm-yyyy':
- 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
$date[0] = $d . '-' . $m . '-' . $y;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$date[0] = $m . '-' . $d . '-' . $y;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'yyyy-mm-dd':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'dd.mm.yyyy':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'mm.dd.yyyy':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userDate = $date[0];
- 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
}
- 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
return $return;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param Users $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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param type $time
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function convertToUserTimeZone($value, $user = null)
- 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($user)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $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
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $format
- 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 string
- 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
public static function __convertToDBFormat($date, $format)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'yyyy.mm.dd':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $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 (!\is_array($date)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $value
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$return = self::convertTimeZone($value, App\Fields\DateTime::getTimeZone(), $timeZone);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$timeZone = \is_object($user) ? $user->time_zone : App\Config::main('default_timezone');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$user = \App\User::getCurrentUserModel();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return DateTime
- 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
$format = \App\User::getCurrentUserModel()->getDetail('date_format') ?: 'yyyy-mm-dd';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param Users $user
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function convertToDBTimeZone($value, $user = null, $formatDate = true)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$date[0] = $m . '/' . $d . '/' . $y;
- 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
return self::convertTimeZone($value, $timeZone, App\Fields\DateTime::getTimeZone());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function convertTimeZone($time, $sourceTimeZoneName, $targetTimeZoneName)
- 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 = self::__convertToDBFormat($date, $format);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('End ' . __METHOD__);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
switch ($format) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'mm/dd/yyyy':
- 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($format)) {
- 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($date)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$format = 'yyyy-mm-dd';
- 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 string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $date
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('End ' . __METHOD__);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$separator = '.';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'dd/mm/yyyy':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($date)) {
- 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
case 'yyyy/mm/dd':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$separator = '-';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Start ' . __METHOD__ . "($value) method ...");
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'mm-dd-yyyy':
- 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
$date[0] = $m . '.' . $d . '.' . $y;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param type $sourceTimeZoneName
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param type $targetTimeZoneName
- 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 $format
- 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 \App\Fields\Date::sanitizeDbFormat($date, $format);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function convertToUserFormat($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
/**
- 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
default:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $value
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$user = \App\User::getCurrentUserModel();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = self::sanitizeDate($value, $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
\App\Log::trace('Start ' . __METHOD__ . ' ' . serialize($date) . ' | ' . $format);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$date = explode(' ', $date);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif (false !== strpos($date[0], '.')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('End ' . __METHOD__);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $formatDate
- 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 (false !== strpos($date[0], '-')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$separator = '-';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$date[0] = $y . '.' . $m . '.' . $d;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($date[1]) && '' != $date[1]) {
- 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
return $userDate;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$date[0] = $y . '-' . $m . '-' . $d;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$date[0] = $d . '/' . $m . '/' . $y;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Start ' . __METHOD__ . "($time, $sourceTimeZoneName, $targetTimeZoneName)");
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('' == $format) {
- 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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($formatDate) {
- 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
$date[0] = $d . '.' . $m . '.' . $y;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$date[0] = $y . '/' . $m . '/' . $d;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('End ' . __METHOD__);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($user)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$timeZone = $user->getDetail('time_zone');
- 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
$separator = '/';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
[$y, $m, $d] = array_pad(explode($separator, $date[0]), 3, null);
- 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
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userDate = $date[0] . ' ' . $date[1];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $userDate;
- 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 string
- 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
$myDateTime = self::$cache[$time][$targetTimeZoneName];
- 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 string
- 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 bool $convertTimeZone
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$date = self::convertToUserTimeZone($this->datetime, $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
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool $convertTimeZone
- 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
return $date->format('H:i:s');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return self::convertToUserFormat($date_value);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get display 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
$user = \App\User::getCurrentUserModel();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$sourceTimeZone = new DateTimeZone($sourceTimeZoneName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('24:00' == $time) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = str_replace('.', '-', $time);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$targetTimeZone = new DateTimeZone($targetTimeZoneName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($convertTimeZone) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$date = new DateTime($this->datetime);
- 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 string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getDisplayDate($user = null, bool $convertTimeZone = true): string
- 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 getDisplayTime($user = null, bool $convertTimeZone = true, bool $fullTime = false): string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = $fullTime ? $date->format('H:i:s') : $date->format('H:i');
- 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 getDBInsertTimeValue(bool $convertTimeZone = true)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting getDisplayTime method ...');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return \App\Fields\DateTime::sanitizeDbFormat($value, $user->getDetail('date_format'));
- 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
$myDateTime = new DateTime($time, $sourceTimeZone);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to set time values compatible to database (GMT).
- 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
$date = new DateTime($this->datetime);
- 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 ('12' === \App\User::getCurrentUserModel()->getDetail('hour_format')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string $value
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($user)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $value;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = str_replace('/', '-', $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
if (isset($date_value[1]) && '' != $date_value[1]) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$date = self::convertToUserTimeZone($this->datetime, $user);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$date = new DateTime($this->datetime);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\strlen($value) < 8) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = str_replace('T', ' ', $value);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = '00:00';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($convertTimeZone) {
- 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 $value
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// convert this to target timezone using the DateTimeZone object
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::$cache[$time][$targetTimeZoneName] = $myDateTime;
- 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
* Sanitize 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
$myDateTime->setTimeZone($targetTimeZone);
- 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 App\User|null $user
- 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
return $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
\App\Log::trace('End ' . __METHOD__);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($convertTimeZone) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$date_value = $date->format('Y-m-d');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool $fullTime (with seconds)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//Convert time to user preferred value
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private static function sanitizeDate(string $value, $user): string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$date = self::convertToDBTimeZone($this->datetime);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* This function returns the date in user specified format.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$date_value = explode(' ', $this->datetime);
- 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
$time = $date->format('H:i:s');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $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
* @param \App\User|null $user
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool $convertTimeZone
- 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 \App\User|null $user
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = Vtiger_Time_UIType::getTimeValueInAMorPM($time);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getFullcalenderTime($user = null)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $myDateTime;
- 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
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Entering getDisplayTime(' . $this->datetime . ') method ...');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$date = self::convertToUserTimeZone($this->datetime, $user);
- Exclude checks
The variable $date_value is not named in camelCase. Open
public function getDisplayDate($user = null, bool $convertTimeZone = true): string
{
$date_value = explode(' ', $this->datetime);
if (isset($date_value[1]) && '' != $date_value[1]) {
if ($convertTimeZone) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $current_user is not named in camelCase. Open
public static function convertToUserTimeZone($value, $user = null)
{
$current_user = Users_Privileges_Model::getCurrentUserPrivilegesModel();
\App\Log::trace('Start ' . __METHOD__ . "($value) method ...");
if (empty($user)) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $date_value is not named in camelCase. Open
public function getDisplayDate($user = null, bool $convertTimeZone = true): string
{
$date_value = explode(' ', $this->datetime);
if (isset($date_value[1]) && '' != $date_value[1]) {
if ($convertTimeZone) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $current_user is not named in camelCase. Open
public static function convertToUserTimeZone($value, $user = null)
{
$current_user = Users_Privileges_Model::getCurrentUserPrivilegesModel();
\App\Log::trace('Start ' . __METHOD__ . "($value) method ...");
if (empty($user)) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $insert_date is not named in camelCase. Open
public function getDBInsertDateValue()
{
$value = explode(' ', $this->datetime, 2);
$insert_date = '';
if (!empty($value[1])) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $insert_date is not named in camelCase. Open
public function getDBInsertDateValue()
{
$value = explode(' ', $this->datetime, 2);
$insert_date = '';
if (!empty($value[1])) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $insert_date is not named in camelCase. Open
public function getDBInsertDateValue()
{
$value = explode(' ', $this->datetime, 2);
$insert_date = '';
if (!empty($value[1])) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $date_value is not named in camelCase. Open
public function getDisplayDate($user = null, bool $convertTimeZone = true): string
{
$date_value = explode(' ', $this->datetime);
if (isset($date_value[1]) && '' != $date_value[1]) {
if ($convertTimeZone) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $date_value is not named in camelCase. Open
public function getDisplayDate($user = null, bool $convertTimeZone = true): string
{
$date_value = explode(' ', $this->datetime);
if (isset($date_value[1]) && '' != $date_value[1]) {
if ($convertTimeZone) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $date_value is not named in camelCase. Open
public function getDisplayDate($user = null, bool $convertTimeZone = true): string
{
$date_value = explode(' ', $this->datetime);
if (isset($date_value[1]) && '' != $date_value[1]) {
if ($convertTimeZone) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $insert_date is not named in camelCase. Open
public function getDBInsertDateValue()
{
$value = explode(' ', $this->datetime, 2);
$insert_date = '';
if (!empty($value[1])) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The method __convertToUserFormat is not named in camelCase. Open
public static function __convertToUserFormat($date, $format)
{
\App\Log::trace('Start ' . __METHOD__ . ' ' . serialize($date) . ' | ' . $format);
if (!\is_array($date)) {
$date = explode(' ', $date);
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method __convertToDBFormat is not named in camelCase. Open
public static function __convertToDBFormat($date, $format)
{
if (empty($date)) {
\App\Log::trace('End ' . __METHOD__);
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}