Method createModule
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function createModule(array $moduleInformation)
{
$moduleInformation['entityfieldname'] = strtolower(self::toAlphaNumeric($moduleInformation['entityfieldname']));
$module = new vtlib\Module();
Function getBaseModuleToolsExceptions
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static function getBaseModuleToolsExceptions()
{
$exceptions = [];
$actionIds = (new \App\Db\Query())->select(['actionname', 'actionid'])->from('vtiger_actionmapping')->createCommand()->queryAllByGroup();
foreach (static::$baseModuleToolsExceptions as $moduleName => $moduleException) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
The method checkModuleName() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10. Open
public static function checkModuleName($name): bool
{
return
preg_match('/Settings/i', $name)
|| preg_match('/Api/i', $name)
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
Missing class import via use statement (line '230', column '16'). Open
$block = new vtlib\Block();
- 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 '238', column '17'). Open
$field1 = new vtlib\Field();
- 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 '251', column '17'). Open
$field2 = new vtlib\Field();
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
The method getAll has a boolean flag argument $isEntityType, which is a certain sign of a Single Responsibility Principle violation. Open
public static function getAll($presence = [], $restrictedModulesList = [], $isEntityType = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
The method getModulesCount has a boolean flag argument $onlyActive, which is a certain sign of a Single Responsibility Principle violation. Open
public static function getModulesCount($onlyActive = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Missing class import via use statement (line '279', column '18'). Open
$filter1 = new vtlib\Filter();
- 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 '306', column '8'). Open
(new \App\BatchMethod(['method' => '\App\UserPrivilegesFile::recalculateAll', 'params' => []]))->save();
- 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 '234', column '18'). Open
$blockcf = new vtlib\Block();
- 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 '187', column '20'). Open
$subQuery = (new \App\Db\Query())->select(['tabid'])->from('vtiger_field')->where(['uitype' => 4])->distinct('tabid');
- 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 '65', column '21'). Open
$actionIds = (new \App\Db\Query())->select(['actionname', 'actionid'])->from('vtiger_actionmapping')->createCommand()->queryAllByGroup();
- 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 '188', column '22'). Open
$dataReader = (new \App\Db\Query())->select(['tabid', 'name'])
- 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 '222', column '17'). Open
$module = new vtlib\Module();
- 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 '17'). Open
$query = (new \App\Db\Query())->from('vtiger_tab');
- 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 'getBaseModuleToolsExceptions'. Open
$exceptions[App\Module::getModuleId($moduleName)][$type] = $moduleExceptions;
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Vtiger_Field_Model' in method 'createModule'. Open
$field5 = \Vtiger_Field_Model::init($module->name, \App\Field::SYSTEM_FIELDS['modifiedtime']);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Vtiger_Field_Model' in method 'createModule'. Open
$field4 = \Vtiger_Field_Model::init($module->name, \App\Field::SYSTEM_FIELDS['createdtime']);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Vtiger_Field_Model' in method 'createModule'. Open
$field9 = \Vtiger_Field_Model::init($module->name, \App\Field::SYSTEM_FIELDS['private']);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Vtiger_Field_Model' in method 'createModule'. Open
$field8 = \Vtiger_Field_Model::init($module->name, \App\Field::SYSTEM_FIELDS['shownerid']);
- 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 'getBaseModuleToolsExceptions'. Open
$exceptions[App\Module::getModuleId($moduleName)][$type] = false;
- 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\Module' in method 'disableModule'. Open
\vtlib\Module::toggleModuleAccess($moduleName, false);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method getBaseModuleToolsExceptions uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$exceptions[App\Module::getModuleId($moduleName)][$type] = false;
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\Vtiger_Field_Model' in method 'createModule'. Open
$field7 = \Vtiger_Field_Model::init($module->name, \App\Field::SYSTEM_FIELDS['modifiedby']);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Vtiger_Field_Model' in method 'createModule'. Open
$field3 = \Vtiger_Field_Model::init($module->name, \App\Field::SYSTEM_FIELDS['assigned_user_id']);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Vtiger_Field_Model' in method 'createModule'. Open
$field6 = \Vtiger_Field_Model::init($module->name, \App\Field::SYSTEM_FIELDS['created_user_id']);
- 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\Module' in method 'enableModule'. Open
\vtlib\Module::toggleModuleAccess($moduleName, true);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Define a constant instead of duplicating this literal "entityfieldname" 3 times. Open
$moduleInformation['entityfieldname'] = strtolower(self::toAlphaNumeric($moduleInformation['entityfieldname']));
- 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 "notAllowed" 3 times. Open
'Documents' => ['notAllowed' => ['Import']],
- 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 "Import" 4 times. Open
public static $baseModuleTools = ['Import', 'Export', 'Merge', 'CreateCustomFilter',
- 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" 4 times. Open
$subQuery = (new \App\Db\Query())->select(['tabid'])->from('vtiger_field')->where(['uitype' => 4])->distinct('tabid');
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Avoid unused parameters such as '$presence'. Open
public static function getAll($presence = [], $restrictedModulesList = [], $isEntityType = false)
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
Avoid unused parameters such as '$restrictedModulesList'. Open
public static function getAll($presence = [], $restrictedModulesList = [], $isEntityType = false)
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
Avoid unused parameters such as '$isEntityType'. Open
public static function getAll($presence = [], $restrictedModulesList = [], $isEntityType = false)
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
Saw unextractable annotation for comment '* @return <array of vtiger_module_model>'</array>
Open
* @return <Array of Vtiger_Module_Model>
- Exclude checks
Argument 1 (module)
is false
but \Vtiger_Field_Model::init()
takes string
defined at /code/modules/Vtiger/models/Field.php:93
Open
$field5 = \Vtiger_Field_Model::init($module->name, \App\Field::SYSTEM_FIELDS['modifiedtime']);
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$query = (new \App\Db\Query())->from('vtiger_tab');
- Exclude checks
Call to method getInstance
from undeclared class \App\Fields\RecordNumber
(Did you mean class \Tests\Base\RecordNumber) Open
\App\Fields\RecordNumber::getInstance($module->id)->set('prefix', 'N')->set('cur_id', 1)->save();
- Exclude checks
Argument 1 (module)
is false
but \Vtiger_Field_Model::init()
takes string
defined at /code/modules/Vtiger/models/Field.php:93
Open
$field9 = \Vtiger_Field_Model::init($module->name, \App\Field::SYSTEM_FIELDS['private']);
- Exclude checks
Assigning string
to property but \vtlib\Field->column
is false
Open
$field1->column = $field1->name;
- Exclude checks
Assigning 'string\x28255\x29'
to property but \vtlib\Field->columntype
is false
Open
$field1->columntype = 'string(255)';
- Exclude checks
Assigning 'number'
to property but \vtlib\Field->column
is false
Open
$field2->column = 'number';
- Exclude checks
Assigning 'string\x2832\x29'
to property but \vtlib\Field->columntype
is false
Open
$field2->columntype = 'string(32)';
- Exclude checks
Argument 1 (module)
is false
but \Vtiger_Field_Model::init()
takes string
defined at /code/modules/Vtiger/models/Field.php:93
Open
$field4 = \Vtiger_Field_Model::init($module->name, \App\Field::SYSTEM_FIELDS['createdtime']);
- Exclude checks
Argument 1 (module)
is false
but \Vtiger_Field_Model::init()
takes string
defined at /code/modules/Vtiger/models/Field.php:93
Open
$field8 = \Vtiger_Field_Model::init($module->name, \App\Field::SYSTEM_FIELDS['shownerid']);
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$subQuery = (new \App\Db\Query())->select(['tabid'])->from('vtiger_field')->where(['uitype' => 4])->distinct('tabid');
- Exclude checks
Argument 1 (module)
is false
but \Vtiger_Field_Model::init()
takes string
defined at /code/modules/Vtiger/models/Field.php:93
Open
$field6 = \Vtiger_Field_Model::init($module->name, \App\Field::SYSTEM_FIELDS['created_user_id']);
- Exclude checks
Argument 1 (module)
is false
but \Vtiger_Field_Model::init()
takes string
defined at /code/modules/Vtiger/models/Field.php:93
Open
$field3 = \Vtiger_Field_Model::init($module->name, \App\Field::SYSTEM_FIELDS['assigned_user_id']);
- Exclude checks
Argument 1 (moduleName)
is false
but \Vtiger_Inventory_Model::getInstance()
takes string
defined at /code/modules/Vtiger/models/Inventory.php:50
Open
\Vtiger_Inventory_Model::getInstance($module->name)->createInventoryTables();
- Exclude checks
Parameter $moduleName
has undeclared type \type
Open
public function disableModule($moduleName)
- Exclude checks
Saw unextractable annotation for comment '* @return <array> - List of Vtiger Module Model or sub class instances'</array>
Open
* @return <Array> - List of Vtiger Module Model or sub class instances
- Exclude checks
Assigning string
to property but \vtlib\Module->name
is false
Open
$module->name = ucfirst($moduleInformation['module_name']);
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$actionIds = (new \App\Db\Query())->select(['actionname', 'actionid'])->from('vtiger_actionmapping')->createCommand()->queryAllByGroup();
- Exclude checks
Assigning true
to property but \vtlib\Filter->isdefault
is int
Open
$filter1->isdefault = true;
- Exclude checks
Saw unextractable annotation for comment '* @return <integer> number of modules'</integer>
Open
* @return <integer> number of modules
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$dataReader = (new \App\Db\Query())->select(['tabid', 'name'])
- Exclude checks
Argument 1 (module)
is false
but \Vtiger_Field_Model::init()
takes string
defined at /code/modules/Vtiger/models/Field.php:93
Open
$field7 = \Vtiger_Field_Model::init($module->name, \App\Field::SYSTEM_FIELDS['modifiedby']);
- Exclude checks
Parameter $moduleName
has undeclared type \type
Open
public function enableModule($moduleName)
- Exclude checks
Avoid excessively long variable names like $baseModuleToolsExceptions. Keep variable name length under 20. Open
public static $baseModuleToolsExceptions = [
'Documents' => ['notAllowed' => ['Import']],
'Faq' => ['notAllowed' => ['Import', 'Export']],
'OSSMailView' => ['notAllowed' => 'all'],
'CallHistory' => ['allowed' => ['QuickExportToExcel']],
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $restrictedModulesList. Keep variable name length under 20. Open
public static function getAll($presence = [], $restrictedModulesList = [], $isEntityType = false)
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class Settings_ModuleManager_Module_Model extends Vtiger_Module_Model
- Exclude checks
The class Settings_ModuleManager_Module_Model is not named in CamelCase. Open
class Settings_ModuleManager_Module_Model extends Vtiger_Module_Model
{
/**
* @var string[] Base module tools.
*/
- Read upRead up
- Exclude checks
CamelCaseClassName
Since: 0.2
It is considered best practice to use the CamelCase notation to name classes.
Example
class class_name {
}
Source
Spaces must be used to indent lines; tabs are not allowed Open
public static $baseModuleTools = ['Import', 'Export', 'Merge', 'CreateCustomFilter',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$exceptions = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getUserModuleImportUrl()
- Exclude checks
Spaces must 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 disableModule($moduleName)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\vtlib\Module::toggleModuleAccess($moduleName, false);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Line exceeds 120 characters; contains 130 characters Open
'ReadRecord', 'WorkflowTrigger', 'Dashboard', 'CreateDashboardFilter', 'QuickExportToExcel', 'ExportPdf', 'RecordMapping',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $maxLengthModuleLabel = 25;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'ConfigEditor', 'FieldFormulas', 'VtigerBackup', 'CronTasks', 'Import', 'Tooltip',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var string[] Base module tools.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'ReadRecord', 'WorkflowTrigger', 'Dashboard', 'CreateDashboardFilter', 'QuickExportToExcel', 'ExportPdf', 'RecordMapping',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'OSSMailView' => ['notAllowed' => 'all'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var int Max length module name based on database structure
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getBaseModuleToolsExceptions()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleExceptions[$actionIds[$actionName]] = $actionName;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get the url of new module import.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to enable the module.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($exception as $actionName) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getNonVisibleModulesList()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return 'index.php?module=ModuleManager&parent=Settings&view=ModuleImport';
- Exclude checks
Spaces must 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 (\is_array($exception)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return ['ModTracker', 'Portal', 'Users', 'Integration',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get the url of new module import.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return 'index.php?module=ModuleManager&parent=Settings&view=ModuleImport&mode=importUserModuleStep1';
- Exclude checks
Spaces must 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
|| preg_match('/CustomView/i', $name)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
|| \strlen($name) > static::$maxLengthModuleName
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'RecordMappingList', 'FavoriteRecords', 'WatchingRecords', 'WatchingModule', 'RemoveRelation', 'ReviewingUpdates', 'OpenRecord', 'CloseRecord', 'ReceivingMailNotifications', 'CreateDashboardChartFilter', 'TimeLineList', 'ArchiveRecord', 'ActiveRecord', 'MassTrash', 'MoveToTrash', 'RecordConventer', 'AutoAssignRecord', 'AssignToYourself', 'InterestsConflictUsers', 'RecordCollector', 'Kanban', 'CustomViewAdvCond', 'RecordActivityNotifier', 'WorkflowTriggerWhenRecordIsBlocked', 'TilesView'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'CallHistory' => ['allowed' => ['QuickExportToExcel']],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $maxLengthModuleName = 25;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$exceptions[App\Module::getModuleId($moduleName)][$type] = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//Handling events after disable module
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
|| \in_array(strtolower($name), static::$notAllowedNames)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function that returns all those modules that support Module Sequence Numbering.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$field1->label = $moduleInformation['entityfieldlabel'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$field2->columntype = 'string(32)';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$field2->maximumlength = '32';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$field7 = \Vtiger_Field_Model::init($module->name, \App\Field::SYSTEM_FIELDS['modifiedby']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// Create files
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach (static::$baseModuleToolsExceptions as $moduleName => $moduleException) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$exceptions[App\Module::getModuleId($moduleName)][$type] = $moduleExceptions;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
preg_match('/Settings/i', $name)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
|| class_exists($name)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Static Function to get the instance of Vtiger Module Model for all the modules.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$module->type = (int) $moduleInformation['entitytype'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$block->label = 'LBL_BASIC_INFORMATION';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$field2->table = $module->basetable;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$blockcf->addField($field7);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to check module name.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
|| preg_match('/Vtiger/i', $name)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function which will get count of modules.
- Exclude checks
Spaces must 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
* Create module.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$module->initTables();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$blockcf->label = 'LBL_CUSTOM_INFORMATION';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$field1->name = $moduleInformation['entityfieldname'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** Common fields that should be in every module, linked to vtiger CRM core table */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$field2->uitype = 4;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$field2->typeofdata = 'V~O';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$blockcf->addField($field9);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (1 === $module->type) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
(new \App\BatchMethod(['method' => '\App\UserPrivilegesFile::recalculateAll', 'params' => []]))->save();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var array Not allowed names
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $maxLengthFieldName = 30;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get module base tools exceptions parse to ids.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $exceptions;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getAll($presence = [], $restrictedModulesList = [], $isEntityType = false)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool $onlyActive - if true get count of only active modules else all the modules
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query = (new \App\Db\Query())->from('vtiger_tab');
- Exclude checks
Line exceeds 120 characters; contains 126 characters Open
$subQuery = (new \App\Db\Query())->select(['tabid'])->from('vtiger_field')->where(['uitype' => 4])->distinct('tabid');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['isentitytype' => 1, 'presence' => 0, 'tabid' => $subQuery])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$module = new vtlib\Module();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$blockcf->addField($field8);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// Initialize Webservice support
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $module;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Line exceeds 120 characters; contains 698 characters Open
public static $notAllowedNames = ['__halt_compiler', 'abstract', 'and', 'array', 'as', 'break', 'callable', 'case', 'catch', 'class', 'clone', 'const', 'continue', 'declare', 'default', 'die', 'do', 'echo', 'else', 'elseif', 'empty', 'enddeclare', 'endfor', 'endforeach', 'endif', 'endswitch', 'endwhile', 'eval', 'exit', 'extends', 'final', 'for', 'foreach', 'function', 'global', 'goto', 'if', 'implements', 'include', 'include_once', 'instanceof', 'insteadof', 'interface', 'isset', 'list', 'namespace', 'new', 'or', 'print', 'private', 'protected', 'public', 'require', 'require_once', 'return', 'static', 'switch', 'throw', 'trait', 'try', 'unset', 'use', 'var', 'while', 'xor', 'groups'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getNewModuleImportUrl()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
|| preg_match('/Api/i', $name)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getModulesCount($onlyActive = false)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($onlyActive) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getModulesSupportingSequenceNumbering()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $moduleModels;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get restricted modules list.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$field2->displaytype = 2;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$filter1 = new vtlib\Filter();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$module->initWebservice();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var array Base module tools exceptions.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Documents' => ['notAllowed' => ['Import']],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $maxLengthFieldLabel = 50;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param type $moduleName - name of the module
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function checkModuleName($name): bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
|| preg_match('/[^A-Za-z]/i', $name)
- Exclude checks
Spaces must 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
$dataReader->close();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$module->premium = (int) ($moduleInformation['premium'] ?? 0);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$field1 = new vtlib\Field();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$field1->maximumlength = '255';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$field2->column = 'number';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// Create default custom filter (mandatory)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$filter1->addField($field2)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleExceptions = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$nonVisibleModules = self::getNonVisibleModulesList();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function createModule(array $moduleInformation)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$field1->columntype = 'string(255)';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function toAlphaNumeric($value)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $baseModuleToolsExceptions = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Faq' => ['notAllowed' => ['Import', 'Export']],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var int Max length main field name
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$actionIds = (new \App\Db\Query())->select(['actionname', 'actionid'])->from('vtiger_actionmapping')->createCommand()->queryAllByGroup();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param type $moduleName -- name of the module
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $query->count();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader = (new \App\Db\Query())->select(['tabid', 'name'])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleModels[$row['name']] = self::getInstanceFromArray($row);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $moduleInformation
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$module->label = $moduleInformation['module_label'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$module->setEntityIdentifier($field1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$field3 = \Vtiger_Field_Model::init($module->name, \App\Field::SYSTEM_FIELDS['assigned_user_id']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$blockcf->addField($field3);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// Set sharing access of this module
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// Enable and Disable available tools
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$module->enableTools(static::$baseModuleTools);
- Exclude checks
Line exceeds 120 characters; contains 125 characters Open
'DuplicateRecord', 'MassEdit', 'MassArchived', 'MassActive', 'MassDelete', 'MassAddComment', 'MassTransferOwnership',
- Exclude checks
Line exceeds 120 characters; contains 501 characters Open
'RecordMappingList', 'FavoriteRecords', 'WatchingRecords', 'WatchingModule', 'RemoveRelation', 'ReviewingUpdates', 'OpenRecord', 'CloseRecord', 'ReceivingMailNotifications', 'CreateDashboardChartFilter', 'TimeLineList', 'ArchiveRecord', 'ActiveRecord', 'MassTrash', 'MoveToTrash', 'RecordConventer', 'AutoAssignRecord', 'AssignToYourself', 'InterestsConflictUsers', 'RecordCollector', 'Kanban', 'CustomViewAdvCond', 'RecordActivityNotifier', 'WorkflowTriggerWhenRecordIsBlocked', 'TilesView'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $notAllowedNames = ['__halt_compiler', 'abstract', 'and', 'array', 'as', 'break', 'callable', 'case', 'catch', 'class', 'clone', 'const', 'continue', 'declare', 'default', 'die', 'do', 'echo', 'else', 'elseif', 'empty', 'enddeclare', 'endfor', 'endforeach', 'endif', 'endswitch', 'endwhile', 'eval', 'exit', 'extends', 'final', 'for', 'foreach', 'function', 'global', 'goto', 'if', 'implements', 'include', 'include_once', 'instanceof', 'insteadof', 'interface', 'isset', 'list', 'namespace', 'new', 'or', 'print', 'private', 'protected', 'public', 'require', 'require_once', 'return', 'static', 'switch', 'throw', 'trait', 'try', 'unset', 'use', 'var', 'while', 'xor', 'groups'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var int Max length module label based on database structure
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var int Max length main field label
- Exclude checks
Line exceeds 120 characters; contains 145 characters Open
$actionIds = (new \App\Db\Query())->select(['actionname', 'actionid'])->from('vtiger_actionmapping')->createCommand()->queryAllByGroup();
- Exclude checks
Spaces must 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
//Handling events after enable module
- Exclude checks
Spaces must 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
'Home', ];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to disable a module.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->where(['and', ['presence' => 0], ['NOT IN', 'name', $nonVisibleModules]]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->createCommand()->query();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleInformation['entityfieldname'] = strtolower(self::toAlphaNumeric($moduleInformation['entityfieldname']));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$field1->column = $field1->name;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$filter1->isdefault = true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'DuplicateRecord', 'MassEdit', 'MassArchived', 'MassActive', 'MassDelete', 'MassAddComment', 'MassTransferOwnership',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($moduleException as $type => $exception) {
- Exclude checks
Spaces must 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 enableModule($moduleName)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\vtlib\Module::toggleModuleAccess($moduleName, true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $name
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
|| preg_match('/PickList/i', $name)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
|| \App\Db::getInstance()->isTableExists("u_#__{$name}");
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return parent::getAll([0, 1], self::getNonVisibleModulesList());
- Exclude checks
Spaces must 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
$module->addBlock($blockcf);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$field1->uitype = 2;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$blockcf->addField($field2);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$field4 = \Vtiger_Field_Model::init($module->name, \App\Field::SYSTEM_FIELDS['createdtime']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->addField($field4, 2);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$module->createFiles($field1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $restrictedModulesList
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $isEntityType
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->from('vtiger_tab')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleModels = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array List module names
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$field2 = new vtlib\Field();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$blockcf->addField($field5);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$blockcf->addField($field6);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// Add fields to the filter created
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\Vtiger_Inventory_Model::getInstance($module->name)->createInventoryTables();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$module->addBlock($block);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$field6 = \Vtiger_Field_Model::init($module->name, \App\Field::SYSTEM_FIELDS['created_user_id']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$filter1->name = 'All';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$filter1->presence = 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return <integer> number of modules
- Exclude checks
Spaces must 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
$blockcf = new vtlib\Block();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$field1->typeofdata = 'V~M';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$field2->name = 'number';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return <Array> - List of Vtiger Module Model or sub class instances
- Exclude checks
Spaces must 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
$module->save();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$blockcf->addField($field4);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$field5 = \Vtiger_Field_Model::init($module->name, \App\Field::SYSTEM_FIELDS['modifiedtime']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$module->addFilter($filter1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$module->setDefaultSharing();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Fields\RecordNumber::getInstance($module->id)->set('prefix', 'N')->set('cur_id', 1)->save();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return preg_replace('/[^a-zA-Z0-9_]/', '', $value);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return <Array of Vtiger_Module_Model>
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
while ($row = $dataReader->read()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$block = new vtlib\Block();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->addField($field3, 2)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getUploadDirectory()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $presence
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$subQuery = (new \App\Db\Query())->select(['tabid'])->from('vtiger_field')->where(['uitype' => 4])->distinct('tabid');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getActionsRestrictedModulesList()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return ['Home'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return vtlib\Module
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$module->name = ucfirst($moduleInformation['module_name']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$block->addField($field1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$field2->label = 'FL_NUMBER';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$field8 = \Vtiger_Field_Model::init($module->name, \App\Field::SYSTEM_FIELDS['shownerid']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$field9 = \Vtiger_Field_Model::init($module->name, \App\Field::SYSTEM_FIELDS['private']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->addField($field1, 1)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return 'cache';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Class name "Settings_ModuleManager_Module_Model" is not in camel caps format Open
class Settings_ModuleManager_Module_Model extends Vtiger_Module_Model
- Exclude checks