Avoid using static access to class '\vtlib\Cron' in method 'moduleHandler'. Open
\vtlib\Cron::register('LBL_UPDATER_RECORDS_COORDINATES', 'OpenStreetMap_UpdaterCoordinates_Cron', 300, 'OpenStreetMap', 1);
- 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\EventHandler' in method 'moduleHandler'. Open
App\EventHandler::setInActive('OpenStreetMap_OpenStreetMapHandler_Handler');
- 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\EventHandler' in method 'moduleHandler'. Open
App\EventHandler::setActive('OpenStreetMap_OpenStreetMapHandler_Handler');
- 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\EventHandler' in method 'moduleHandler'. Open
App\EventHandler::deleteHandler('OpenStreetMap_OpenStreetMapHandler_Handler');
- 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\EventHandler' in method 'moduleHandler'. Open
App\EventHandler::registerHandler('EntityAfterSave', 'OpenStreetMap_OpenStreetMapHandler_Handler', 'Accounts,Leads,Partners,Vendors,Competition,Contacts', '', 3);
- 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 '\vtlib\Cron' in method 'moduleHandler'. Open
\vtlib\Cron::register('LBL_UPDATER_COORDINATES', 'OpenStreetMap_UpdaterCoordinates_Cron', 60, 'OpenStreetMap', 1);
- 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 '\vtlib\Cron' in method 'moduleHandler'. Open
\vtlib\Cron::deregister('LBL_UPDATER_COORDINATES');
- 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 '\vtlib\Cron' in method 'moduleHandler'. Open
\vtlib\Cron::deregister('LBL_UPDATER_RECORDS_COORDINATES');
- 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 "OpenStreetMap_OpenStreetMapHandler_Handler" 4 times. Open
App\EventHandler::registerHandler('EntityAfterSave', 'OpenStreetMap_OpenStreetMapHandler_Handler', 'Accounts,Leads,Partners,Vendors,Competition,Contacts', '', 3);
- 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 "LBL_UPDATER_COORDINATES" 3 times. Open
\vtlib\Cron::register('LBL_UPDATER_COORDINATES', 'OpenStreetMap_UpdaterCoordinates_Cron', 60, 'OpenStreetMap', 1);
- 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 "LBL_UPDATER_RECORDS_COORDINATES" 4 times. Open
\vtlib\Cron::register('LBL_UPDATER_RECORDS_COORDINATES', 'OpenStreetMap_UpdaterCoordinates_Cron', 300, 'OpenStreetMap', 1);
- 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 \App\Db::createCommand
Open
$dbCommand = \App\Db::getInstance()->createCommand();
- Exclude checks
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class OpenStreetMap
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Handler.
- Exclude checks
Spaces must 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
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\vtlib\Cron::register('LBL_UPDATER_COORDINATES', 'OpenStreetMap_UpdaterCoordinates_Cron', 60, 'OpenStreetMap', 1);
- Exclude checks
Line exceeds 120 characters; contains 126 characters Open
\vtlib\Cron::register('LBL_UPDATER_COORDINATES', 'OpenStreetMap_UpdaterCoordinates_Cron', 60, 'OpenStreetMap', 1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\vtlib\Cron::register('LBL_UPDATER_RECORDS_COORDINATES', 'OpenStreetMap_UpdaterCoordinates_Cron', 300, 'OpenStreetMap', 1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ('module.disabled' === $eventType) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
App\EventHandler::registerHandler('EntityAfterSave', 'OpenStreetMap_OpenStreetMapHandler_Handler', 'Accounts,Leads,Partners,Vendors,Competition,Contacts', '', 3);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
App\EventHandler::setInActive('OpenStreetMap_OpenStreetMapHandler_Handler');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\vtlib\Cron::getInstance('LBL_UPDATER_RECORDS_COORDINATES')->updateStatus(\vtlib\Cron::$STATUS_ENABLED);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->update('vtiger_tab', ['customized' => 0], ['name' => $moduleName])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
App\EventHandler::setActive('OpenStreetMap_OpenStreetMapHandler_Handler');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\vtlib\Cron::deregister('LBL_UPDATER_RECORDS_COORDINATES');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function moduleHandler($moduleName, $eventType)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand = \App\Db::getInstance()->createCommand();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\vtlib\Cron::getInstance('LBL_UPDATER_COORDINATES')->updateStatus(\vtlib\Cron::$STATUS_DISABLED);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ('module.preuninstall' === $eventType) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $eventType
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Line exceeds 120 characters; contains 135 characters Open
\vtlib\Cron::register('LBL_UPDATER_RECORDS_COORDINATES', 'OpenStreetMap_UpdaterCoordinates_Cron', 300, 'OpenStreetMap', 1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('module.postinstall' === $eventType) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ('module.enabled' === $eventType) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
App\EventHandler::deleteHandler('OpenStreetMap_OpenStreetMapHandler_Handler');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\vtlib\Cron::deregister('LBL_UPDATER_COORDINATES');
- Exclude checks
Spaces must 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 174 characters Open
App\EventHandler::registerHandler('EntityAfterSave', 'OpenStreetMap_OpenStreetMapHandler_Handler', 'Accounts,Leads,Partners,Vendors,Competition,Contacts', '', 3);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\vtlib\Cron::getInstance('LBL_UPDATER_RECORDS_COORDINATES')->updateStatus(\vtlib\Cron::$STATUS_DISABLED);
- Exclude checks