The class Colors has 12 public methods. Consider refactoring Colors to keep number of public methods under 10. Open
class Colors extends \Tests\Base
{
/**
* Testing generation of colors css.
*/
- 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
Function testAddPicklistColorColumn
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function testAddPicklistColorColumn()
{
$db = \App\Db::getInstance();
$tableSchema = $db->getSchema()->getTableSchema('vtiger_contract_priority', true);
$this->assertNotEmpty($tableSchema, 'Table vtiger_contract_priority not exists');
- 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
Missing class import via use statement (line '81', column '46'). Open
\App\Colors::updatePicklistValueColor((new \App\Db\Query())->select(['fieldid'])->from('vtiger_field')->where(['tabid' => \App\Module::getModuleId('Calendar'), 'fieldname' => 'activitytype'])->scalar(), $picklistValueId, '#A0B584');
- 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 '103', column '26'). Open
$this->assertSame((new \App\Db\Query())->select(['coloractive'])->from('vtiger_tab')->where(['tabid' => $moduleId])->scalar(), 1, 'Returned module color state is different from provided');
- 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 '52', column '26'). Open
$this->assertSame((new \App\Db\Query())->select(['cal_color'])->from('vtiger_users')->where(['id' => \App\User::getActiveAdminId()])->scalar(), '#A0B584', 'Returned user color is different from provided');
- 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 '26'). Open
$this->assertSame((new \App\Db\Query())->select(['coloractive'])->from('vtiger_tab')->where(['tabid' => $moduleId])->scalar(), 0, 'Returned module color state is different from provided');
- 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 '85', column '26'). Open
$this->assertSame((new \App\Db\Query())->select(['color'])->from('vtiger_activitytype')->where(['activitytypeid' => $picklistValueId])->scalar(), '80B584', 'Returned picklist value color is different from default');
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '80', column '27'). Open
$picklistValueId = (new \App\Db\Query())->select(['activitytypeid'])->from('vtiger_activitytype')->where(['activitytype' => 'Call'])->scalar();
- 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 '82', column '26'). Open
$this->assertSame((new \App\Db\Query())->select(['color'])->from('vtiger_activitytype')->where(['activitytypeid' => $picklistValueId])->scalar(), 'A0B584', 'Returned picklist value color is different from provided');
- 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 '170', column '38'). Open
\App\Colors::updateGroupColor((new \App\Db\Query())->select(['groupid'])->from('vtiger_groups')->scalar(), '#E6FAD8');
- 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 '72', column '26'). Open
$this->assertSame((new \App\Db\Query())->select(['color'])->from('vtiger_tab')->where(['tabid' => $moduleId])->scalar(), 'A0B584', 'Returned module color is different from provided');
- 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 '60', column '19'). Open
$groupId = (new \App\Db\Query())->select(['groupid'])->from('vtiger_groups')->scalar();
- 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 '62', column '26'). Open
$this->assertSame((new \App\Db\Query())->select(['color'])->from('vtiger_groups')->where(['groupid' => $groupId])->scalar(), '#A0B584', 'Returned group color is different from provided');
- 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 '84', column '46'). Open
\App\Colors::updatePicklistValueColor((new \App\Db\Query())->select(['fieldid'])->from('vtiger_field')->where(['tabid' => \App\Module::getModuleId('Calendar'), 'fieldname' => 'activitytype'])->scalar(), $picklistValueId, '#80B584');
- 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 '148', column '46'). Open
\App\Colors::addPicklistColorColumn((new \App\Db\Query())->select(['fieldid'])->from('vtiger_field')->where(['tabid' => \App\Module::getModuleId('ServiceContracts'), 'fieldname' => 'contract_priority'])->scalar());
- 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\Module' in method 'testUpdateModuleColor'. Open
$moduleId = \App\Module::getModuleId('Leads');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Colors' in method 'testActiveModuleColor'. Open
\App\Colors::activeModuleColor($moduleId, true, '#A0B584');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Colors' in method 'testUpdatePicklistValueColor'. Open
\App\Colors::updatePicklistValueColor((new \App\Db\Query())->select(['fieldid'])->from('vtiger_field')->where(['tabid' => \App\Module::getModuleId('Calendar'), 'fieldname' => 'activitytype'])->scalar(), $picklistValueId, '#80B584');
- 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 'testUpdatePicklistValueColor'. Open
\App\Colors::updatePicklistValueColor((new \App\Db\Query())->select(['fieldid'])->from('vtiger_field')->where(['tabid' => \App\Module::getModuleId('Calendar'), 'fieldname' => 'activitytype'])->scalar(), $picklistValueId, '#80B584');
- 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 'testGetPicklistFieldsByModule'. Open
$this->assertGreaterThan(0, (\count(\App\Colors::getPicklistFieldsByModule(\App\Module::getModuleId('Leads')))), 'Leads should contain picklists');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Colors' in method 'testGetColor'. Open
$this->assertNotEmpty(\App\Colors::get('', ''), 'Normalized empty color should be random generated');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Colors' in method 'testResetToDefault'. Open
\App\Colors::updateUserColor(\App\User::getActiveAdminId(), '#E6FAD8');
- 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 'testActiveModuleColor'. Open
$moduleId = \App\Module::getModuleId('Leads');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Colors' in method 'testGetAllFilterColors'. Open
$this->assertNotEmpty(\App\Colors::getAllFilterColors(), 'Filter colors should be not empty');
- 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 'testAddPicklistColorColumn'. Open
\App\Colors::addPicklistColorColumn((new \App\Db\Query())->select(['fieldid'])->from('vtiger_field')->where(['tabid' => \App\Module::getModuleId('ServiceContracts'), 'fieldname' => 'contract_priority'])->scalar());
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Colors' in method 'testGenerateColorsCss'. Open
\App\Colors::generate();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Colors' in method 'testUpdateGroupColor'. Open
\App\Colors::updateGroupColor($groupId, '#A0B584');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Colors' in method 'testActiveModuleColor'. Open
$this->assertNotEmpty(\App\Colors::activeModuleColor($moduleId, true, ''), 'Returned module color should be random generated if provided empty string');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Colors' in method 'testGetRandomColor'. Open
$this->assertNotEmpty(\App\Colors::getRandomColor(), 'Generated color should be not empty');
- 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 'testResetToDefault'. Open
$moduleId = \App\Module::getModuleId('Leads');
- 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 'testUpdateUserColor'. Open
$this->assertSame((new \App\Db\Query())->select(['cal_color'])->from('vtiger_users')->where(['id' => \App\User::getActiveAdminId()])->scalar(), '#A0B584', 'Returned user color is different from provided');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Colors' in method 'testUpdatePicklistValueColor'. Open
\App\Colors::updatePicklistValueColor((new \App\Db\Query())->select(['fieldid'])->from('vtiger_field')->where(['tabid' => \App\Module::getModuleId('Calendar'), 'fieldname' => 'activitytype'])->scalar(), $picklistValueId, '#A0B584');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Colors' in method 'testGetColor'. Open
$this->assertSame(\App\Colors::get('A0B584', ''), '#A0B584', 'Color without # prefix should be normalized');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Colors' in method 'testGetPicklistFieldsByModule'. Open
$this->assertGreaterThan(0, (\count(\App\Colors::getPicklistFieldsByModule(\App\Module::getModuleId('Leads')))), 'Leads should contain picklists');
- 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\Cache' in method 'testAddPicklistColorColumn'. Open
\App\Cache::clear();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Colors' in method 'testGetAllFilterColors'. Open
$this->assertNotEmpty(\App\Colors::getAllFilterColors(), 'Filter colors(cached) should be not empty');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Db' in method 'testAddPicklistColorColumn'. Open
$db = \App\Db::getInstance();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Colors' in method 'testResetToDefault'. Open
\App\Colors::updateModuleColor($moduleId, '');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Colors' in method 'testUpdateUserColor'. Open
\App\Colors::updateUserColor(\App\User::getActiveAdminId(), '#A0B584');
- 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 'testUpdateUserColor'. Open
\App\Colors::updateUserColor(\App\User::getActiveAdminId(), '#A0B584');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Colors' in method 'testGetColor'. Open
$this->assertNotEmpty(\App\Colors::get('#', 'fs$gdftd'), 'Normalized empty color(#only) with value should be random generated');
- 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 'testResetToDefault'. Open
\App\Colors::updateUserColor(\App\User::getActiveAdminId(), '#E6FAD8');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Colors' in method 'testGetColor'. Open
$this->assertNotEmpty(\App\Colors::get('', 'fs$gdftd'), 'Normalized empty color with value should be random generated');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Colors' in method 'testAddPicklistColorColumn'. Open
\App\Colors::addPicklistColorColumn((new \App\Db\Query())->select(['fieldid'])->from('vtiger_field')->where(['tabid' => \App\Module::getModuleId('ServiceContracts'), 'fieldname' => 'contract_priority'])->scalar());
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Colors' in method 'testResetToDefault'. Open
\App\Colors::activeModuleColor($moduleId, false, '#A0B584');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Colors' in method 'testUpdateModuleColor'. Open
\App\Colors::updateModuleColor($moduleId, '#A0B584');
- 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 'testUpdatePicklistValueColor'. Open
\App\Colors::updatePicklistValueColor((new \App\Db\Query())->select(['fieldid'])->from('vtiger_field')->where(['tabid' => \App\Module::getModuleId('Calendar'), 'fieldname' => 'activitytype'])->scalar(), $picklistValueId, '#A0B584');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Colors' in method 'testGetColor'. Open
$this->assertNotEmpty(\App\Colors::get('#', ''), 'Normalized empty color(#only) should be random generated');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Colors' in method 'testGenerateColorsCss'. Open
\App\Colors::generate();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Colors' in method 'testResetToDefault'. Open
\App\Colors::updateGroupColor((new \App\Db\Query())->select(['groupid'])->from('vtiger_groups')->scalar(), '#E6FAD8');
- 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 "color" 8 times. Open
$this->assertSame((new \App\Db\Query())->select(['color'])->from('vtiger_groups')->where(['groupid' => $groupId])->scalar(), '#A0B584', 'Returned group color is different from provided');
- 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 "vtiger_groups" 3 times. Open
$groupId = (new \App\Db\Query())->select(['groupid'])->from('vtiger_groups')->scalar();
- 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 "activitytypeid" 3 times. Open
$picklistValueId = (new \App\Db\Query())->select(['activitytypeid'])->from('vtiger_activitytype')->where(['activitytype' => 'Call'])->scalar();
- 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 "/public_html/layouts/resources/colors/picklists.css" 4 times. Open
if (\file_exists(ROOT_DIRECTORY . '/public_html/layouts/resources/colors/picklists.css')) {
- 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 "/app_data/owners_colors.php" 4 times. Open
if (\file_exists(ROOT_DIRECTORY . '/app_data/owners_colors.php')) {
- 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 "/public_html/layouts/resources/colors/modules.css" 4 times. Open
if (\file_exists(ROOT_DIRECTORY . '/public_html/layouts/resources/colors/modules.css')) {
- 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 "vtiger_contract_priority" 4 times. Open
$tableSchema = $db->getSchema()->getTableSchema('vtiger_contract_priority', true);
- 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 "groupid" 3 times. Open
$groupId = (new \App\Db\Query())->select(['groupid'])->from('vtiger_groups')->scalar();
- 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
$this->assertSame((new \App\Db\Query())->select(['color'])->from('vtiger_tab')->where(['tabid' => $moduleId])->scalar(), 'A0B584', 'Returned module color is different from provided');
- 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 "activitytype" 3 times. Open
$picklistValueId = (new \App\Db\Query())->select(['activitytypeid'])->from('vtiger_activitytype')->where(['activitytype' => 'Call'])->scalar();
- 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 "/public_html/layouts/resources/colors/owners.css" 4 times. Open
if (\file_exists(ROOT_DIRECTORY . '/public_html/layouts/resources/colors/owners.css')) {
- 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 "Leads" 4 times. Open
$moduleId = \App\Module::getModuleId('Leads');
- 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 "vtiger_activitytype" 3 times. Open
$picklistValueId = (new \App\Db\Query())->select(['activitytypeid'])->from('vtiger_activitytype')->where(['activitytype' => 'Call'])->scalar();
- 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 "fieldid" 3 times. Open
\App\Colors::updatePicklistValueColor((new \App\Db\Query())->select(['fieldid'])->from('vtiger_field')->where(['tabid' => \App\Module::getModuleId('Calendar'), 'fieldname' => 'activitytype'])->scalar(), $picklistValueId, '#A0B584');
- 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 "vtiger_field" 3 times. Open
\App\Colors::updatePicklistValueColor((new \App\Db\Query())->select(['fieldid'])->from('vtiger_field')->where(['tabid' => \App\Module::getModuleId('Calendar'), 'fieldname' => 'activitytype'])->scalar(), $picklistValueId, '#A0B584');
- 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 "vtiger_tab" 3 times. Open
$this->assertSame((new \App\Db\Query())->select(['color'])->from('vtiger_tab')->where(['tabid' => $moduleId])->scalar(), 'A0B584', 'Returned module color is different from provided');
- 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" 3 times. Open
\App\Colors::updatePicklistValueColor((new \App\Db\Query())->select(['fieldid'])->from('vtiger_field')->where(['tabid' => \App\Module::getModuleId('Calendar'), 'fieldname' => 'activitytype'])->scalar(), $picklistValueId, '#A0B584');
- 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 "A0B584" 3 times. Open
$this->assertSame((new \App\Db\Query())->select(['color'])->from('vtiger_tab')->where(['tabid' => $moduleId])->scalar(), 'A0B584', 'Returned module color is different from provided');
- 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 "#A0B584" 9 times. Open
\App\Colors::updateUserColor(\App\User::getActiveAdminId(), '#A0B584');
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Call to undeclared method \Tests\Settings\Colors::assertSame
Open
$this->assertSame((new \App\Db\Query())->select(['color'])->from('vtiger_activitytype')->where(['activitytypeid' => $picklistValueId])->scalar(), '80B584', 'Returned picklist value color is different from default');
- Exclude checks
Call to undeclared method \Tests\Settings\Colors::assertSame
Open
$this->assertSame((new \App\Db\Query())->select(['coloractive'])->from('vtiger_tab')->where(['tabid' => $moduleId])->scalar(), 1, 'Returned module color state is different from provided');
- Exclude checks
Call to undeclared method \Tests\Settings\Colors::assertNotEmpty
Open
$this->assertNotEmpty(\App\Colors::get('', ''), 'Normalized empty color should be random generated');
- Exclude checks
Call to undeclared method \Tests\Settings\Colors::assertNotEmpty
Open
$this->assertNotEmpty(\App\Colors::get('#', ''), 'Normalized empty color(#only) should be random generated');
- Exclude checks
Call to undeclared method \Tests\Settings\Colors::assertFileExists
Open
$this->assertFileExists(ROOT_DIRECTORY . '/app_data/owners_colors.php', 'File "/app_data/owners_colors.php" not exists');
- Exclude checks
Call to undeclared method \App\Db::getSchema
Open
$tableSchema = $db->getSchema()->getTableSchema('vtiger_contract_priority', true);
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$this->assertSame((new \App\Db\Query())->select(['coloractive'])->from('vtiger_tab')->where(['tabid' => $moduleId])->scalar(), 0, 'Returned module color state is different from provided');
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$groupId = (new \App\Db\Query())->select(['groupid'])->from('vtiger_groups')->scalar();
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
\App\Colors::updateGroupColor((new \App\Db\Query())->select(['groupid'])->from('vtiger_groups')->scalar(), '#E6FAD8');
- Exclude checks
Call to undeclared method \Tests\Settings\Colors::assertFileExists
Open
$this->assertFileExists(ROOT_DIRECTORY . '/public_html/layouts/resources/colors/picklists.css', 'File "/public_html/layouts/resources/colors/picklists.css" not exists');
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$this->assertSame((new \App\Db\Query())->select(['color'])->from('vtiger_groups')->where(['groupid' => $groupId])->scalar(), '#A0B584', 'Returned group color is different from provided');
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
\App\Colors::updatePicklistValueColor((new \App\Db\Query())->select(['fieldid'])->from('vtiger_field')->where(['tabid' => \App\Module::getModuleId('Calendar'), 'fieldname' => 'activitytype'])->scalar(), $picklistValueId, '#80B584');
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$this->assertSame((new \App\Db\Query())->select(['color'])->from('vtiger_activitytype')->where(['activitytypeid' => $picklistValueId])->scalar(), '80B584', 'Returned picklist value color is different from default');
- Exclude checks
Call to undeclared method \Tests\Settings\Colors::assertNotEmpty
Open
$this->assertNotEmpty(\App\Colors::get('', 'fs$gdftd'), 'Normalized empty color with value should be random generated');
- Exclude checks
Call to undeclared method \Tests\Settings\Colors::assertEmpty
Open
$this->assertEmpty($column, 'column color in vtiger_contract_priority should not exists');
- Exclude checks
Call to undeclared method \Tests\Settings\Colors::assertFileDoesNotExist
Open
$this->assertFileDoesNotExist(ROOT_DIRECTORY . '/app_data/owners_colors.php', 'File "/app_data/owners_colors.php" should not exists');
- Exclude checks
Call to undeclared method \Tests\Settings\Colors::assertNotEmpty
Open
$this->assertNotEmpty(\App\Colors::getAllFilterColors(), 'Filter colors(cached) should be not empty');
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
\App\Colors::addPicklistColorColumn((new \App\Db\Query())->select(['fieldid'])->from('vtiger_field')->where(['tabid' => \App\Module::getModuleId('ServiceContracts'), 'fieldname' => 'contract_priority'])->scalar());
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$this->assertSame((new \App\Db\Query())->select(['color'])->from('vtiger_tab')->where(['tabid' => $moduleId])->scalar(), 'A0B584', 'Returned module color is different from provided');
- Exclude checks
Call to undeclared method \Tests\Settings\Colors::assertFileDoesNotExist
Open
$this->assertFileDoesNotExist(ROOT_DIRECTORY . '/public_html/layouts/resources/colors/picklists.css', 'File "/public_html/layouts/resources/colors/picklists.css" should not exists');
- Exclude checks
Call to undeclared method \Tests\Settings\Colors::assertFileExists
Open
$this->assertFileExists(ROOT_DIRECTORY . '/public_html/layouts/resources/colors/owners.css', 'File "/public_html/layouts/resources/colors/owners.css" not exists');
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$picklistValueId = (new \App\Db\Query())->select(['activitytypeid'])->from('vtiger_activitytype')->where(['activitytype' => 'Call'])->scalar();
- Exclude checks
Call to undeclared method \Tests\Settings\Colors::assertGreaterThan
Open
$this->assertGreaterThan(0, (\count(\App\Colors::getPicklistFieldsByModule(\App\Module::getModuleId('Leads')))), 'Leads should contain picklists');
- Exclude checks
Call to undeclared method \Tests\Settings\Colors::assertNotEmpty
Open
$this->assertNotEmpty($tableSchema, 'Table vtiger_contract_priority not exists');
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$db->createCommand()->dropColumn('vtiger_contract_priority', 'color')->execute();
- Exclude checks
Call to undeclared method \Tests\Settings\Colors::assertEmpty
Open
$this->assertEmpty($column, 'Column color should be removed from vtiger_contract_priority');
- Exclude checks
Call to undeclared method \Tests\Settings\Colors::assertFileExists
Open
$this->assertFileExists(ROOT_DIRECTORY . '/public_html/layouts/resources/colors/modules.css', 'File "/public_html/layouts/resources/colors/modules.css" not exists');
- Exclude checks
Call to undeclared method \Tests\Settings\Colors::assertSame
Open
$this->assertSame((new \App\Db\Query())->select(['color'])->from('vtiger_tab')->where(['tabid' => $moduleId])->scalar(), 'A0B584', 'Returned module color is different from provided');
- Exclude checks
Call to undeclared method \App\Db::getSchema
Open
$tableSchema = $db->getSchema()->getTableSchema('vtiger_contract_priority', true);
- Exclude checks
Call to undeclared method \Tests\Settings\Colors::assertNotEmpty
Open
$this->assertNotEmpty($column, 'Column color should exist on vtiger_contract_priority');
- Exclude checks
Call to undeclared method \Tests\Settings\Colors::assertSame
Open
$this->assertSame((new \App\Db\Query())->select(['color'])->from('vtiger_groups')->where(['groupid' => $groupId])->scalar(), '#A0B584', 'Returned group color is different from provided');
- Exclude checks
Call to undeclared method \App\Db::getSchema
Open
$tableSchema = $db->getSchema()->getTableSchema('vtiger_contract_priority', true);
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$this->assertSame((new \App\Db\Query())->select(['cal_color'])->from('vtiger_users')->where(['id' => \App\User::getActiveAdminId()])->scalar(), '#A0B584', 'Returned user color is different from provided');
- Exclude checks
Call to undeclared method \Tests\Settings\Colors::assertSame
Open
$this->assertSame((new \App\Db\Query())->select(['cal_color'])->from('vtiger_users')->where(['id' => \App\User::getActiveAdminId()])->scalar(), '#A0B584', 'Returned user color is different from provided');
- Exclude checks
Call to method getActiveAdminId
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
\App\Colors::updateUserColor(\App\User::getActiveAdminId(), '#E6FAD8');
- Exclude checks
Call to method getActiveAdminId
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
$this->assertSame((new \App\Db\Query())->select(['cal_color'])->from('vtiger_users')->where(['id' => \App\User::getActiveAdminId()])->scalar(), '#A0B584', 'Returned user color is different from provided');
- Exclude checks
Call to undeclared method \Tests\Settings\Colors::assertNotEmpty
Open
$this->assertNotEmpty(\App\Colors::getRandomColor(), 'Generated color should be not empty');
- Exclude checks
Call to undeclared method \Tests\Settings\Colors::assertNotEmpty
Open
$this->assertNotEmpty(\App\Colors::activeModuleColor($moduleId, true, ''), 'Returned module color should be random generated if provided empty string');
- Exclude checks
Call to undeclared method \Tests\Settings\Colors::assertNotEmpty
Open
$this->assertNotEmpty(\App\Colors::getAllFilterColors(), 'Filter colors should be not empty');
- Exclude checks
Call to undeclared method \Tests\Settings\Colors::assertFileDoesNotExist
Open
$this->assertFileDoesNotExist(ROOT_DIRECTORY . '/public_html/layouts/resources/colors/owners.css', 'File "/public_html/layouts/resources/colors/owners.css" should not exists');
- Exclude checks
Call to undeclared method \Tests\Settings\Colors::assertFileDoesNotExist
Open
$this->assertFileDoesNotExist(ROOT_DIRECTORY . '/public_html/layouts/resources/colors/modules.css', 'File "/public_html/layouts/resources/colors/modules.css" should not exists');
- Exclude checks
Call to method getActiveAdminId
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
\App\Colors::updateUserColor(\App\User::getActiveAdminId(), '#A0B584');
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$this->assertSame((new \App\Db\Query())->select(['color'])->from('vtiger_activitytype')->where(['activitytypeid' => $picklistValueId])->scalar(), 'A0B584', 'Returned picklist value color is different from provided');
- Exclude checks
Argument 1 (moduleName)
is bool|int
but \App\Colors::getPicklistFieldsByModule()
takes string
defined at /code/app/Colors.php:209
Open
$this->assertGreaterThan(0, (\count(\App\Colors::getPicklistFieldsByModule(\App\Module::getModuleId('Leads')))), 'Leads should contain picklists');
- Exclude checks
Call to undeclared method \Tests\Settings\Colors::assertSame
Open
$this->assertSame((new \App\Db\Query())->select(['coloractive'])->from('vtiger_tab')->where(['tabid' => $moduleId])->scalar(), 0, 'Returned module color state is different from provided');
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
\App\Colors::updatePicklistValueColor((new \App\Db\Query())->select(['fieldid'])->from('vtiger_field')->where(['tabid' => \App\Module::getModuleId('Calendar'), 'fieldname' => 'activitytype'])->scalar(), $picklistValueId, '#A0B584');
- Exclude checks
Call to undeclared method \Tests\Settings\Colors::assertSame
Open
$this->assertSame((new \App\Db\Query())->select(['color'])->from('vtiger_activitytype')->where(['activitytypeid' => $picklistValueId])->scalar(), 'A0B584', 'Returned picklist value color is different from provided');
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$this->assertSame((new \App\Db\Query())->select(['coloractive'])->from('vtiger_tab')->where(['tabid' => $moduleId])->scalar(), 1, 'Returned module color state is different from provided');
- Exclude checks
Call to undeclared method \Tests\Settings\Colors::assertNotEmpty
Open
$this->assertNotEmpty(\App\Colors::get('#', 'fs$gdftd'), 'Normalized empty color(#only) with value should be random generated');
- Exclude checks
Call to undeclared method \Tests\Settings\Colors::assertSame
Open
$this->assertSame(\App\Colors::get('A0B584', ''), '#A0B584', 'Color without # prefix should be normalized');
- Exclude checks
Avoid variables with short names like $db. Configured minimum length is 3. Open
$db = \App\Db::getInstance();
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertFileDoesNotExist(ROOT_DIRECTORY . '/app_data/owners_colors.php', 'File "/app_data/owners_colors.php" should not exists');
- Exclude checks
Spaces must 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
\App\Colors::updateUserColor(\App\User::getActiveAdminId(), '#A0B584');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function testUpdateModuleColor()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame((new \App\Db\Query())->select(['color'])->from('vtiger_activitytype')->where(['activitytypeid' => $picklistValueId])->scalar(), '80B584', 'Returned picklist value color is different from default');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertNotEmpty(\App\Colors::getAllFilterColors(), 'Filter colors(cached) should be not empty');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertNotEmpty($tableSchema, 'Table vtiger_contract_priority not exists');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Colors::updateModuleColor($moduleId, '');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\file_exists(ROOT_DIRECTORY . '/app_data/owners_colors.php')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\unlink(ROOT_DIRECTORY . '/public_html/layouts/resources/colors/picklists.css');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Colors::updateGroupColor($groupId, '#A0B584');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 191 characters Open
$this->assertSame((new \App\Db\Query())->select(['color'])->from('vtiger_tab')->where(['tabid' => $moduleId])->scalar(), 'A0B584', 'Returned module color is different from provided');
- Exclude checks
Line exceeds 120 characters; contains 151 characters Open
$picklistValueId = (new \App\Db\Query())->select(['activitytypeid'])->from('vtiger_activitytype')->where(['activitytype' => 'Call'])->scalar();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Colors::activeModuleColor($moduleId, true, '#A0B584');
- Exclude checks
Spaces must 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->assertEmpty($column, 'column color in vtiger_contract_priority should not exists');
- Exclude checks
Line exceeds 120 characters; contains 230 characters Open
\App\Colors::addPicklistColorColumn((new \App\Db\Query())->select(['fieldid'])->from('vtiger_field')->where(['tabid' => \App\Module::getModuleId('ServiceContracts'), 'fieldname' => 'contract_priority'])->scalar());
- Exclude checks
Spaces must 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->assertFileDoesNotExist(ROOT_DIRECTORY . '/public_html/layouts/resources/colors/owners.css', 'File "/public_html/layouts/resources/colors/owners.css" should not exists');
- Exclude checks
Line exceeds 120 characters; contains 142 characters Open
$this->assertFileDoesNotExist(ROOT_DIRECTORY . '/app_data/owners_colors.php', 'File "/app_data/owners_colors.php" should not exists');
- Exclude checks
Spaces must 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->assertSame((new \App\Db\Query())->select(['cal_color'])->from('vtiger_users')->where(['id' => \App\User::getActiveAdminId()])->scalar(), '#A0B584', 'Returned user color is different from provided');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame((new \App\Db\Query())->select(['color'])->from('vtiger_tab')->where(['tabid' => $moduleId])->scalar(), 'A0B584', 'Returned module color is different from provided');
- Exclude checks
Spaces must 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->assertSame((new \App\Db\Query())->select(['coloractive'])->from('vtiger_tab')->where(['tabid' => $moduleId])->scalar(), 1, 'Returned module color state is different from provided');
- Exclude checks
Line exceeds 120 characters; contains 196 characters Open
$this->assertSame((new \App\Db\Query())->select(['coloractive'])->from('vtiger_tab')->where(['tabid' => $moduleId])->scalar(), 1, 'Returned module color state is different from provided');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function testGetRandomColor()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (null === $column) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$column = $tableSchema->getColumn((string) 'color');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Testing update user color.
- Exclude checks
Line exceeds 120 characters; contains 213 characters Open
$this->assertSame((new \App\Db\Query())->select(['cal_color'])->from('vtiger_users')->where(['id' => \App\User::getActiveAdminId()])->scalar(), '#A0B584', 'Returned user color is different from provided');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleId = \App\Module::getModuleId('Leads');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 223 characters Open
$this->assertSame((new \App\Db\Query())->select(['color'])->from('vtiger_activitytype')->where(['activitytypeid' => $picklistValueId])->scalar(), '80B584', 'Returned picklist value color is different from default');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function testActiveModuleColor()
- Exclude checks
Line exceeds 120 characters; contains 160 characters Open
$this->assertNotEmpty(\App\Colors::activeModuleColor($moduleId, true, ''), 'Returned module color should be random generated if provided empty string');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Line exceeds 120 characters; contains 171 characters Open
$this->assertFileExists(ROOT_DIRECTORY . '/public_html/layouts/resources/colors/owners.css', 'File "/public_html/layouts/resources/colors/owners.css" not exists');
- Exclude checks
Line exceeds 120 characters; contains 195 characters Open
$this->assertSame((new \App\Db\Query())->select(['color'])->from('vtiger_groups')->where(['groupid' => $groupId])->scalar(), '#A0B584', 'Returned group color is different from provided');
- Exclude checks
Spaces must 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
* Testing color generation.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertNotEmpty(\App\Colors::getRandomColor(), 'Generated color should be not empty');
- Exclude checks
Line exceeds 120 characters; contains 136 characters Open
$this->assertNotEmpty(\App\Colors::get('#', 'fs$gdftd'), 'Normalized empty color(#only) with value should be random generated');
- Exclude checks
Line exceeds 120 characters; contains 196 characters Open
$this->assertSame((new \App\Db\Query())->select(['coloractive'])->from('vtiger_tab')->where(['tabid' => $moduleId])->scalar(), 0, 'Returned module color state is different from provided');
- Exclude checks
Spaces must 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->assertFileDoesNotExist(ROOT_DIRECTORY . '/public_html/layouts/resources/colors/modules.css', 'File "/public_html/layouts/resources/colors/modules.css" should not exists');
- Exclude checks
Line exceeds 120 characters; contains 129 characters Open
$this->assertFileExists(ROOT_DIRECTORY . '/app_data/owners_colors.php', 'File "/app_data/owners_colors.php" not exists');
- Exclude checks
Line exceeds 120 characters; contains 177 characters Open
$this->assertFileExists(ROOT_DIRECTORY . '/public_html/layouts/resources/colors/picklists.css', 'File "/public_html/layouts/resources/colors/picklists.css" not exists');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Line exceeds 120 characters; contains 155 characters Open
$this->assertGreaterThan(0, (\count(\App\Colors::getPicklistFieldsByModule(\App\Module::getModuleId('Leads')))), 'Leads should contain picklists');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Testing activate module color.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertNotEmpty(\App\Colors::activeModuleColor($moduleId, true, ''), 'Returned module color should be random generated if provided empty string');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tableSchema = $db->getSchema()->getTableSchema('vtiger_contract_priority', true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($column) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function testResetToDefault()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleId = \App\Module::getModuleId('Leads');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function testGenerateColorsCss()
- Exclude checks
Spaces must 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 testGetPicklistFieldsByModule()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Testing color normalization.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertNotEmpty(\App\Colors::get('#', 'fs$gdftd'), 'Normalized empty color(#only) with value should be random generated');
- Exclude checks
Spaces must 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 (\file_exists(ROOT_DIRECTORY . '/public_html/layouts/resources/colors/modules.css')) {
- Exclude checks
Line exceeds 120 characters; contains 184 characters Open
$this->assertFileDoesNotExist(ROOT_DIRECTORY . '/public_html/layouts/resources/colors/owners.css', 'File "/public_html/layouts/resources/colors/owners.css" should not exists');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertFileDoesNotExist(ROOT_DIRECTORY . '/public_html/layouts/resources/colors/picklists.css', 'File "/public_html/layouts/resources/colors/picklists.css" should not exists');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertFileExists(ROOT_DIRECTORY . '/app_data/owners_colors.php', 'File "/app_data/owners_colors.php" not exists');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Testing update group color.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Colors::updatePicklistValueColor((new \App\Db\Query())->select(['fieldid'])->from('vtiger_field')->where(['tabid' => \App\Module::getModuleId('Calendar'), 'fieldname' => 'activitytype'])->scalar(), $picklistValueId, '#A0B584');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame((new \App\Db\Query())->select(['color'])->from('vtiger_activitytype')->where(['activitytypeid' => $picklistValueId])->scalar(), 'A0B584', 'Returned picklist value color is different from provided');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Colors::updatePicklistValueColor((new \App\Db\Query())->select(['fieldid'])->from('vtiger_field')->where(['tabid' => \App\Module::getModuleId('Calendar'), 'fieldname' => 'activitytype'])->scalar(), $picklistValueId, '#80B584');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Testing picklist fields by module getter.
- Exclude checks
Line exceeds 120 characters; contains 128 characters Open
$this->assertNotEmpty(\App\Colors::get('', 'fs$gdftd'), 'Normalized empty color with value should be random generated');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Colors::addPicklistColorColumn((new \App\Db\Query())->select(['fieldid'])->from('vtiger_field')->where(['tabid' => \App\Module::getModuleId('ServiceContracts'), 'fieldname' => 'contract_priority'])->scalar());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertNotEmpty($column, 'Column color should exist on vtiger_contract_priority');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Testing update module color.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Line exceeds 120 characters; contains 224 characters Open
$this->assertSame((new \App\Db\Query())->select(['color'])->from('vtiger_activitytype')->where(['activitytypeid' => $picklistValueId])->scalar(), 'A0B584', 'Returned picklist value color is different from provided');
- Exclude checks
Spaces must 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
$db->createCommand()->dropColumn('vtiger_contract_priority', 'color')->execute();
- Exclude checks
Spaces must 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 (\file_exists(ROOT_DIRECTORY . '/public_html/layouts/resources/colors/owners.css')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\unlink(ROOT_DIRECTORY . '/public_html/layouts/resources/colors/modules.css');
- Exclude checks
Spaces must 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
* Testing update picklist value color.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$picklistValueId = (new \App\Db\Query())->select(['activitytypeid'])->from('vtiger_activitytype')->where(['activitytype' => 'Call'])->scalar();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertNotEmpty(\App\Colors::get('#', ''), 'Normalized empty color(#only) should be random generated');
- Exclude checks
Spaces must 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 ($tableSchema) {
- Exclude checks
Spaces must 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
\unlink(ROOT_DIRECTORY . '/public_html/layouts/resources/colors/owners.css');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\unlink(ROOT_DIRECTORY . '/app_data/owners_colors.php');
- Exclude checks
Line exceeds 120 characters; contains 190 characters Open
$this->assertFileDoesNotExist(ROOT_DIRECTORY . '/public_html/layouts/resources/colors/picklists.css', 'File "/public_html/layouts/resources/colors/picklists.css" should not exists');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertFileExists(ROOT_DIRECTORY . '/public_html/layouts/resources/colors/picklists.css', 'File "/public_html/layouts/resources/colors/picklists.css" not exists');
- Exclude checks
Spaces must 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
$db = \App\Db::getInstance();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tableSchema = $db->getSchema()->getTableSchema('vtiger_contract_priority', true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tableSchema = $db->getSchema()->getTableSchema('vtiger_contract_priority', true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Colors::generate();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertFileExists(ROOT_DIRECTORY . '/public_html/layouts/resources/colors/owners.css', 'File "/public_html/layouts/resources/colors/owners.css" not exists');
- Exclude checks
Spaces must 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->assertSame((new \App\Db\Query())->select(['color'])->from('vtiger_groups')->where(['groupid' => $groupId])->scalar(), '#A0B584', 'Returned group color is different from provided');
- Exclude checks
Line exceeds 120 characters; contains 240 characters Open
\App\Colors::updatePicklistValueColor((new \App\Db\Query())->select(['fieldid'])->from('vtiger_field')->where(['tabid' => \App\Module::getModuleId('Calendar'), 'fieldname' => 'activitytype'])->scalar(), $picklistValueId, '#A0B584');
- Exclude checks
Line exceeds 120 characters; contains 240 characters Open
\App\Colors::updatePicklistValueColor((new \App\Db\Query())->select(['fieldid'])->from('vtiger_field')->where(['tabid' => \App\Module::getModuleId('Calendar'), 'fieldname' => 'activitytype'])->scalar(), $picklistValueId, '#80B584');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Testing get all filter colors.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Colors::generate();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function testUpdateUserColor()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function testGetAllFilterColors()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertNotEmpty(\App\Colors::get('', ''), 'Normalized empty color should be random generated');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Testing creation picklist color column.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Cache::clear();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Reset to default values.
- Exclude checks
Line exceeds 120 characters; contains 126 characters Open
\App\Colors::updateGroupColor((new \App\Db\Query())->select(['groupid'])->from('vtiger_groups')->scalar(), '#E6FAD8');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Testing generation of colors css.
- Exclude checks
Spaces must 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 (\file_exists(ROOT_DIRECTORY . '/public_html/layouts/resources/colors/picklists.css')) {
- Exclude checks
Line exceeds 120 characters; contains 173 characters Open
$this->assertFileExists(ROOT_DIRECTORY . '/public_html/layouts/resources/colors/modules.css', 'File "/public_html/layouts/resources/colors/modules.css" not exists');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function testUpdateGroupColor()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$groupId = (new \App\Db\Query())->select(['groupid'])->from('vtiger_groups')->scalar();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Colors::updateModuleColor($moduleId, '#A0B584');
- Exclude checks
Spaces must 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 testUpdatePicklistValueColor()
- Exclude checks
Spaces must 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->assertGreaterThan(0, (\count(\App\Colors::getPicklistFieldsByModule(\App\Module::getModuleId('Leads')))), 'Leads should contain picklists');
- Exclude checks
Spaces must 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->assertNotEmpty(\App\Colors::get('', 'fs$gdftd'), 'Normalized empty color with value should be random generated');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame(\App\Colors::get('A0B584', ''), '#A0B584', 'Color without # prefix should be normalized');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Colors::updateGroupColor((new \App\Db\Query())->select(['groupid'])->from('vtiger_groups')->scalar(), '#E6FAD8');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Colors::activeModuleColor($moduleId, false, '#A0B584');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame((new \App\Db\Query())->select(['coloractive'])->from('vtiger_tab')->where(['tabid' => $moduleId])->scalar(), 0, 'Returned module color state is different from provided');
- Exclude checks
Spaces must 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->assertFileExists(ROOT_DIRECTORY . '/public_html/layouts/resources/colors/modules.css', 'File "/public_html/layouts/resources/colors/modules.css" not exists');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleId = \App\Module::getModuleId('Leads');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$column = $tableSchema->getColumn((string) 'color');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$column = $tableSchema->getColumn((string) 'color');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertEmpty($column, 'Column color should be removed from vtiger_contract_priority');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Colors::updateUserColor(\App\User::getActiveAdminId(), '#E6FAD8');
- Exclude checks
Line exceeds 120 characters; contains 186 characters Open
$this->assertFileDoesNotExist(ROOT_DIRECTORY . '/public_html/layouts/resources/colors/modules.css', 'File "/public_html/layouts/resources/colors/modules.css" should not exists');
- Exclude checks
Spaces must 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->assertNotEmpty(\App\Colors::getAllFilterColors(), 'Filter colors should be not empty');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function testGetColor()
- Exclude checks
Spaces must 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 testAddPicklistColorColumn()
- Exclude checks