The class VTFieldExpressionEvaluater has 21 public methods. Consider refactoring VTFieldExpressionEvaluater to keep number of public methods under 10. Open
class VTFieldExpressionEvaluater
{
public static function __vt_add($arr)
{
if (1 == \count($arr)) {
- Read upRead up
- Exclude checks
TooManyPublicMethods
Since: 0.1
A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.
By default it ignores methods starting with 'get' or 'set'.
Example
Source https://phpmd.org/rules/codesize.html#toomanypublicmethods
VTFieldExpressionEvaluater
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class VTFieldExpressionEvaluater
{
public static function __vt_add($arr)
{
if (1 == \count($arr)) {
Function __vt_time_diff
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function __vt_time_diff($arr)
{
$time_operand1 = $time_operand2 = 0;
if (\count($arr) > 1) {
$time_operand1 = $time1 = $arr[0];
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function exec
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function exec($expr)
{
if ($expr instanceof VTExpressionSymbol) {
return $this->env($expr);
}
- 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
Avoid too many return
statements within this method. Open
return $expr;
Reduce the number of returns of this function 4, down to the maximum allowed 3. Open
public static function __vt_get_date($arr)
- 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; }
Reduce the number of returns of this function 5, down to the maximum allowed 3. Open
public function exec($expr)
- 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; }
Class "VTFieldExpressionEvaluater" has 21 methods, which is greater than 20 authorized. Split it into smaller classes. Open
class VTFieldExpressionEvaluater
- Read upRead up
- Exclude checks
A class that grows too much tends to aggregate too many responsibilities and inevitably becomes harder to understand and therefore to maintain. Above a specific threshold, it is strongly advised to refactor the class into smaller ones which focus on well defined topics.
The method __vt_add_time uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$baseTime = date('H:i:s');
$minutes = $arr[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 __vt_sub_days uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$noOfDays = $arr[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 __vt_sub_time uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$baseTime = date('H:i:s');
$minutes = $arr[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 __vt_add uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$maxDigit = \strlen(substr(strrchr($arr[1], '.'), 1));
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method __vt_time_diff uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
// Added as we need to compare with the values based on the user date format and timezone
$time_operand1 = date('Y-m-d H:i:s'); // Current time
- 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 '__vt_time_diff'. Open
$time_operand1 = \App\Fields\DateTime::formatToDb($time_operand1, true);
- 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 __vt_sub uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$maxDigit = \strlen(substr(strrchr($arr[1], '.'), 1));
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\App\Fields\DateTime' in method '__vt_time_diff'. Open
$time_operand2 = \App\Fields\DateTime::formatToDb($time_operand2, true);
- 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 __vt_add_days uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$noOfDays = $arr[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
Define a constant instead of duplicating this literal "Y-m-d" 6 times. Open
$baseDate = date('Y-m-d'); // Current 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 "H:i:s" 5 times. Open
return date('H:i:s', $timeDiff);
- 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.
Saw an @param annotation for a,
but it was not found in the param list of function __vt_time_diffdays(mixed $arr) : int
Open
* @param array $a $a[0] - Input time1, $a[1] - Input time2
- Exclude checks
Reference to undeclared property \VTFieldExpressionEvaluater->env
(Did you mean \VTFieldExpressionEvaluater->env() or $_ENV) Open
return $this->env->get($sym->value);
- Exclude checks
Saw an @param annotation for a,
but it was not found in the param list of function __vt_time_diff(mixed $arr) : int
Open
* @param array $a $a[0] - Input time1, $a[1] - Input time2
- Exclude checks
Returning type string
but __vt_time_diff()
is declared to return int
Open
return date('H:i:s', $timeDiff);
- Exclude checks
Returning type float
but __vt_time_diffdays()
is declared to return int
Open
return floor($timediff / (60 * 60 * 24));
- Exclude checks
Reference to undeclared property \VTFieldExpressionEvaluater->operations
Open
$func = $this->operations[$op->value];
- Exclude checks
Reference to undeclared property \VTFieldExpressionEvaluater->operators
Open
$this->operators = [
- Exclude checks
Reference to undeclared property \VTFieldExpressionEvaluater->functions
Open
$this->functions = [
- Exclude checks
Reference to undeclared property \VTFieldExpressionEvaluater->operations
Open
$this->operations = array_merge($this->functions, $this->operators);
- Exclude checks
Reference to undeclared property \VTExpressionSymbol->value
Open
return $sym->value;
- Exclude checks
Reference to undeclared property \VTFieldExpressionEvaluater->operators
Open
$this->operations = array_merge($this->functions, $this->operators);
- Exclude checks
Reference to undeclared property \VTFieldExpressionEvaluater->expr
Open
return $this->exec($this->expr);
- Exclude checks
Reference to undeclared property \VTFieldExpressionEvaluater->env
(Did you mean \VTFieldExpressionEvaluater->env() or $_ENV) Open
if ($this->env) {
- Exclude checks
Reference to undeclared property \VTExpressionSymbol->value
Open
return $this->env->get($sym->value);
- Exclude checks
Reference to undeclared property \VTFieldExpressionEvaluater->functions
Open
$this->operations = array_merge($this->functions, $this->operators);
- Exclude checks
Reference to undeclared property \VTFieldExpressionEvaluater->env
(Did you mean \VTFieldExpressionEvaluater->env() or $env) Open
$this->env = $env;
- Exclude checks
Reference to undeclared property \VTFieldExpressionEvaluater->expr
(Did you mean $expr) Open
$this->expr = $expr;
- Exclude checks
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (\strlen(substr(strrchr($arr[0], '.'), 1)) > \strlen(substr(strrchr($arr[1], '.'), 1))) {
$maxDigit = \strlen(substr(strrchr($arr[0], '.'), 1));
} else {
$maxDigit = \strlen(substr(strrchr($arr[1], '.'), 1));
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 150.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (\strlen(substr(strrchr($arr[0], '.'), 1)) > \strlen(substr(strrchr($arr[1], '.'), 1))) {
$maxDigit = \strlen(substr(strrchr($arr[0], '.'), 1));
} else {
$maxDigit = \strlen(substr(strrchr($arr[1], '.'), 1));
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 150.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
public static function __vt_add_time($arr)
{
if (\count($arr) > 1) {
$baseTime = $arr[0];
$minutes = $arr[1];
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 115.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
public static function __vt_sub_time($arr)
{
if (\count($arr) > 1) {
$baseTime = $arr[0];
$minutes = $arr[1];
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 115.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class VTFieldExpressionEvaluater
- Exclude checks
Avoid variables with short names like $op. Configured minimum length is 3. Open
$op = $expr->getName();
- 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
Method name "VTFieldExpressionEvaluater::__vt_ltequals" is not in camel caps format Open
public static function __vt_ltequals($arr)
- Exclude checks
Method name "VTFieldExpressionEvaluater::__vt_gtequals" is not in camel caps format Open
public static function __vt_gtequals($arr)
- Exclude checks
Method name "VTFieldExpressionEvaluater::__vt_lt" is not in camel caps format Open
public static function __vt_lt($arr)
- Exclude checks
Method name "VTFieldExpressionEvaluater::__vt_div" is not in camel caps format Open
public static function __vt_div($arr)
- Exclude checks
Method name "VTFieldExpressionEvaluater::__vt_sub" is not in camel caps format Open
public static function __vt_sub($arr)
- Exclude checks
Method name "VTFieldExpressionEvaluater::__vt_time_diff" is not in camel caps format Open
public static function __vt_time_diff($arr)
- Exclude checks
Method name "VTFieldExpressionEvaluater::__vt_time_diffdays" is not in camel caps format Open
public static function __vt_time_diffdays($arr)
- Exclude checks
Method name "VTFieldExpressionEvaluater::__vt_gt" is not in camel caps format Open
public static function __vt_gt($arr)
- Exclude checks
Method name "VTFieldExpressionEvaluater::__vt_sub_time" is not in camel caps format Open
public static function __vt_sub_time($arr)
- Exclude checks
Method name "VTFieldExpressionEvaluater::__vt_add" is not in camel caps format Open
public static function __vt_add($arr)
- Exclude checks
Method name "VTFieldExpressionEvaluater::__vt_concat" is not in camel caps format Open
public static function __vt_concat($arr)
- Exclude checks
Method name "VTFieldExpressionEvaluater::__vt_mul" is not in camel caps format Open
public static function __vt_mul($arr)
- Exclude checks
Method name "VTFieldExpressionEvaluater::__vt_equals" is not in camel caps format Open
public static function __vt_equals($arr)
- Exclude checks
Method name "VTFieldExpressionEvaluater::__vt_add_days" is not in camel caps format Open
public static function __vt_add_days($arr)
- Exclude checks
Method name "VTFieldExpressionEvaluater::__vt_get_date" is not in camel caps format Open
public static function __vt_get_date($arr)
- Exclude checks
Method name "VTFieldExpressionEvaluater::__vt_sub_days" is not in camel caps format Open
public static function __vt_sub_days($arr)
- Exclude checks
Method name "VTFieldExpressionEvaluater::__vt_add_time" is not in camel caps format Open
public static function __vt_add_time($arr)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function __vt_ltequals($arr)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function __vt_gtequals($arr)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\count($arr) > 1) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time_operand2 = $arr[0];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return 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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return implode('', $arr);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $arr[0] / $arr[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
public static function __vt_gt($arr)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $arr[0] == $arr[1];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function __vt_concat($arr)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// Added as we need to compare with the values based on the user date format and timezone
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time_operand1 = \App\Fields\DateTime::formatToDb($time_operand1, true);
- Exclude checks
Spaces must 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 (1 == \count($arr)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $arr[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
} 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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($time_operand1) && empty($time_operand2)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Calculate the time difference (input times) or (current time and input time) and
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must 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
$noOfDays = $arr[1];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'*' => '__vt_mul',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'<=' => '__vt_ltequals',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'sub_time' => '__vt_sub_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
* Gets an environment variable from available sources.
- Exclude checks
Spaces must 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 bcadd($arr[0], $arr[1], $maxDigit);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (1 == \count($arr)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $arr
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $arr
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function __vt_sub($arr)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function __vt_div($arr)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $arr[0] >= $arr[1];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time_operand1 = $time1 = $arr[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 int number of days
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (null === $baseDate || empty($baseDate)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$type = $arr[0] ?? '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return date('Y-m-d', strtotime('-1 day'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'>' => '__vt_gt',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'time_diff' => '__vt_time_diff',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $a $a[0] - Input time1, $a[1] - Input time2
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return int difference timestamp
- Exclude checks
Spaces must 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 strftime('%Y-%m-%d', $baseDate + ($noOfDays * 24 * 60 * 60));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'tomorrow':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\count($arr) > 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
$this->env = $env;
- Exclude checks
Spaces must 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 (\strlen(substr(strrchr($arr[0], '.'), 1)) > \strlen(substr(strrchr($arr[1], '.'), 1))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function __vt_lt($arr)
- Exclude checks
Spaces must 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
$time_operand1 = date('Y-m-d H:i:s'); // Current 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
$noOfDays = $arr[0];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$baseTime = 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
return date('H:i:s', $endTime);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$baseDate = $arr[0];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function __construct($expr)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$baseDate = date('Y-m-d'); // Current 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
$minutes = $arr[0];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function env(VTExpressionSymbol $sym)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'sub_days' => '__vt_sub_days',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$params = $expr->getParams();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$cond = $this->exec($params[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 bcsub($arr[0], $arr[1], $maxDigit);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function __vt_mul($arr)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} catch (Exception $e) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* (if $a[1] is not available $a[0] = Current Time, $a[1] = Input time1)
- 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
return strftime('%Y-%m-%d', $baseDate - ($noOfDays * 24 * 60 * 60));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
switch ($type) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$endTime = strtotime("+$minutes minutes", strtotime($baseTime));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->operators = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'/' => '__vt_div',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($expr instanceof VTExpressionSymbol) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
try {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $arr[0] < $arr[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
$timeDiff = strtotime($time1) - strtotime($time2);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$maxDigit = \strlen(substr(strrchr($arr[1], '.'), 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
if (null === $baseDate || empty($baseDate)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return date('Y-m-d', strtotime('+1 day'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$baseTime = $arr[0];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$endTime = strtotime("-$minutes minutes", strtotime($baseTime));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'get_date' => '__vt_get_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
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$maxDigit = \strlen(substr(strrchr($arr[0], '.'), 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
return -$arr[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
public static function __vt_equals($arr)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** Date difference between (input times) or (current time and input time).
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* (if $a[1] is not available $a[0] = Current Time, $a[1] = Input time1)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time_operand2 = $time2 = $arr[1];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//to give the difference if it is only time field
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$pattern = '/([01]?[0-9]|2[0-3]):[0-5][0-9]/';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return date('H:i:s', $timeDiff);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return strtotime($time_operand1) - strtotime($time_operand2);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\count($arr) > 1) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$baseDate = strtotime($match[0]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$baseDate = strtotime($match[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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'add_days' => '__vt_add_days',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->exec($params[2]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->env) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$maxDigit = \strlen(substr(strrchr($arr[0], '.'), 1));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$maxDigit = \strlen(substr(strrchr($arr[1], '.'), 1));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return (float) $arr[0] * (float) $arr[1];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time_operand1 = $time_operand2 = 0;
- 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
$time_operand2 = \App\Fields\DateTime::formatToDb($time_operand2, true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (preg_match($pattern, $time1) && preg_match($pattern, $time2)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function __vt_add($arr)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* convert it into number of days.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\strlen(substr(strrchr($arr[0], '.'), 1)) > \strlen(substr(strrchr($arr[1], '.'), 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
$baseDate = $arr[0];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
preg_match('/\d\d\d\d-\d\d-\d\d/', $baseDate, $match);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $arr[0] <= $arr[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
return $arr[0] > $arr[1];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return date('Y-m-d');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function __vt_time_diff($arr)
- 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
if (empty($time_operand1) || empty($time_operand2)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$baseTime = 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
$minutes = $arr[0];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $a $a[0] - Input time1, $a[1] - Input time2
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function __vt_time_diffdays($arr)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'>=' => '__vt_gtequals',
- Exclude checks
Spaces must 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_diffdays' => '__vt_time_diffdays',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$timediff = static::__vt_time_diff($arr);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return floor($timediff / (60 * 60 * 24));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->expr = $expr;
- 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 $this->exec($this->expr);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return static::$func($params);
- Exclude checks
Spaces must 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 ($cond) {
- Exclude checks
Spaces must 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 static function __vt_sub_days($arr)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'today':
- Exclude checks
Spaces must 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('H:i:s', $endTime);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'+' => '__vt_add',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param VTExpressionSymbol $sym
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$noOfDays = $arr[1];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$baseTime = $arr[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
'<' => '__vt_lt',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function exec($expr)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($expr instanceof VTExpressionTreeNode) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$params = array_map([$this, 'exec'], $expr->getParams());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $sym->value;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return date('Y-m-d');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function __vt_sub_time($arr)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'-' => '__vt_sub',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'add_time' => '__vt_add_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
$func = $this->operations[$op->value];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->env->get($sym->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
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\count($arr) > 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
case 'yesterday':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
preg_match('/\d\d\d\d-\d\d-\d\d/', $baseDate, $match);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function __vt_get_date($arr)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\count($arr) > 1) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$minutes = $arr[1];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$minutes = $arr[1];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'==' => '__vt_equals',
- 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
if ('if' == $op->value) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'concat' => '__vt_concat',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->operations = array_merge($this->functions, $this->operators);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->env($expr);
- Exclude checks
Spaces must 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 static function __vt_add_days($arr)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$noOfDays = $arr[0];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$baseDate = date('Y-m-d'); // Current date
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function __vt_add_time($arr)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->functions = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function evaluate($env)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$op = $expr->getName();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->exec($params[1]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $expr;
- Exclude checks
The variable $time_operand1 is not named in camelCase. Open
public static function __vt_time_diff($arr)
{
$time_operand1 = $time_operand2 = 0;
if (\count($arr) > 1) {
$time_operand1 = $time1 = $arr[0];
- 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 $time_operand1 is not named in camelCase. Open
public static function __vt_time_diff($arr)
{
$time_operand1 = $time_operand2 = 0;
if (\count($arr) > 1) {
$time_operand1 = $time1 = $arr[0];
- 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 $time_operand1 is not named in camelCase. Open
public static function __vt_time_diff($arr)
{
$time_operand1 = $time_operand2 = 0;
if (\count($arr) > 1) {
$time_operand1 = $time1 = $arr[0];
- 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 $time_operand2 is not named in camelCase. Open
public static function __vt_time_diff($arr)
{
$time_operand1 = $time_operand2 = 0;
if (\count($arr) > 1) {
$time_operand1 = $time1 = $arr[0];
- 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 $time_operand2 is not named in camelCase. Open
public static function __vt_time_diff($arr)
{
$time_operand1 = $time_operand2 = 0;
if (\count($arr) > 1) {
$time_operand1 = $time1 = $arr[0];
- 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 $time_operand2 is not named in camelCase. Open
public static function __vt_time_diff($arr)
{
$time_operand1 = $time_operand2 = 0;
if (\count($arr) > 1) {
$time_operand1 = $time1 = $arr[0];
- 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 $time_operand2 is not named in camelCase. Open
public static function __vt_time_diff($arr)
{
$time_operand1 = $time_operand2 = 0;
if (\count($arr) > 1) {
$time_operand1 = $time1 = $arr[0];
- 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 $time_operand1 is not named in camelCase. Open
public static function __vt_time_diff($arr)
{
$time_operand1 = $time_operand2 = 0;
if (\count($arr) > 1) {
$time_operand1 = $time1 = $arr[0];
- 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 $time_operand2 is not named in camelCase. Open
public static function __vt_time_diff($arr)
{
$time_operand1 = $time_operand2 = 0;
if (\count($arr) > 1) {
$time_operand1 = $time1 = $arr[0];
- 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 $time_operand2 is not named in camelCase. Open
public static function __vt_time_diff($arr)
{
$time_operand1 = $time_operand2 = 0;
if (\count($arr) > 1) {
$time_operand1 = $time1 = $arr[0];
- 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 $time_operand1 is not named in camelCase. Open
public static function __vt_time_diff($arr)
{
$time_operand1 = $time_operand2 = 0;
if (\count($arr) > 1) {
$time_operand1 = $time1 = $arr[0];
- 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 $time_operand1 is not named in camelCase. Open
public static function __vt_time_diff($arr)
{
$time_operand1 = $time_operand2 = 0;
if (\count($arr) > 1) {
$time_operand1 = $time1 = $arr[0];
- 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 $time_operand1 is not named in camelCase. Open
public static function __vt_time_diff($arr)
{
$time_operand1 = $time_operand2 = 0;
if (\count($arr) > 1) {
$time_operand1 = $time1 = $arr[0];
- 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 $time_operand2 is not named in camelCase. Open
public static function __vt_time_diff($arr)
{
$time_operand1 = $time_operand2 = 0;
if (\count($arr) > 1) {
$time_operand1 = $time1 = $arr[0];
- 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 $time_operand1 is not named in camelCase. Open
public static function __vt_time_diff($arr)
{
$time_operand1 = $time_operand2 = 0;
if (\count($arr) > 1) {
$time_operand1 = $time1 = $arr[0];
- 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 $time_operand2 is not named in camelCase. Open
public static function __vt_time_diff($arr)
{
$time_operand1 = $time_operand2 = 0;
if (\count($arr) > 1) {
$time_operand1 = $time1 = $arr[0];
- 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 __vt_add is not named in camelCase. Open
public static function __vt_add($arr)
{
if (1 == \count($arr)) {
return $arr[0];
}
- 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 __vt_equals is not named in camelCase. Open
public static function __vt_equals($arr)
{
return $arr[0] == $arr[1];
}
- 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 __vt_time_diffdays is not named in camelCase. Open
public static function __vt_time_diffdays($arr)
{
$timediff = static::__vt_time_diff($arr);
return floor($timediff / (60 * 60 * 24));
}
- 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 __vt_ltequals is not named in camelCase. Open
public static function __vt_ltequals($arr)
{
return $arr[0] <= $arr[1];
}
- 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 __vt_add_days is not named in camelCase. Open
public static function __vt_add_days($arr)
{
if (\count($arr) > 1) {
$baseDate = $arr[0];
$noOfDays = $arr[1];
- 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 __vt_add_time is not named in camelCase. Open
public static function __vt_add_time($arr)
{
if (\count($arr) > 1) {
$baseTime = $arr[0];
$minutes = $arr[1];
- 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 __vt_sub is not named in camelCase. Open
public static function __vt_sub($arr)
{
if (1 == \count($arr)) {
return -$arr[0];
}
- 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 __vt_div is not named in camelCase. Open
public static function __vt_div($arr)
{
try {
return $arr[0] / $arr[1];
} catch (Exception $e) {
- 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 __vt_sub_days is not named in camelCase. Open
public static function __vt_sub_days($arr)
{
if (\count($arr) > 1) {
$baseDate = $arr[0];
$noOfDays = $arr[1];
- 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 __vt_sub_time is not named in camelCase. Open
public static function __vt_sub_time($arr)
{
if (\count($arr) > 1) {
$baseTime = $arr[0];
$minutes = $arr[1];
- 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 __vt_gt is not named in camelCase. Open
public static function __vt_gt($arr)
{
return $arr[0] > $arr[1];
}
- 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 __vt_get_date is not named in camelCase. Open
public static function __vt_get_date($arr)
{
$type = $arr[0] ?? '';
switch ($type) {
case 'today':
- 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 __vt_mul is not named in camelCase. Open
public static function __vt_mul($arr)
{
return (float) $arr[0] * (float) $arr[1];
}
- 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 __vt_gtequals is not named in camelCase. Open
public static function __vt_gtequals($arr)
{
return $arr[0] >= $arr[1];
}
- 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 __vt_lt is not named in camelCase. Open
public static function __vt_lt($arr)
{
return $arr[0] < $arr[1];
}
- 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 __vt_concat is not named in camelCase. Open
public static function __vt_concat($arr)
{
return implode('', $arr);
}
- 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 __vt_time_diff is not named in camelCase. Open
public static function __vt_time_diff($arr)
{
$time_operand1 = $time_operand2 = 0;
if (\count($arr) > 1) {
$time_operand1 = $time1 = $arr[0];
- 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() {
}
}