Method appendDouble
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function appendDouble(&$combinations)
{
$int = '123456789';
$fieldData = (new \App\Db\Query())->from('vtiger_field')->where(['uitype' => 7, 'typeofdata' => 'NN~O'])->one();
foreach ($this->getCombinations() as $combination) {
Method testNumbers
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
public function testNumbers($moduleName, $fieldName, $userFormat, $dbFormat, $decimalSeparator, $groupingSeparator, $groupingPattern, $afterDot, $symbolPlacement, $truncate, $correct = true): void
Method appendInteger
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function appendInteger(&$combinations)
{
$dbFormat = '123456789';
$fieldData = (new \App\Db\Query())->from('vtiger_field')->where(['uitype' => 7])->one();
foreach ($this->getCombinations() as $combination) {
Function getCombinations
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getCombinations()
{
if (!self::$combinations) {
$query = (new \App\Db\Query())->select(
[
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
The method testNumbers has 11 parameters. Consider reducing the number of parameters to less than 10. Open
public function testNumbers($moduleName, $fieldName, $userFormat, $dbFormat, $decimalSeparator, $groupingSeparator, $groupingPattern, $afterDot, $symbolPlacement, $truncate, $correct = true): void
{
$userModel = \Vtiger_Record_Model::getInstanceById(\App\User::getCurrentUserId(), 'Users');
$userModel->set('currency_decimal_separator', $decimalSeparator);
$userModel->set('currency_grouping_separator', $groupingSeparator);
- Exclude checks
This function has 11 parameters, which is greater than the 7 authorized. Open
public function testNumbers($moduleName, $fieldName, $userFormat, $dbFormat, $decimalSeparator, $groupingSeparator, $groupingPattern, $afterDot, $symbolPlacement, $truncate, $correct = true): void
- Read upRead up
- Exclude checks
A long parameter list can indicate that a new structure should be created to wrap the numerous parameters or that the function is doing too many things.
Noncompliant Code Example
With a maximum number of 4 parameters:
function doSomething($param1, $param2, $param3, $param4, $param5) { ... }
Compliant Solution
function doSomething($param1, $param2, $param3, $param4) { ... }
Missing class import via use statement (line '128', column '21'). Open
$fieldData = (new \App\Db\Query())->from('vtiger_field')->where(['uitype' => 7])->one();
- 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 testNumbers has a boolean flag argument $correct, which is a certain sign of a Single Responsibility Principle violation. Open
public function testNumbers($moduleName, $fieldName, $userFormat, $dbFormat, $decimalSeparator, $groupingSeparator, $groupingPattern, $afterDot, $symbolPlacement, $truncate, $correct = true): void
- 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 '99', column '18'). Open
$query = (new \App\Db\Query())->select(
- 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 '172', column '21'). Open
$fieldData = (new \App\Db\Query())->from('vtiger_field')->where(['uitype' => 7, 'typeofdata' => 'NN~O'])->one();
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Avoid using static access to class '\App\User' in method 'setUpBeforeClass'. Open
$userModel = \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\Module' in method 'appendInteger'. Open
\App\Module::getModuleName($fieldData['tabid']),
- 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\Module' in method 'appendDouble'. Open
\App\Module::getModuleName($fieldData['tabid']),
- 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\Module' in method 'appendDouble'. Open
\App\Module::getModuleName($fieldData['tabid']),
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Vtiger_Record_Model' in method 'testNumbers'. Open
$userModel = \Vtiger_Record_Model::getInstanceById(\App\User::getCurrentUserId(), 'Users');
- 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\Module' in method 'appendInteger'. Open
\App\Module::getModuleName($fieldData['tabid']),
- 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\Module' in method 'appendDouble'. Open
\App\Module::getModuleName($fieldData['tabid']),
- 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 'testNumbers'. Open
$userModel = \Vtiger_Record_Model::getInstanceById(\App\User::getCurrentUserId(), 'Users');
- 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\Module' in method 'appendDouble'. Open
\App\Module::getModuleName($fieldData['tabid']),
- 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 providerNumbers uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$this->fail('Unsupported field type: ' . \ucfirst($type));
}
- 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_Record_Model' in method 'tearDownAfterClass'. Open
$userModel = \Vtiger_Record_Model::getInstanceById(\App\User::getCurrentUserId(), 'Users');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Vtiger_Record_Model' in method 'testNumbers'. Open
$recordModel = \Vtiger_Record_Model::getCleanInstance($moduleName);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\User' in method 'tearDownAfterClass'. Open
$userModel = \Vtiger_Record_Model::getInstanceById(\App\User::getCurrentUserId(), 'Users');
- 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 "grouping_separator" 11 times. Open
'grouping_separator' => 'vtiger_currency_grouping_separator.currency_grouping_separator',
- 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 "currency_decimal_separator" 3 times. Open
self::$separatorDecimal = $userModel->getDetail('currency_decimal_separator');
- 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 "currency_symbol_placement" 3 times. Open
self::$symbolPlacement = $userModel->getDetail('currency_symbol_placement');
- 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 "currency_grouping_separator" 3 times. Open
self::$separatorGrouping = $userModel->getDetail('currency_grouping_separator');
- 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 "fieldname" 6 times. Open
$fieldData['fieldname'],
- 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 "truncate_trailing_zeros" 3 times. Open
self::$truncateTrailingZeros = $userModel->getDetail('truncate_trailing_zeros');
- 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 "grouping_pattern" 10 times. Open
'grouping_pattern' => 'vtiger_currency_grouping_pattern.currency_grouping_pattern',
- 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 "decimal_separator" 12 times. Open
'decimal_separator' => 'vtiger_currency_decimal_separator.currency_decimal_separator',
- 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 "cross join" 4 times. Open
)->from('vtiger_currency_decimal_separator')->join('cross join', 'vtiger_currency_grouping_pattern')->join('cross join', 'vtiger_currency_grouping_separator')->join('cross join', 'vtiger_currency_symbol_placement')->join('cross join', 'vtiger_no_of_currency_decimals')->createCommand()->query();
- 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 "tabid" 6 times. Open
\App\Module::getModuleName($fieldData['tabid']),
- 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.
Rename "$combinations" which has the same name as the field declared at line 47. Open
$combinations = [];
- Read upRead up
- Exclude checks
Shadowing fields with a local variable is a bad practice that reduces code readability: it makes it confusing to know whether the field or the variable is being used.
Noncompliant Code Example
class Foo { public $myField; public function doSomething() { $myField = 0; ... } }
See
- CERT, DCL51-J. - Do not shadow or obscure identifiers in subscopes
Define a constant instead of duplicating this literal "no_of_currency_decimals" 3 times. Open
self::$decimalNum = $userModel->getDetail('no_of_currency_decimals');
- 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 "decimals" 9 times. Open
'decimals' => 'vtiger_no_of_currency_decimals.no_of_currency_decimals',
- 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 "symbol_placement" 7 times. Open
'symbol_placement' => 'vtiger_currency_symbol_placement.currency_symbol_placement',
- 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 "currency_grouping_pattern" 3 times. Open
self::$patternGrouping = $userModel->getDetail('currency_grouping_pattern');
- 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.
Avoid unused parameters such as '$correct'. Open
public function testNumbers($moduleName, $fieldName, $userFormat, $dbFormat, $decimalSeparator, $groupingSeparator, $groupingPattern, $afterDot, $symbolPlacement, $truncate, $correct = true): void
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
Call to undeclared method \App\Db\Query::from
Open
$fieldData = (new \App\Db\Query())->from('vtiger_field')->where(['uitype' => 7])->one();
- Exclude checks
Static call to undeclared method \Tests\Base::tearDownAfterClass
Open
parent::tearDownAfterClass();
- Exclude checks
Argument 1 (str)
is 12312
but \substr()
takes string
Open
$decimals = \substr(12312, 0, $combination['decimals']);
- Exclude checks
Call to undeclared method \Tests\Base\Z_StringFormatting::fail
Open
$this->fail('Unsupported field type: ' . \ucfirst($type));
- Exclude checks
Argument 1 (str)
is 10000
but \substr()
takes string
Open
$decimals = \substr(10000, 0, $combination['decimals']);
- Exclude checks
Call to undeclared method \Tests\Base\Z_StringFormatting::assertSame
Open
$this->assertSame($dbFormat, $recordModel->get($fieldName), 'Database value different than expected | ' . $dbFormat . ' !== ' . $recordModel->get($fieldName));
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$query = (new \App\Db\Query())->select(
- Exclude checks
Call to method getCurrentUserModel
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
$userModel = \App\User::getCurrentUserModel();
- Exclude checks
Call to method getCurrentUserId
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
$userModel = \Vtiger_Record_Model::getInstanceById(\App\User::getCurrentUserId(), 'Users');
- Exclude checks
Call to method getCurrentUserId
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
$userModel = \Vtiger_Record_Model::getInstanceById(\App\User::getCurrentUserId(), 'Users');
- Exclude checks
Static call to undeclared method \Tests\Base::setUpBeforeClass
Open
parent::setUpBeforeClass();
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$fieldData = (new \App\Db\Query())->from('vtiger_field')->where(['uitype' => 7, 'typeofdata' => 'NN~O'])->one();
- Exclude checks
Call to undeclared method \Tests\Base\Z_StringFormatting::assertSame
Open
$this->assertSame($userFormat, $recordModel->getDisplayValue($fieldName), 'Display value different than expected ' . $recordModel->get($fieldName) . " !== $dbFormat | userFormat: $userFormat | fieldName: $fieldName | getDisplayValue: " . $recordModel->getDisplayValue($fieldName));
- Exclude checks
Avoid excessively long variable names like $truncateTrailingZeros. Keep variable name length under 20. Open
public static $truncateTrailingZeros;
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
The class Z_StringFormatting is not named in CamelCase. Open
class Z_StringFormatting extends \Tests\Base
{
/**
* @var string Decimal numbers separator
*/
- Read upRead up
- Exclude checks
CamelCaseClassName
Since: 0.2
It is considered best practice to use the CamelCase notation to name classes.
Example
class class_name {
}
Source
Space found after opening bracket of FOREACH loop Open
foreach (
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getCombinations()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'decimal_separator' => 'vtiger_currency_decimal_separator.currency_decimal_separator',
- Exclude checks
Spaces must 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 appendInteger(&$combinations)
- Exclude checks
Spaces must 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 $truncateTrailingZeros;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $combinations = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::$decimalNum = $userModel->getDetail('no_of_currency_decimals');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach (
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->{$method}($combinations);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'grouping_separator' => 'vtiger_currency_grouping_separator.currency_grouping_separator',
- Exclude checks
Spaces must 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
self::$truncateTrailingZeros = $userModel->getDetail('truncate_trailing_zeros');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function setUpBeforeClass(): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Data provider for the numbers formatting test.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$combinations = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->fail('Unsupported field type: ' . \ucfirst($type));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\method_exists($this, $method)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return self::$combinations;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var string Numbers grouping separator
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var int Decimal places count
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @codeCoverageIgnore
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!self::$combinations) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
while ($combination = $query->read()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $patternGrouping;
- Exclude checks
Spaces must 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 $separatorGrouping;
- Exclude checks
Spaces must 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
] as $type) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $combinations;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::$separatorGrouping = $userModel->getDetail('currency_grouping_separator');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Generate list of possible combinations.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::$combinations[] = $combination;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @codeCoverageIgnore
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param $combinations
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::$separatorDecimal = $userModel->getDetail('currency_decimal_separator');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::$patternGrouping = $userModel->getDetail('currency_grouping_pattern');
- Exclude checks
Spaces must 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 array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
]
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
)->from('vtiger_currency_decimal_separator')->join('cross join', 'vtiger_currency_grouping_pattern')->join('cross join', 'vtiger_currency_grouping_separator')->join('cross join', 'vtiger_currency_symbol_placement')->join('cross join', 'vtiger_no_of_currency_decimals')->createCommand()->query();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var string Numbers grouping pattern
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Store current user preferences.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var bool Truncate zeros in decimal numbers
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
parent::setUpBeforeClass();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::$symbolPlacement = $userModel->getDetail('currency_symbol_placement');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$method = 'append' . \ucfirst($type);
- Exclude checks
Spaces must 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 $separatorDecimal;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var string Currency symbol placement
- Exclude checks
Spaces must 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
'double',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'grouping_pattern' => 'vtiger_currency_grouping_pattern.currency_grouping_pattern',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'decimals' => 'vtiger_no_of_currency_decimals.no_of_currency_decimals',
- Exclude checks
Line exceeds 120 characters; contains 307 characters Open
)->from('vtiger_currency_decimal_separator')->join('cross join', 'vtiger_currency_grouping_pattern')->join('cross join', 'vtiger_currency_grouping_separator')->join('cross join', 'vtiger_currency_symbol_placement')->join('cross join', 'vtiger_no_of_currency_decimals')->createCommand()->query();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($combination['grouping_separator'] !== $combination['decimal_separator']) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Append integer validation data sets to test combinations.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var string Decimal numbers separator
- Exclude checks
Spaces must 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 providerNumbers()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @codeCoverageIgnore
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var array Possible combinations cache
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'integer',
- 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
$query = (new \App\Db\Query())->select(
- Exclude checks
Spaces must 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 $symbolPlacement;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $decimalNum;
- Exclude checks
Spaces must 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
* @codeCoverageIgnore
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userModel = \App\User::getCurrentUserModel();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'symbol_placement' => 'vtiger_currency_symbol_placement.currency_symbol_placement',
- Exclude checks
Spaces must 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
$combination['grouping_separator'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$combination['grouping_pattern'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param $combinations
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldData['fieldname'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$combination['decimals'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
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
$recordModel->set($fieldName, $dbFormat);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$usrFormat,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$combination['grouping_separator'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $decimalSeparator Char used as decimal separator in string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $groupingSeparator Char used to separate groups in 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
$userModel->set('no_of_currency_decimals', $afterDot);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function tearDownAfterClass(): void
- Exclude checks
Spaces must 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
true,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
true,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$combinations[] = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$combination['grouping_separator'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$combinations[] = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$combination['symbol_placement'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$usrFormat .= $combination['decimal_separator'] . $decimals;
- Exclude checks
Spaces must 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 $moduleName Module name
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $userFormat Value in user format
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool $truncate Truncate zeros after decimal separator
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userModel->save();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldData = (new \App\Db\Query())->from('vtiger_field')->where(['uitype' => 7, 'typeofdata' => 'NN~O'])->one();
- Exclude checks
Line exceeds 120 characters; contains 135 characters Open
$usrFormatTruncated = $usrFormat = \str_replace(',', $combination['grouping_separator'], $combination['grouping_pattern']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Module::getModuleName($fieldData['tabid']),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$combinations[] = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$combination['decimals'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldData['fieldname'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$combination['grouping_pattern'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$combination['decimals'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbFormat,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function appendDouble(&$combinations)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$usrFormat .= $combination['decimal_separator'] . $decimals;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$combinations[] = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$usrFormatTruncated,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($userFormat, $recordModel->getDisplayValue($fieldName), 'Display value different than expected ' . $recordModel->get($fieldName) . " !== $dbFormat | userFormat: $userFormat | fieldName: $fieldName | getDisplayValue: " . $recordModel->getDisplayValue($fieldName));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userModel->set('currency_symbol_placement', self::$symbolPlacement);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$combination['symbol_placement'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$combination['symbol_placement'],
- Exclude checks
Spaces must 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
$usrFormatTruncated .= $combination['decimal_separator'] . rtrim($decimals, '0');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$usrFormatTruncated = $usrFormat = \str_replace(',', $combination['grouping_separator'], $combination['grouping_pattern']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$usrFormatTruncated .= $combination['decimal_separator'] . rtrim($decimals, '0');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbFormat,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$combination['decimal_separator'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$combination['decimals'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$combination['symbol_placement'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $combinations;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userModel->set('currency_symbol_placement', $symbolPlacement);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userModel->set('currency_grouping_pattern', $groupingPattern);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel = \Vtiger_Record_Model::getCleanInstance($moduleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbFormat,
- Exclude checks
Spaces must 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
foreach ($this->getCombinations() as $combination) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$usrFormatTruncated = $usrFormat = \str_replace(',', $combination['grouping_separator'], $combination['grouping_pattern']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldData['fieldname'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbFormat,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$combination['decimals'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Module::getModuleName($fieldData['tabid']),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $fieldName Field name
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Module::getModuleName($fieldData['tabid']),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbFormat = $int . '.' . 12312;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$usrFormatTruncated,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $groupingPattern Pattern for grouping
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userModel = \Vtiger_Record_Model::getInstanceById(\App\User::getCurrentUserId(), 'Users');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userModel = \Vtiger_Record_Model::getInstanceById(\App\User::getCurrentUserId(), 'Users');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$usrFormatTruncated = $usrFormat = \str_replace(',', $combination['grouping_separator'], $combination['grouping_pattern']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Module::getModuleName($fieldData['tabid']),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$usrFormatTruncated,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$int = '123456789';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$combination['decimal_separator'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
true,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$combination['grouping_separator'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userModel->set('currency_decimal_separator', self::$separatorDecimal);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userModel->set('truncate_trailing_zeros', self::$truncateTrailingZeros);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$combinations[] = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
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
* @codeCoverageIgnore
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldData['fieldname'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$combination['decimal_separator'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldData['fieldname'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
false,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $symbolPlacement Currency symbol placement in user format
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @dataProvider providerNumbers
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userModel->set('truncate_trailing_zeros', $truncate ? '1' : '0');
- Exclude checks
Line exceeds 120 characters; contains 135 characters Open
$usrFormatTruncated = $usrFormat = \str_replace(',', $combination['grouping_separator'], $combination['grouping_pattern']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$combination['decimal_separator'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$combination['grouping_separator'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Module::getModuleName($fieldData['tabid']),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$combination['symbol_placement'],
- Exclude checks
Spaces must 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 $dbFormat Value in database format
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function testNumbers($moduleName, $fieldName, $userFormat, $dbFormat, $decimalSeparator, $groupingSeparator, $groupingPattern, $afterDot, $symbolPlacement, $truncate, $correct = true): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Restore current user preferences.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
parent::tearDownAfterClass();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$usrFormat,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($decimals) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
true,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
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
$userModel->set('currency_decimal_separator', $decimalSeparator);
- Exclude checks
Line exceeds 120 characters; contains 289 characters Open
$this->assertSame($userFormat, $recordModel->getDisplayValue($fieldName), 'Display value different than expected ' . $recordModel->get($fieldName) . " !== $dbFormat | userFormat: $userFormat | fieldName: $fieldName | getDisplayValue: " . $recordModel->getDisplayValue($fieldName));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$combination['decimals'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
true,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$combination['decimal_separator'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$combination['grouping_pattern'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Line exceeds 120 characters; contains 135 characters Open
$usrFormatTruncated = $usrFormat = \str_replace(',', $combination['grouping_separator'], $combination['grouping_pattern']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($decimals) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$usrFormat,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbFormat,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Numbers conversion tests.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $afterDot Number of chars after decimal separator
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool $correct Test should be successfull
- Exclude checks
Line exceeds 120 characters; contains 200 characters Open
public function testNumbers($moduleName, $fieldName, $userFormat, $dbFormat, $decimalSeparator, $groupingSeparator, $groupingPattern, $afterDot, $symbolPlacement, $truncate, $correct = true): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldData = (new \App\Db\Query())->from('vtiger_field')->where(['uitype' => 7])->one();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($this->getCombinations() as $combination) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$combination['grouping_pattern'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbFormat,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$combinations[] = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($dbFormat, $recordModel->get($fieldName), 'Database value different than expected | ' . $dbFormat . ' !== ' . $recordModel->get($fieldName));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userModel->set('currency_grouping_pattern', self::$patternGrouping);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldData['fieldname'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $combinations;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$decimals = \substr(12312, 0, $combination['decimals']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$decimals = \substr(10000, 0, $combination['decimals']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
true,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$combination['grouping_pattern'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userModel->save();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbFormat = '123456789';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$combination['decimal_separator'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
false,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Append double validation data sets to test combinations.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$combination['symbol_placement'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Module::getModuleName($fieldData['tabid']),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
false,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbFormat = $int . '.' . 10000;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$combination['grouping_separator'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$combination['grouping_pattern'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userModel->set('currency_grouping_separator', $groupingSeparator);
- Exclude checks
Spaces must 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
Line exceeds 120 characters; contains 167 characters Open
$this->assertSame($dbFormat, $recordModel->get($fieldName), 'Database value different than expected | ' . $dbFormat . ' !== ' . $recordModel->get($fieldName));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @throws \Exception
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userModel->set('currency_grouping_separator', self::$separatorGrouping);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userModel->set('no_of_currency_decimals', self::$decimalNum);
- Exclude checks
Class name "Z_StringFormatting" is not in camel caps format Open
class Z_StringFormatting extends \Tests\Base
- Exclude checks
Expected 0 spaces after opening bracket; newline found Open
foreach (
- Exclude checks