Function getQuickCreateModules
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
public static function getQuickCreateModules($restrictList = false, $tree = false): array
{
$restrictListString = $restrictList ? 1 : 0;
if ($tree) {
$userModel = \App\User::getCurrentUserModel();
- 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 class Module has an overall complexity of 62 which is very high. The configured complexity threshold is 50. Open
class Module
{
/**
* Cache for tabdata.php.
*
- Exclude checks
Method getQuickCreateModules
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getQuickCreateModules($restrictList = false, $tree = false): array
{
$restrictListString = $restrictList ? 1 : 0;
if ($tree) {
$userModel = \App\User::getCurrentUserModel();
File Module.php
has 251 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace App;
/**
Function createModuleMetaFile
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function createModuleMetaFile()
{
Cache::delete('moduleTabs', 'all');
Cache::delete('getTrackingModules', 'all');
$filename = ROOT_DIRECTORY . '/user_privileges/tabdata.php';
- 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 getQuickCreateModules() has an NPath complexity of 1632. The configured NPath complexity threshold is 200. Open
public static function getQuickCreateModules($restrictList = false, $tree = false): array
{
$restrictListString = $restrictList ? 1 : 0;
if ($tree) {
$userModel = \App\User::getCurrentUserModel();
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method getQuickCreateModules() has a Cyclomatic Complexity of 16. The configured cyclomatic complexity threshold is 10. Open
public static function getQuickCreateModules($restrictList = false, $tree = false): array
{
$restrictListString = $restrictList ? 1 : 0;
if ($tree) {
$userModel = \App\User::getCurrentUserModel();
- 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
Refactor this function to reduce its Cognitive Complexity from 34 to the 15 allowed. Open
public static function getQuickCreateModules($restrictList = false, $tree = false): array
- Read upRead up
- Exclude checks
Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.
See
Reduce the number of returns of this function 4, down to the maximum allowed 3. Open
public static function getQuickCreateModules($restrictList = false, $tree = false): array
- Read upRead up
- Exclude checks
Having too many return statements in a function increases the function's essential complexity because the flow of execution is broken each time a return statement is encountered. This makes it harder to read and understand the logic of the function.
Noncompliant Code Example
With the default threshold of 3:
function myFunction(){ // Noncompliant as there are 4 return statements if (condition1) { return true; } else { if (condition2) { return false; } else { return true; } } return false; }
Avoid using undefined variables such as '$actionSecure' which will lead to PHP notices. Open
$actionSecure[$actionid] = $actionname;
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$actionSecure' which will lead to PHP notices. Open
'actionName' => $actionSecure,
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
The class Module has a coupling between objects value of 15. Consider to reduce the number of dependencies under 13. Open
class Module
{
/**
* Cache for tabdata.php.
*
- Read upRead up
- Exclude checks
CouplingBetweenObjects
Since: 1.1.0
A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability
Example
class Foo {
/**
* @var \foo\bar\X
*/
private $x = null;
/**
* @var \foo\bar\Y
*/
private $y = null;
/**
* @var \foo\bar\Z
*/
private $z = null;
public function setFoo(\Foo $foo) {}
public function setBar(\Bar $bar) {}
public function setBaz(\Baz $baz) {}
/**
* @return \SplObjectStorage
* @throws \OutOfRangeException
* @throws \InvalidArgumentException
* @throws \ErrorException
*/
public function process(\Iterator $it) {}
// ...
}
Source https://phpmd.org/rules/design.html#couplingbetweenobjects
The method getQuickCreateModules has a boolean flag argument $restrictList, which is a certain sign of a Single Responsibility Principle violation. Open
public static function getQuickCreateModules($restrictList = false, $tree = false): array
- 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 '192', column '25'). Open
$formattedName = new \yii\db\Expression(rtrim($sqlString, ',\' \',') . ')');
- 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 getSharingModuleList has a boolean flag argument $eliminateModules, which is a certain sign of a Single Responsibility Principle violation. Open
public static function getSharingModuleList($eliminateModules = 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 getAllModuleNamesFilter has a boolean flag argument $presence, which is a certain sign of a Single Responsibility Principle violation. Open
public static function getAllModuleNamesFilter($isEntityType = true, $showRestricted = false, $presence = false): array
- 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 '347', column '16'). Open
$query = new \App\Db\Query();
- 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 '64', column '23'). Open
$dataReader = (new \App\Db\Query())->from('vtiger_entityname')->createCommand()->query();
- 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 getAllModuleNamesFilter has a boolean flag argument $isEntityType, which is a certain sign of a Single Responsibility Principle violation. Open
public static function getAllModuleNamesFilter($isEntityType = true, $showRestricted = false, $presence = false): array
- 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 getAllModuleNamesFilter has a boolean flag argument $showRestricted, which is a certain sign of a Single Responsibility Principle violation. Open
public static function getAllModuleNamesFilter($isEntityType = true, $showRestricted = false, $presence = false): array
- 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 getQuickCreateModules has a boolean flag argument $tree, which is a certain sign of a Single Responsibility Principle violation. Open
public static function getQuickCreateModules($restrictList = false, $tree = false): array
- 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 getAllEntityModuleInfo has a boolean flag argument $sort, which is a certain sign of a Single Responsibility Principle violation. Open
public static function getAllEntityModuleInfo($sort = 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
Avoid using static access to class 'App\Cache' in method 'createModuleMetaFile'. Open
Cache::delete('getTrackingModules', 'all');
- 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\UserPrivilegesFile' in method 'changeType'. Open
UserPrivilegesFile::recalculateAll();
- 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 getSqlForNameInDisplayFormat uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$fieldsName = array_pop($fieldsName);
$formattedName = "{$db->quoteTableName($entityFieldInfo['tablename'])}.{$db->quoteColumnName($fieldsName)}";
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class 'App\Utils' in method 'createModuleMetaFile'. Open
$content = '$tab_seq_array=' . Utils::varExport($moduleMeta['tabPresence']) . ";\n";
- 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\PrivilegeUtil' in method 'changeType'. Open
if ($moduleModel && $moduleModel->changeType($type) && PrivilegeUtil::modifyPermissions($moduleName, ['RecordPdfInventory'], \Vtiger_Module_Model::ADVANCED_TYPE === $type)) {
- 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\Language' in method 'getAllModuleNamesFilter'. Open
$modules[$value['name']] = Language::translate($value['name'], $value['name']);
- 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 '\Users_Privileges_Model' in method 'getQuickCreateModules'. Open
$userPrivModel = \Users_Privileges_Model::getCurrentUserPrivilegesModel();
- 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\Functions' in method 'getModuleMeta'. Open
$allModules = \vtlib\Functions::getAllModules(false, 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
Avoid using static access to class 'App\Cache' in method 'getEntitiesInfo'. Open
return Cache::get($cacheName, '');
- 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_Module_Model' in method 'changeType'. Open
$moduleModel = \Vtiger_Module_Model::getInstance($moduleName);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\vtlib\Functions' in method 'getAllModuleNamesFilter'. Open
foreach (\vtlib\Functions::getAllModules($isEntityType, $showRestricted, $presence) as $value) {
- 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 'getQuickCreateModules'. Open
$quickCreateModulesTreeCache = \App\Cache::get('getQuickCreateModules', 'tree' . $restrictListString . $userModel->getDetail('roleid'));
- 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 'getQuickCreateModules'. Open
$quickCreateModules = \App\Cache::get('getQuickCreateModules', $restrictListString);
- 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_Module_Model' in method 'getQuickCreateModules'. Open
$moduleModel = \Vtiger_Module_Model::getInstanceFromArray($row);
- 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 'getQuickCreateModules'. Open
\App\Cache::save('getQuickCreateModules', 'tree' . $restrictListString . $userPrivModel->get('roleid'), $quickCreateModulesTree);
- 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 'getEntitiesInfo'. Open
if (!Cache::has($cacheName, '')) {
- 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_Menu_Model' in method 'getQuickCreateModules'. Open
$menu = \Vtiger_Menu_Model::getAll();
- 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\Utils' in method 'createModuleMetaFile'. Open
if (!Utils::saveToFile($filename, $content)) {
- 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\Log' in method 'createModuleMetaFile'. Open
Log::error("The file $filename does not exist");
- 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\Functions' in method 'getSharingModuleList'. Open
$modules = \vtlib\Functions::getAllModules(true, true, 0, false, 0);
- 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 'getSqlForNameInDisplayFormat'. 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
The method createModuleMetaFile uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
Log::error("The file $filename is not writable");
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method getQuickCreateModules uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$quickCreateModules = \App\Cache::get('getQuickCreateModules', $restrictListString);
if (false !== $quickCreateModules) {
return $quickCreateModules;
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class 'App\Cache' in method 'getEntitiesInfo'. Open
return Cache::save($cacheName, '', $entityInfos);
- 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 'getActionId'. Open
return Cache::get('getActionId', $action);
- 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 'getActionId'. Open
Cache::save('getActionId', $action, $actionId, Cache::LONG);
- 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\Utils' in method 'createModuleMetaFile'. Open
$content .= 'return ' . Utils::varExport($moduleMeta) . ";\n";
- 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 getQuickCreateModules uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$query->andWhere(['quickcreate' => [0, 2]])
->andWhere(['<>', 'vtiger_tab.type', 1]);
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\App\Cache' in method 'getQuickCreateModules'. Open
\App\Cache::save('getQuickCreateModules', $restrictListString, $quickCreateModules);
- 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 'createModuleMetaFile'. Open
Cache::delete('moduleTabs', 'all');
- 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\Log' in method 'createModuleMetaFile'. Open
Log::error("The file $filename is not writable");
- 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 createModuleMetaFile uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
Log::error("The file $filename does not exist");
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\App\User' in method 'getQuickCreateModules'. Open
$userModel = \App\User::getCurrentUserModel();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'App\Cache' in method 'getActionId'. Open
if (Cache::has('getActionId', $action)) {
- 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 "getQuickCreateModules" 4 times. Open
$quickCreateModulesTreeCache = \App\Cache::get('getQuickCreateModules', 'tree' . $restrictListString . $userModel->getDetail('roleid'));
- 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 "tabName" 4 times. Open
static::$tabdataCache['tabName'] = array_flip(static::$tabdataCache['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.
Define a constant instead of duplicating this literal "getActionId" 3 times. Open
if (Cache::has('getActionId', $action)) {
- 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 "tabPresence" 4 times. Open
$isActive = (isset(static::$tabdataCache['tabPresence'][$moduleId]) && 0 == static::$tabdataCache['tabPresence'][$moduleId]);
- 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
static::$tabdataCache['tabName'] = array_flip(static::$tabdataCache['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.
Doc-block of $moduleName
in getEntityInfo
is phpdoc param type string
which is not a permitted replacement of the nullable param type ?string
declared in the signature ('?T' should be documented as 'T|null' or '?T') Open
* @param string $moduleName
- Exclude checks
Call to undeclared method \App\Db\Query::distinct
Open
$dataReader = $query->distinct()->createCommand()->query();
- Exclude checks
Argument 2 (key)
is 0|1
but \App\Cache::get()
takes string
defined at /code/app/Cache.php:61
Open
$quickCreateModules = \App\Cache::get('getQuickCreateModules', $restrictListString);
- Exclude checks
Call to method getCurrentUserModel
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
$userModel = \App\User::getCurrentUserModel();
- Exclude checks
Argument 2 (key)
is 0|1
but \App\Cache::save()
takes string
defined at /code/app/Cache.php:89
Open
\App\Cache::save('getQuickCreateModules', $restrictListString, $quickCreateModules);
- Exclude checks
When fetching an array index from a value of type array,
found an array index of type ?string,
but expected the index to be of the non-nullable type int|string
Open
return self::getEntitiesInfo()[$moduleName] ?? null;
- Exclude checks
Call to undeclared method \App\Db::quoteColumnName
Open
$sqlString .= "{$db->quoteTableName($entityFieldInfo['tablename'])}.{$db->quoteColumnName($column)},' ',";
- Exclude checks
Call to method error
from undeclared class \App\Log
Open
Log::error("The file $filename does not exist");
- Exclude checks
Call to undeclared method \App\Db\Query::andWhere
Open
$query->andWhere(['quickcreate' => [0, 2]])
- Exclude checks
Call to undeclared method \App\Db\Query::andWhere
Open
$query->andWhere(['not in', 'vtiger_tab.name', ['ModComments', 'PriceBooks', 'CallHistory', 'OSSMailView']]);
- Exclude checks
When appending to a value of type array{},
found an array access index of type false,
but expected the index to be of type int|string
Open
$items[$quickCreateModules[$child['mod']]->name] = $quickCreateModules[$child['mod']];
- Exclude checks
Call to undeclared method \App\Db::quoteColumnName
Open
$formattedName = "{$db->quoteTableName($entityFieldInfo['tablename'])}.{$db->quoteColumnName($fieldsName)}";
- Exclude checks
Call to undeclared method \App\Db\Query::andWhere
Open
$query->andWhere(['<>', 'vtiger_tab.name', 'Users']);
- Exclude checks
Variable $actionSecure
was undeclared, but array fields are being added to it. Open
$actionSecure[$actionid] = $actionname;
- Exclude checks
Returning type bool
but getEntitiesInfo()
is declared to return array
Open
return Cache::save($cacheName, '', $entityInfos);
- Exclude checks
Call to undeclared method \App\Db::quoteTableName
Open
$formattedName = "{$db->quoteTableName($entityFieldInfo['tablename'])}.{$db->quoteColumnName($fieldsName)}";
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$actionId = (new Db\Query())->select(['actionid'])->from('vtiger_actionmapping')->where(['actionname' => $action])->scalar();
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$dataReader = (new Db\Query())->from(['vtiger_actionmapping'])->createCommand()->query();
- Exclude checks
Default value for array
$eliminateModules
can't be false
Open
public static function getSharingModuleList($eliminateModules = false)
- Exclude checks
Call to method __construct
from undeclared class \yii\db\Expression
Open
$formattedName = new \yii\db\Expression(rtrim($sqlString, ',\' \',') . ')');
- Exclude checks
Saw possibly unextractable annotation for a fragment of comment '* @param array':
after array,
did not see an element name (will guess based on comment order) Open
* @param array
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$dataReader = (new \App\Db\Query())->from('vtiger_entityname')->createCommand()->query();
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$query->select(['vtiger_tab.*'])->from('vtiger_field')
- Exclude checks
Call to undeclared method \App\Db::quoteTableName
Open
$sqlString .= "{$db->quoteTableName($entityFieldInfo['tablename'])}.{$db->quoteColumnName($column)},' ',";
- Exclude checks
Call to method error
from undeclared class \App\Log
Open
Log::error("The file $filename is not writable");
- Exclude checks
Avoid excessively long variable names like $quickCreateModulesTreeCache. Keep variable name length under 20. Open
$quickCreateModulesTreeCache = \App\Cache::get('getQuickCreateModules', 'tree' . $restrictListString . $userModel->getDetail('roleid'));
- 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 $quickCreateModulesTree. Keep variable name length under 20. Open
$quickCreateModulesTree = [];
- 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
A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 15 and the first side effect is on line 396. Open
<?php
- Exclude checks
Avoid variables with short names like $b. Configured minimum length is 3. Open
usort($entity, function ($a, $b) {
- 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
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
Avoid variables with short names like $a. Configured minimum length is 3. Open
usort($entity, function ($a, $b) {
- 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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Gets entity info.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Gets all entities data.
- Exclude checks
Spaces must 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 init()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$tabdataCache['tabName'] = array_flip(static::$tabdataCache['tabId']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getEntitiesInfo(): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $moduleName
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$cacheName = 'ModuleEntityInfo';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array|null
- Exclude checks
Spaces must 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 self::getEntitiesInfo()[$moduleName] ?? null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function initFromDb()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$tabdataCache['tabName'] = array_flip(static::$tabdataCache['tabId']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$tabdataCache = static::getModuleMeta();
- Exclude checks
Spaces must 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
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Init tabdata from file.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getEntityInfo(string $moduleName = null): ?array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected static $tabdataCache;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Init tabdata form db.
- Exclude checks
Spaces must 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
static::$tabdataCache = require ROOT_DIRECTORY . '/user_privileges/tabdata.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
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!Cache::has($cacheName, '')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Cache for tabdata.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
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$row['fieldnameArr'] = $row['fieldname'] ? explode(',', $row['fieldname']) : [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $formattedName;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader = (new \App\Db\Query())->from('vtiger_entityname')->createCommand()->query();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$entity = static::getEntitiesInfo();
- 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
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get module id by module name.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return static::$tabdataCache['tabId'][$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
Spaces must be used to indent lines; tabs are not allowed Open
$formattedName = "{$db->quoteTableName($entityFieldInfo['tablename'])}.{$db->quoteColumnName($fieldsName)}";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get module nane by module id.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$modules = \vtlib\Functions::getAllModules(true, true, 0, false, 0);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db = \App\Db::getInstance();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$entityFieldInfo = static::getEntityInfo($moduleName);
- 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
$actionId = $actionIds[$action];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$entityInfos[$row['modulename']] = $row;
- Exclude checks
Spaces must 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 whether the module is active.
- Exclude checks
Line exceeds 120 characters; contains 133 characters Open
$isActive = (isset(static::$tabdataCache['tabPresence'][$moduleId]) && 0 == static::$tabdataCache['tabPresence'][$moduleId]);
- Exclude checks
Spaces must 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 int $tabId
- Exclude checks
Spaces must 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 static::$tabdataCache['tabName'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$eliminateModules || !\in_array($row['name'], $eliminateModules)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getActionId($action)
- Exclude checks
Spaces must 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 bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return int
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $eliminateModules
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($modules as $row) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$sqlString = 'CONCAT(';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($actionIds[$action])) {
- Exclude checks
Spaces must 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 static::$isModuleActiveCache[$moduleName];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must 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 getSharingModuleList($eliminateModules = false)
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
$sqlString .= "{$db->quoteTableName($entityFieldInfo['tablename'])}.{$db->quoteColumnName($column)},' ',";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $action
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get module owner by module id.
- Exclude checks
Spaces must 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
$sharingModules = [];
- Exclude checks
Spaces must 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 $entity;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$isActive = (isset(static::$tabdataCache['tabPresence'][$moduleId]) && 0 == static::$tabdataCache['tabPresence'][$moduleId]);
- Exclude checks
Spaces must 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 getAllModuleNames()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get sql for name in display format.
- Exclude checks
Spaces must 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
protected static $isModuleActiveCache = [];
- Exclude checks
Spaces must 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 static::$tabdataCache['tabOwnedby'][$tabId] ?? false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get all module names.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $sharingModules;
- 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
$fieldsName = array_pop($fieldsName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($actionId)) {
- Exclude checks
Spaces must 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 (isset(static::$isModuleActiveCache[$moduleName])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $moduleName
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return Cache::get($cacheName, '');
- Exclude checks
Spaces must 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
static::$isModuleActiveCache[$moduleName] = true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool|string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$sharingModules[] = $row['name'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get a action id for a given action name.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return Cache::get('getActionId', $action);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$entityInfos = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleId = static::getModuleId($moduleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$isModuleActiveCache[$moduleName] = $isActive;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\count($fieldsName) > 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
public static function isModuleActive(string $moduleName): bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getModuleId($moduleName)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return static::$tabdataCache['tabName'][$tabId] ?? false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $tabId
- Exclude checks
Spaces must 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 getSqlForNameInDisplayFormat($moduleName)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($sort) {
- Exclude checks
Spaces must 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
* @return 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
$fieldsName = $entityFieldInfo['fieldnameArr'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$formattedName = new \yii\db\Expression(rtrim($sqlString, ',\' \',') . ')');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (Cache::has('getActionId', $action)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$actionId = (new Db\Query())->select(['actionid'])->from('vtiger_actionmapping')->where(['actionname' => $action])->scalar();
- 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
return Cache::save($cacheName, '', $entityInfos);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\in_array($moduleName, ['CustomView', 'Users', 'Import', 'com_vtiger_workflow', 'PickList'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getModuleName($tabId)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getModuleOwner($tabId)
- Exclude checks
Spaces must 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 get the list of module for which the user defined sharing rules can be defined.
- Exclude checks
Spaces must 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
$sqlString .= "{$db->quoteTableName($entityFieldInfo['tablename'])}.{$db->quoteColumnName($column)},' ',";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return int|null
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Cache::save('getActionId', $action, $actionId, Cache::LONG);
- Exclude checks
Spaces must 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 createModuleMetaFile()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($tree) {
- 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
$quickCreateModulesTree = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$row['searchcolumnArr'] = $row['searchcolumn'] ? explode(',', $row['searchcolumn']) : [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getAllEntityModuleInfo($sort = false)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
usort($entity, function ($a, $b) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $a['sequence'] < $b['sequence'] ? -1 : 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $isActive;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool|int
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($fieldsName as &$column) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($action)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$actionIds = static::$tabdataCache['actionId'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'tabId' => $tabNames,
- Exclude checks
Spaces must 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
$tabNames = $tabPresence = $tabOwned = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//Constructing the actionname=>actionid array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$filename = ROOT_DIRECTORY . '/user_privileges/tabdata.php';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (0 === (int) $row['securitycheck']) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$content = '$tab_seq_array=' . Utils::varExport($moduleMeta['tabPresence']) . ";\n";
- 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
}
- Exclude checks
Spaces must 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
$restrictListString = $restrictList ? 1 : 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get the list of all accessible modules for Quick Create.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array List of Vtiger_Module_Model instances
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $quickCreateModulesTreeCache;
- Exclude checks
Spaces must 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 (false !== $quickCreateModulesTreeCache) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->andWhere(['<>', 'vtiger_tab.type', 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
foreach ($menu as $parent) {
- Exclude checks
Line exceeds 120 characters; contains 182 characters Open
if ($moduleModel && $moduleModel->changeType($type) && PrivilegeUtil::modifyPermissions($moduleName, ['RecordPdfInventory'], \Vtiger_Module_Model::ADVANCED_TYPE === $type)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (is_numeric($actionId)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get module meta data.
- Exclude checks
Spaces must 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 [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (file_exists($filename)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string[]
- Exclude checks
Line exceeds 120 characters; contains 123 characters Open
public static function getAllModuleNamesFilter($isEntityType = true, $showRestricted = false, $presence = false): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool $restrictList
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userModel = \App\User::getCurrentUserModel();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->innerJoin('vtiger_tab', 'vtiger_tab.tabid = vtiger_field.tabid')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($userPrivModel->hasModuleActionPermission($row['tabid'], 'CreateView')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($parent['childs'])) {
- Exclude checks
Spaces must 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 $actionId;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$allModules = \vtlib\Functions::getAllModules(false, true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$actionname = $row['actionname'];
- Exclude checks
Spaces must 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 bool|int $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
foreach (\vtlib\Functions::getAllModules($isEntityType, $showRestricted, $presence) as $value) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$modules[$value['name']] = Language::translate($value['name'], $value['name']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$quickCreateModules = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$actionId = (int) $actionId;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tabOwned[$tabId] = $moduleInfo['ownedby'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleMeta = static::getModuleMeta();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$content .= 'return ' . Utils::varExport($moduleMeta) . ";\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::initFromDb();
- Exclude checks
Spaces must 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 ($tree) {
- Exclude checks
Spaces must 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 ($allModules as $moduleInfo) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'actionName' => $actionSecure,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleModel = \Vtiger_Module_Model::getInstance($moduleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get all module names by filter.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->andWhere(['not in', 'vtiger_tab.name', ['ModComments', 'PriceBooks', 'CallHistory', 'OSSMailView']]);
- 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
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Cache::delete('moduleTabs', 'all');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new Exceptions\NoPermitted("Cannot write file ($filename)");
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Log::error("The file $filename is not writable");
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Log::error("The file $filename does not exist");
- Exclude checks
Spaces must 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 $modules;
- Exclude checks
Line exceeds 120 characters; contains 148 characters Open
$quickCreateModulesTreeCache = \App\Cache::get('getQuickCreateModules', 'tree' . $restrictListString . $userModel->getDetail('roleid'));
- 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
->where(['<>', 'vtiger_tab.presence', 1]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleModel = \Vtiger_Module_Model::getInstanceFromArray($row);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$quickCreateModules[$row['name']] = $moduleModel;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$actionAll[$actionname] = $actionid = (int) $row['actionid'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$actionSecure[$actionid] = $actionname;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $type
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function changeType(string $moduleName, int $type)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userPrivModel = \Users_Privileges_Model::getCurrentUserPrivilegesModel();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->andWhere(['quickcreate' => [0, 2]])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'tabPresence' => $tabPresence,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'actionId' => $actionAll,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (is_writable($filename)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Line exceeds 120 characters; contains 137 characters Open
$actionId = (new Db\Query())->select(['actionid'])->from('vtiger_actionmapping')->where(['actionname' => $action])->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
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$actionAll = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'tabOwnedby' => $tabOwned,
- Exclude checks
Spaces must 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 getAllModuleNamesFilter($isEntityType = true, $showRestricted = false, $presence = false): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $quickCreateModules;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($restrictList) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getModuleMeta()
- 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
* @param bool $tree
- Exclude checks
Spaces must 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->andWhere(['<>', 'vtiger_tab.name', 'Users']);
- 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
$menu = \Vtiger_Menu_Model::getAll();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tabNames[$moduleInfo['name']] = $tabId = (int) $moduleInfo['tabid'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tabPresence[$tabId] = $moduleInfo['presence'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader = (new Db\Query())->from(['vtiger_actionmapping'])->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
* @throws \App\Exceptions\NoPermitted
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($moduleModel && $moduleModel->changeType($type) && PrivilegeUtil::modifyPermissions($moduleName, ['RecordPdfInventory'], \Vtiger_Module_Model::ADVANCED_TYPE === $type)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getQuickCreateModules($restrictList = false, $tree = false): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$quickCreateModules = \App\Cache::get('getQuickCreateModules', $restrictListString);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (false !== $quickCreateModules) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->select(['vtiger_tab.*'])->from('vtiger_field')
- Exclude checks
Line exceeds 120 characters; contains 121 characters Open
$query->andWhere(['not in', 'vtiger_tab.name', ['ModComments', 'PriceBooks', 'CallHistory', 'OSSMailView']]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
UserPrivilegesFile::recalculateAll();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool $showRestricted
- Exclude checks
Spaces must 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 = $query->distinct()->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
* Function to create file about modules.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Cache::delete('getTrackingModules', 'all');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!Utils::saveToFile($filename, $content)) {
- Exclude checks
Spaces must 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 changes the module type.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool $isEntityType
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$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
$quickCreateModulesTreeCache = \App\Cache::get('getQuickCreateModules', 'tree' . $restrictListString . $userModel->getDetail('roleid'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query = new \App\Db\Query();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($tree) {
- Exclude checks
Line exceeds 120 characters; contains 128 characters Open
$quickCreateModulesTree[] = ['name' => $parent['name'], 'icon' => $parent['icon'], 'modules' => $items];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($quickCreateModules)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$items[$quickCreateModules[$child['mod']]->name] = $quickCreateModules[$child['mod']];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($items)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($parent['childs'] as $child) {
- Exclude checks
Spaces must 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
unset($quickCreateModules[$child['mod']]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Cache::save('getQuickCreateModules', 'tree' . $restrictListString . $userPrivModel->get('roleid'), $quickCreateModulesTree);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$quickCreateModulesTree[] = ['name' => $parent['name'], 'icon' => $parent['icon'], 'modules' => $items];
- Exclude checks
Line exceeds 120 characters; contains 125 characters Open
$quickCreateModulesTree[] = ['name' => 'LBL_OTHER', 'icon' => 'yfm-Other', 'modules' => $quickCreateModules];
- Exclude checks
Spaces must 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
$quickCreateModulesTree[] = ['name' => 'LBL_OTHER', 'icon' => 'yfm-Other', 'modules' => $quickCreateModules];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $quickCreateModulesTree;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($quickCreateModules[$child['mod']])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$items = [];
- Exclude checks
Line exceeds 120 characters; contains 141 characters Open
\App\Cache::save('getQuickCreateModules', 'tree' . $restrictListString . $userPrivModel->get('roleid'), $quickCreateModulesTree);
- Exclude checks
Spaces must 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\Cache::save('getQuickCreateModules', $restrictListString, $quickCreateModules);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $quickCreateModules;
- Exclude checks
Spaces must 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