File PackageUpdate.php
has 400 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/* +**********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
Function update
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
public function update($moduleInstance, $zipfile, $overwrite = true)
{
$module = $this->getModuleNameFromZip($zipfile);
if (null !== $module) {
$zip = \App\Zip::openFile($zipfile, ['checkFiles' => false]);
- 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 PackageUpdate has an overall complexity of 114 which is very high. The configured complexity threshold is 50. Open
class PackageUpdate extends PackageImport
{
public $_migrationinfo = false;
public $listFields = [];
public $listBlocks = [];
- Exclude checks
The class PackageUpdate has 21 public methods. Consider refactoring PackageUpdate to keep number of public methods under 10. Open
class PackageUpdate extends PackageImport
{
public $_migrationinfo = false;
public $listFields = [];
public $listBlocks = [];
- Read upRead up
- Exclude checks
TooManyPublicMethods
Since: 0.1
A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.
By default it ignores methods starting with 'get' or 'set'.
Example
Source https://phpmd.org/rules/codesize.html#toomanypublicmethods
Method updateField
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function updateField($blocknode, $blockInstance, $moduleInstance, $fieldnode, $fieldInstance)
{
// strval used because in $fieldnode there is a SimpleXMLElement object
$fieldInstance->name = (string) ($fieldnode->fieldname);
$fieldInstance->label = (string) ($fieldnode->fieldlabel);
Function handleMigration
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function handleMigration($modulenode, $moduleInstance)
{
$this->parseMigration($modulenode);
$cur_version = $moduleInstance->version;
foreach ($this->_migrations as $migversion => $migrationnode) {
- 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
Function updateField
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function updateField($blocknode, $blockInstance, $moduleInstance, $fieldnode, $fieldInstance)
{
// strval used because in $fieldnode there is a SimpleXMLElement object
$fieldInstance->name = (string) ($fieldnode->fieldname);
$fieldInstance->label = (string) ($fieldnode->fieldlabel);
- 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
PackageUpdate
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class PackageUpdate extends PackageImport
{
public $_migrationinfo = false;
public $listFields = [];
public $listBlocks = [];
Function updateBlocks
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function updateBlocks($modulenode, $moduleInstance)
{
if (empty($modulenode->blocks) || empty($modulenode->blocks->block)) {
return;
}
- 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
Function updateCronTasks
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function updateCronTasks($modulenode)
{
if (empty($modulenode->crons) || empty($modulenode->crons->cron)) {
return;
}
- 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
Method update
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function update($moduleInstance, $zipfile, $overwrite = true)
{
$module = $this->getModuleNameFromZip($zipfile);
if (null !== $module) {
$zip = \App\Zip::openFile($zipfile, ['checkFiles' => false]);
Method updateBlocks
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function updateBlocks($modulenode, $moduleInstance)
{
if (empty($modulenode->blocks) || empty($modulenode->blocks->block)) {
return;
}
Function parseMigration
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function parseMigration($modulenode)
{
if (empty($this->_migrations)) {
$this->_migrations = [];
if (!empty($modulenode->migrations)
- 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
Function updateRelatedlist
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function updateRelatedlist($modulenode, $moduleInstance, $relatedlistnode)
{
$relModuleInstance = Module::getInstance((string) $relatedlistnode->relatedmodule);
$label = $relatedlistnode->label;
$actions = false;
- 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
Function updateInRelatedlist
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function updateInRelatedlist($modulenode, $moduleInstance, $inRelatedListNode)
{
$inRelModuleInstance = Module::getInstance((string) $inRelatedListNode->inrelatedmodule);
$label = $inRelatedListNode->label;
$actions = false;
- 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
Method updateField
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function updateField($blocknode, $blockInstance, $moduleInstance, $fieldnode, $fieldInstance)
Function updateRelatedLists
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function updateRelatedLists($modulenode, $moduleInstance)
{
$moduleInstance->unsetAllRelatedList();
if (!empty($modulenode->relatedlists) && !empty($modulenode->relatedlists->relatedlist)) {
foreach ($modulenode->relatedlists->relatedlist as $relatedlistnode) {
- 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
Function initUpdate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function initUpdate($moduleInstance, $zipfile, $overwrite)
{
$module = $this->getModuleNameFromZip($zipfile);
if (!$moduleInstance || $moduleInstance->name != $module) {
\App\Log::trace('Module name mismatch!', __METHOD__);
- 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
Function updateFields
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function updateFields($blocknode, $blockInstance, $moduleInstance)
{
if (empty($blocknode->fields) || empty($blocknode->fields->field)) {
return;
}
- 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
Function updateCustomViews
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function updateCustomViews($modulenode, $moduleInstance)
{
if (empty($modulenode->customviews) || empty($modulenode->customviews->customview)) {
return;
}
- 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 updateField() has an NPath complexity of 2048. The configured NPath complexity threshold is 200. Open
public function updateField($blocknode, $blockInstance, $moduleInstance, $fieldnode, $fieldInstance)
{
// strval used because in $fieldnode there is a SimpleXMLElement object
$fieldInstance->name = (string) ($fieldnode->fieldname);
$fieldInstance->label = (string) ($fieldnode->fieldlabel);
- 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 updateField() has a Cyclomatic Complexity of 15. The configured cyclomatic complexity threshold is 10. Open
public function updateField($blocknode, $blockInstance, $moduleInstance, $fieldnode, $fieldInstance)
{
// strval used because in $fieldnode there is a SimpleXMLElement object
$fieldInstance->name = (string) ($fieldnode->fieldname);
$fieldInstance->label = (string) ($fieldnode->fieldlabel);
- 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
The method update() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10. Open
public function update($moduleInstance, $zipfile, $overwrite = true)
{
$module = $this->getModuleNameFromZip($zipfile);
if (null !== $module) {
$zip = \App\Zip::openFile($zipfile, ['checkFiles' => false]);
- 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
The method updateBlocks() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10. Open
public function updateBlocks($modulenode, $moduleInstance)
{
if (empty($modulenode->blocks) || empty($modulenode->blocks->block)) {
return;
}
- 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
Class "PackageUpdate" has 21 methods, which is greater than 20 authorized. Split it into smaller classes. Open
class PackageUpdate extends PackageImport
- Read upRead up
- Exclude checks
A class that grows too much tends to aggregate too many responsibilities and inevitably becomes harder to understand and therefore to maintain. Above a specific threshold, it is strongly advised to refactor the class into smaller ones which focus on well defined topics.
Refactor this function to reduce its Cognitive Complexity from 29 to the 15 allowed. Open
public function update($moduleInstance, $zipfile, $overwrite = true)
- 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
Refactor this function to reduce its Cognitive Complexity from 17 to the 15 allowed. Open
public function handleMigration($modulenode, $moduleInstance)
- 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
Refactor this function to reduce its Cognitive Complexity from 19 to the 15 allowed. Open
public function updateField($blocknode, $blockInstance, $moduleInstance, $fieldnode, $fieldInstance)
- 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
The class PackageUpdate has a coupling between objects value of 13. Consider to reduce the number of dependencies under 13. Open
class PackageUpdate extends PackageImport
{
public $_migrationinfo = false;
public $listFields = [];
public $listBlocks = [];
- 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 update has a boolean flag argument $overwrite, which is a certain sign of a Single Responsibility Principle violation. Open
public function update($moduleInstance, $zipfile, $overwrite = true)
- 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 'vtlib\Module' in method 'updateModule'. Open
Module::fireEvent($moduleInstance->name, Module::EVENT_MODULE_PREUPDATE);
- 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_Viewer' in method 'initUpdate'. Open
$zip->unzipFile("$module.png", 'layouts/' . \Vtiger_Viewer::getDefaultLayoutName() . "/skins/images/$module.png");
- 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 update uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
if (!$moduleInstance || $moduleInstance->name != $module) {
\App\Log::error('Module name mismatch!', __METHOD__);
return 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 '\App\Log' in method 'handleMigration'. Open
\App\Log::trace("Migrating to $migversion ... DONE", __METHOD__);
- 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 'updateModule'. Open
Module::fireEvent($moduleInstance->name, Module::EVENT_MODULE_POSTUPDATE);
- 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\Zip' in method 'initUpdate'. Open
$zip = \App\Zip::openFile($zipfile, ['checkFiles' => 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 '\App\Zip' in method 'update'. Open
$zip = \App\Zip::openFile($zipfile, ['checkFiles' => 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 '\App\Log' in method 'update'. Open
\App\Log::error('Module name mismatch!', __METHOD__);
- 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 updateField uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$fieldInstance->columntype = null;
}
- 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 handleMigration uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
// Supress any SQL query failures
\App\Log::trace("SQL: $tablesql ... ", __METHOD__);
\App\Db::getInstance()->createCommand($tablesql)->execute();
\App\Log::trace('DONE', __METHOD__);
- 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 'vtlib\Block' in method 'updateBlocks'. Open
$listBlockBeforeUpdate = Block::getAllForModule($moduleInstance);
- 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 'updateRelatedlist'. Open
$relModuleInstance = Module::getInstance((string) $relatedlistnode->relatedmodule);
- 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 'initUpdate'. Open
\App\Log::trace('Module name mismatch!', __METHOD__);
- 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 'handleMigration'. Open
\App\Log::trace("SQL: $tablesql ... ", __METHOD__);
- 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\Utils' in method 'handleMigration'. Open
if (Utils::isDestructiveSql($tablesql)) {
- 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\Field' in method 'updateBlocks'. Open
$listFieldBeforeUpdate = Field::getAllForModule($moduleInstance);
- 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 updateCronTasks uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$cronTask->status = Cron::$STATUS_ENABLED;
}
- 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 updateBlock uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$blockInstance->display_status = null;
}
- 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\Log' in method 'handleMigration'. Open
\App\Log::trace("SQL: $tablesql ... SKIPPED", __METHOD__);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'vtlib\Cron' in method 'updateCronTasks'. Open
Cron::register("$importCronTask->name", "$importCronTask->handler", "$importCronTask->frequency", "$modulenode->name", "$importCronTask->status", "$importCronTask->sequence", "$importCronTask->description");
- 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 'update'. Open
$moduleInstance = Module::getInstance($moduleInfo['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
The method updateBlocks uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$this->updateBlock($modulenode, $moduleInstance, $blocknode, $blockInstance);
}
- 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\Log' in method 'handleMigration'. Open
\App\Log::trace('DONE', __METHOD__);
- 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\Block' in method 'updateBlocks'. Open
$blockInstance = Block::getInstance((string) $blocknode->blocklabel, $moduleInstance->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
The method updateCustomViews uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$this->updateCustomView($modulenode, $moduleInstance, $customviewnode, $filterInstance);
}
- 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 'vtlib\Filter' in method 'updateCustomViews'. Open
$filterInstance = Filter::getInstance($customviewnode->viewname, $moduleInstance->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
The method updateField uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$moduleInstance->entityfieldname = $fieldInstance->name;
}
- 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\EventHandler' in method 'updateEvents'. Open
\App\EventHandler::registerHandler($eventNode->eventName, $eventNode->className, $eventNode->includeModules, $eventNode->excludeModules, $eventNode->priority, $eventNode->isActive, $moduleId);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'vtlib\Cron' in method 'updateCronTasks'. Open
$cronTasks = Cron::listAllInstancesByModule($modulenode->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 'vtlib\Cron' in method 'updateCronTasks'. Open
$importCronTask->sequence = Cron::nextSequence();
- 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\Link' in method 'updateCustomLinks'. Open
Link::deleteAll($moduleInstance->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\Cron' in method 'updateCronTasks'. Open
Cron::deregister($importCronTask->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 '\App\Log' in method 'handleMigration'. Open
\App\Log::trace("Migrating to $migversion ... STARTED", __METHOD__);
- 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 'updateInRelatedlist'. Open
$inRelModuleInstance = Module::getInstance((string) $inRelatedListNode->inrelatedmodule);
- 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 updateFields uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$this->updateField($blocknode, $blockInstance, $moduleInstance, $fieldnode, $fieldInstance);
}
- 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\Module' in method 'updateEvents'. Open
$moduleId = \App\Module::getModuleId($moduleInstance->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 'vtlib\Field' in method 'updateFields'. Open
$fieldInstance = Field::getInstance((string) $fieldnode->fieldname, $moduleInstance);
- 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 unused parameters such as '$overwrite'. Open
public function initUpdate($moduleInstance, $zipfile, $overwrite)
- 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 '$moduleInstance'. Open
public function updateSharingAccess($modulenode, $moduleInstance)
- 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 '$modulenode'. Open
public function updateInRelatedlist($modulenode, $moduleInstance, $inRelatedListNode)
- 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 '$actionnode'. Open
public function updateAction($modulenode, $moduleInstance, $actionnode)
- 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 '$moduleInstance'. Open
public function updateAction($modulenode, $moduleInstance, $actionnode)
- 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 '$moduleInstance'. Open
public function updateBlock($modulenode, $moduleInstance, $blocknode, $blockInstance)
- 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 '$modulenode'. Open
public function updateBlock($modulenode, $moduleInstance, $blocknode, $blockInstance)
- 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 '$modulenode'. Open
public function updateAction($modulenode, $moduleInstance, $actionnode)
- 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 '$blocknode'. Open
public function updateField($blocknode, $blockInstance, $moduleInstance, $fieldnode, $fieldInstance)
- 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 '$modulenode'. Open
public function updateRelatedlist($modulenode, $moduleInstance, $relatedlistnode)
- 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 possibly unextractable annotation for a fragment of comment '* @param Module Instance of the module to update':
after Module,
did not see an element name (will guess based on comment order) Open
* @param Module Instance of the module to update
- Exclude checks
Class \vtlib\Field
was passed to foreach, but it does not extend Traversable. This may be intentional, because some of that class's declared properties are accessible from this context. (This check excludes dynamic properties) Open
foreach ($listFieldBeforeUpdate as $fieldInstance) {
- Exclude checks
Call to undeclared method \vtlib\PackageUpdate::getHandlerClass
Open
if ($cronTask->getName() == $importCronTask->name && $importCronTask->handler == $cronTask->getHandlerClass()) {
- Exclude checks
Reference to undeclared property \vtlib\PackageUpdate->_migrations
Open
foreach ($this->_migrations as $migversion => $migrationnode) {
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('DONE', __METHOD__);
- Exclude checks
Argument 3 (frequency)
is string
but \vtlib\Cron::register()
takes int
defined at /code/vtlib/Vtiger/Cron.php:398
Open
Cron::register("$importCronTask->name", "$importCronTask->handler", "$importCronTask->frequency", "$modulenode->name", "$importCronTask->status", "$importCronTask->sequence", "$importCronTask->description");
- Exclude checks
Class \vtlib\Block
was passed to foreach, but it does not extend Traversable. This may be intentional, because some of that class's declared properties are accessible from this context. (This check excludes dynamic properties) Open
foreach ($listBlockBeforeUpdate as $blockInstance) {
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
\App\Db::getInstance()->createCommand($tablesql)->execute();
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
\App\Db::getInstance()->createCommand()->delete('vtiger_eventhandlers', ['owner_id' => $moduleId])->execute();
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Module name mismatch!', __METHOD__);
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace("SQL: $tablesql ... ", __METHOD__);
- Exclude checks
Reference to undeclared property \vtlib\PackageUpdate->status
Open
$cronTask->status = Cron::$STATUS_DISABLED;
- Exclude checks
Reference to undeclared property \vtlib\PackageUpdate->_migrations
Open
$this->_migrations["$migrationversion"] = $migrationnode;
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace("SQL: $tablesql ... SKIPPED", __METHOD__);
- Exclude checks
Reference to undeclared property \vtlib\PackageUpdate->_migrations
Open
if (\count($this->_migrations) > 1) {
- Exclude checks
Reference to undeclared property \vtlib\PackageUpdate->_migrations
Open
$this->_migrations = [];
- Exclude checks
Call to undeclared method \vtlib\PackageUpdate::getName
Open
if ($cronTask->getName() == $importCronTask->name && $importCronTask->handler == $cronTask->getHandlerClass()) {
- Exclude checks
Argument 5 (status)
is string
but \vtlib\Cron::register()
takes int
defined at /code/vtlib/Vtiger/Cron.php:398
Open
Cron::register("$importCronTask->name", "$importCronTask->handler", "$importCronTask->frequency", "$modulenode->name", "$importCronTask->status", "$importCronTask->sequence", "$importCronTask->description");
- Exclude checks
Saw possibly unextractable annotation for a fragment of comment '* @param string Zip file name':
after string,
did not see an element name (will guess based on comment order) Open
* @param string Zip file name
- Exclude checks
Saw possibly unextractable annotation for a fragment of comment '* @param bool True for overwriting existing module':
after bool,
did not see an element name (will guess based on comment order) Open
* @param bool True for overwriting existing module
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace("Migrating to $migversion ... STARTED", __METHOD__);
- Exclude checks
Call with 4 arg(s) to \vtlib\Module::unsetRelatedList()
which only takes 3 arg(s) defined at /code/vtlib/Vtiger/Module.php:136
Open
$inRelModuleInstance->unsetRelatedList($moduleInstance, "$label", "$inRelatedListNode->function", $inRelatedListNode->field_name);
- Exclude checks
Call to method error
from undeclared class \App\Log
Open
\App\Log::error('Module name mismatch!', __METHOD__);
- Exclude checks
Reference to undeclared property \vtlib\PackageUpdate->_migrations
Open
if (empty($this->_migrations)) {
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace("Migrating to $migversion ... DONE", __METHOD__);
- Exclude checks
Argument 6 (sequence)
is string
but \vtlib\Cron::register()
takes int
defined at /code/vtlib/Vtiger/Cron.php:398
Open
Cron::register("$importCronTask->name", "$importCronTask->handler", "$importCronTask->frequency", "$modulenode->name", "$importCronTask->status", "$importCronTask->sequence", "$importCronTask->description");
- Exclude checks
Reference to undeclared property \vtlib\PackageUpdate->_migrations
Open
uksort($this->_migrations, 'version_compare');
- Exclude checks
Reference to undeclared property \vtlib\PackageUpdate->status
Open
$cronTask->status = Cron::$STATUS_ENABLED;
- Exclude checks
Avoid excessively long variable names like $listBlockBeforeUpdate. Keep variable name length under 20. Open
$listBlockBeforeUpdate = Block::getAllForModule($moduleInstance);
- 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 $listFieldBeforeUpdate. Keep variable name length under 20. Open
$listFieldBeforeUpdate = Field::getAllForModule($moduleInstance);
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
The property $_migrationinfo is not named in camelCase. Open
class PackageUpdate extends PackageImport
{
public $_migrationinfo = false;
public $listFields = [];
public $listBlocks = [];
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
Property name "$_migrationinfo" should not be prefixed with an underscore to indicate visibility Open
public $_migrationinfo = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Initialize Update.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($this->_modulexml)) {
- Exclude checks
Spaces must 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 mixed $zipfile
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'updates' => 'cache/updates',
- Exclude checks
Spaces must 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 $listBlocks = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $overwrite
- Exclude checks
Spaces must 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 (null !== $module) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($moduleInfos as $moduleInfo) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($moduleInfo['install_sequence'] == $sequence) {
- 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
* Update Module.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Parse migration information from manifest.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function parseMigration($modulenode)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
&& !empty($modulenode->migrations->migration)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->listBlocks[] = (string) ($blocknode->blocklabel);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->updateFields($blocknode, $blockInstance, $moduleInstance);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($blocknode->sequence, $blocknode->display_status)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($blocknode->fields) || empty($blocknode->fields->field)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->updateField($blocknode, $blockInstance, $moduleInstance, $fieldnode, $fieldInstance);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $blockInstance
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldInstance->typeofdata = (string) ($fieldnode->typeofdata);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$picklistvalues = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $moduleInstance
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function update($moduleInstance, $zipfile, $overwrite = true)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$zip = \App\Zip::openFile($zipfile, ['checkFiles' => 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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->updateActions($this->_modulexml, $moduleInstance);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($listBlockBeforeUpdate as $blockInstance) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $modulenode
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$blockInstance->visible = (string) ($blocknode->visible);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Update Fields of the module.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $blockInstance
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldInstance->defaultvalue = (string) ($fieldnode->defaultvalue);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldInstance->quickcreate = (string) ($fieldnode->quickcreate);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($fieldnode->fieldparams)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleInstance->entityidfield = (string) ($fieldnode->entityidentifier->entityidfield);
- Exclude checks
Spaces must 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 $listFields = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$zip = \App\Zip::openFile($zipfile, ['checkFiles' => false]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($zip->statName("$module.png")) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Update Module from zip file.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// If data is not yet available
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->__parseManifestFile($zip);
- Exclude checks
Line exceeds 120 characters; contains 125 characters Open
$this->update($moduleInstance, $this->getTemporaryFilePath($moduleInfo['filepath']), $overwrite);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$cur_version = $moduleInstance->version;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->updateBlock($modulenode, $moduleInstance, $blocknode, $blockInstance);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$blockInstance->increateview = (string) ($blocknode->create_view);
- 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
$fieldInstance->fieldparams = (string) ($fieldnode->fieldparams);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($fieldnode->relatedmodules) && !empty($fieldnode->relatedmodules->relatedmodule)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Module name mismatch!', __METHOD__);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$zip->unzipFile("$module.png", 'layouts/' . \Vtiger_Viewer::getDefaultLayoutName() . "/skins/images/$module.png");
- Exclude checks
Line exceeds 120 characters; contains 130 characters Open
$zip->unzipFile("$module.png", 'layouts/' . \Vtiger_Viewer::getDefaultLayoutName() . "/skins/images/$module.png");
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->updateEvents($this->_modulexml, $moduleInstance);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->_migrations = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Handle migration of the module.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($this->_migrations as $migversion => $migrationnode) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace("SQL: $tablesql ... ", __METHOD__);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$blockInstance = $this->importBlock($modulenode, $moduleInstance, $blocknode);
- Exclude checks
Spaces must 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 ($this->listFields) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function updateBlock($modulenode, $moduleInstance, $blocknode, $blockInstance)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$blockInstance->islist = (string) ($blocknode->islist);
- 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
$fieldInstance->maximumlength = (string) ($fieldnode->maximumlength);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($fieldnode->helpinfo)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleInstance->entityfieldname = (string) ($fieldnode->entityidentifier->fieldname);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// Check related modules associated with this field
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$module = $this->getModuleNameFromZip($zipfile);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->__parseManifestFile($zip);
- Exclude checks
Spaces must 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 ($installSequenceArray as $sequence) {
- Exclude checks
Spaces must 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
$migrationattrs = $migrationnode->attributes();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// Sort the migration details based on version
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace("SQL: $tablesql ... SKIPPED", __METHOD__);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Update Tables 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
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!(\in_array($fieldInstance->name, $this->listFields))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $moduleInstance
- Exclude checks
Spaces must 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
$fieldInstance->uitype = (string) ($fieldnode->uitype);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldInstance->info_type = (string) ($fieldnode->info_type);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($fieldnode->columntype)) {
- Exclude checks
Spaces must 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($fieldnode->summaryfield)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($fieldnode->entityidentifier->fieldname) && !empty($fieldnode->entityidentifier->fieldname)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($fieldnode->picklistvalues->picklistvalue as $picklistvaluenode) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return 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
$module = $this->getModuleNameFromZip($zipfile);
- Exclude checks
Spaces must 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
$this->handleMigration($this->_modulexml, $moduleInstance);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->updateRelatedLists($this->_modulexml, $moduleInstance);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->updateCronTasks($this->_modulexml);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $modulenode
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// Supress any SQL query failures
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->importTables($modulenode);
- 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
// Deleting removed blocks
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!(\in_array($blockInstance->label, $this->listBlocks))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldInstance->name = (string) ($fieldnode->fieldname);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldInstance->generatedtype = (string) ($fieldnode->generatedtype);
- Exclude checks
Spaces must 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($fieldnode->entityidentifier)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (null !== $module) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$zip->unzip([
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleInstance = Module::getInstance($moduleInfo['name']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tablabel = $this->_modulexml->label;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Module::fireEvent($moduleInstance->name, Module::EVENT_MODULE_PREUPDATE);
- Exclude checks
Spaces must 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($modulenode->migrations)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\count($this->_migrations) > 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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $blocknode
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldInstance->columntype = (string) ($fieldnode->columntype);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (true === $moduleBundle) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleInfo = (array) $moduleInfo;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->update($moduleInstance, $this->getTemporaryFilePath($moduleInfo['filepath']), $overwrite);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($modulenode->migrations->migration as $migrationnode) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (version_compare($cur_version, $migversion, '<')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($migrationnode->tables) && !empty($migrationnode->tables->table)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('DONE', __METHOD__);
- Exclude checks
Spaces must 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 mixed $moduleInstance
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$blockInstance->display_status = null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $blockInstance;
- Exclude checks
Spaces must 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;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldInstance->table = (string) ($fieldnode->tablename);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldInstance->column = (string) ($fieldnode->columnname);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $zipfile
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldInstance->displaytype = (string) ($fieldnode->displaytype);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($buildModuleArray as $moduleInfo) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->initUpdate($moduleInstance, $zipfile, $overwrite);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->updateModule($moduleInstance);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleInstance->setEntityIdentifier($fieldInstance);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tabversion = $this->_modulexml->version;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace("Migrating to $migversion ... DONE", __METHOD__);
- Exclude checks
Spaces must 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 updateTables($modulenode)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$blockInstance) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$blockInstance->delete();
- Exclude checks
Spaces must 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 $moduleInstance
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$fieldInstance) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $fieldnode
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $fieldInstance
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldInstance->readonly = (string) ($fieldnode->readonly);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldInstance->sequence = (string) ($fieldnode->sequence);
- 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
// Check picklist values associated with field if any.
- Exclude checks
Spaces must 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 Zip file name
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($moduleList as $moduleInfos) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// Call module update function
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $moduleInstance
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->updateSharingAccess($this->_modulexml, $moduleInstance);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$migrationversion = $migrationattrs['version'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// Perform migration only for higher version than current
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (Utils::isDestructiveSql($tablesql)) {
- Exclude checks
Spaces must 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
$listBlockBeforeUpdate = Block::getAllForModule($moduleInstance);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// Deleting removed fields
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($listFieldBeforeUpdate as $fieldInstance) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$blockInstance->showtitle = (string) ($blocknode->show_title);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$blockInstance->save();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldInstance = Field::getInstance((string) $fieldnode->fieldname, $moduleInstance);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->__AddModuleFieldToCache($moduleInstance, $fieldInstance->name, $fieldInstance);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldInstance->label = (string) ($fieldnode->fieldlabel);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldInstance->presence = (string) ($fieldnode->presence);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldInstance->fieldparams = (string) ($fieldnode->fieldparams);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool True for overwriting existing module
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $overwrite
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($this->_modulexml)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleList = (array) $this->_modulexml->modulelist;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$zip->unzip($this->getTemporaryFilePath());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->updateCustomViews($this->_modulexml, $moduleInstance);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleInstance->__updateVersion($tabversion);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->_migrations["$migrationversion"] = $migrationnode;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
uksort($this->_migrations, 'version_compare');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldInstance->delete();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Update Block of the module.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $moduleInstance
- Exclude checks
Spaces must 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($fieldnode->masseditable)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldInstance->setMassEditable($fieldnode->masseditable);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldInstance->save();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleInstance->entityidcolumn = (string) ($fieldnode->entityidentifier->entityidcolumn);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldInstance->setPicklistValues($picklistvalues);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($fieldnode->relatedmodules->relatedmodule as $relatedmodulenode) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param Module Instance of the module to update
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$installSequenceArray = $buildModuleArray = [];
- Exclude checks
Spaces must 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 updateModule($moduleInstance)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleInstance->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
}
- Exclude checks
Spaces must 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 ($modulenode->blocks->block as $blocknode) {
- Exclude checks
Spaces must 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
$fieldInstance = $this->importField($blocknode, $blockInstance, $moduleInstance, $fieldnode);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function updateField($blocknode, $blockInstance, $moduleInstance, $fieldnode, $fieldInstance)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldInstance->setHelpInfo($fieldnode->helpinfo);
- Exclude checks
Spaces must 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 $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
$moduleBundle = (bool) $this->_modulexml->modulebundle;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$moduleInstance || $moduleInstance->name != $module) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->updateBlocks($this->_modulexml, $moduleInstance);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Module::fireEvent($moduleInstance->name, Module::EVENT_MODULE_POSTUPDATE);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $moduleInstance
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function handleMigration($modulenode, $moduleInstance)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->parseMigration($modulenode);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tablesql = "$tablenode->sql"; // Convert to string
- 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
$listFieldBeforeUpdate = Field::getAllForModule($moduleInstance);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$blockInstance->label = (string) ($blocknode->blocklabel);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$blockInstance->sequence = (string) ($blocknode->sequence);
- Exclude checks
Spaces must 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 initUpdate($moduleInstance, $zipfile, $overwrite)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Update Field 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
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$installSequenceArray[] = $moduleInfo['install_sequence'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldInstance->block = $blockInstance;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($this->_migrations)) {
- Exclude checks
Spaces must 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
$relatedmodules = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $modulenode
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function updateBlocks($modulenode, $moduleInstance)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $blockInstance
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$blockInstance->indetailview = (string) ($blocknode->detail_view);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function updateFields($blocknode, $blockInstance, $moduleInstance)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->listFields[] = (string) ($fieldnode->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
// strval used because in $fieldnode there is a SimpleXMLElement object
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// Check if new parameters are defined
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// Set the field as entity identifier if marked.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($fieldnode->picklistvalues) && !empty($fieldnode->picklistvalues->picklistvalue)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$picklistvalues[] = $picklistvaluenode;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $_migrationinfo = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $moduleInstance
- Exclude checks
Spaces must 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
$buildModuleArray[] = $moduleInfo;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
sort($installSequenceArray);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::error('Module name mismatch!', __METHOD__);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleInstance->label = $tablabel;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->updateCustomLinks($this->_modulexml, $moduleInstance);
- Exclude checks
Spaces must 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
\App\Log::trace("Migrating to $migversion ... STARTED", __METHOD__);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($migrationnode->tables->table as $tablenode) {
- 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
\App\Db::getInstance()->createCommand($tablesql)->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $modulenode
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldInstance->setSummaryField($fieldnode->summaryfield);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleInstance->entityfieldname = $fieldInstance->name;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$moduleInstance || $moduleInstance->name != $module) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// If data is not yet available
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->updateTables($this->_modulexml);
- Exclude checks
Spaces must 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 $modulenode
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// Skip SQL which are destructive
- Exclude checks
Spaces must 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
* Update Blocks of the module.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($modulenode->blocks) || empty($modulenode->blocks->block)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$blockInstance = Block::getInstance((string) $blocknode->blocklabel, $moduleInstance->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
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$blockInstance->ineditview = (string) ($blocknode->edit_view);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$blockInstance->display_status = (string) ($blocknode->display_status);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$blockInstance->iscustom = (string) ($blocknode->iscustom);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $blocknode
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($blocknode->fields->field as $fieldnode) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $blocknode
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldInstance->quicksequence = (string) ($fieldnode->quickcreatesequence);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldInstance->columntype = null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $modulenode
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $moduleInstance
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->updateCustomView($modulenode, $moduleInstance, $customviewnode, $filterInstance);
- Exclude checks
Spaces must 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($modulenode->sharingaccess)) {
- Exclude checks
Spaces must 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;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$relModuleInstance = Module::getInstance((string) $relatedlistnode->relatedmodule);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Db::getInstance()->createCommand()->delete('vtiger_eventhandlers', ['owner_id' => $moduleId])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($cronTask->getName() == $importCronTask->name && $importCronTask->handler == $cronTask->getHandlerClass()) {
- Exclude checks
Spaces must 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
* Update related lists of the module.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($modulenode->relatedlists) && !empty($modulenode->relatedlists->relatedlist)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$label = $relatedlistnode->label;
- Exclude checks
Spaces must 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 ($inRelModuleInstance) {
- Exclude checks
Spaces must 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($modulenode->customlinks) || empty($modulenode->customlinks->customlink)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->importCustomLinks($modulenode, $moduleInstance);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function updateCustomViews($modulenode, $moduleInstance)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->updateInRelatedlist($modulenode, $moduleInstance, $inRelatedListNode);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $relatedlistnode
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$actions = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($inRelatedListNode->fields->field as $fieldNode) {
- Exclude checks
Line exceeds 120 characters; contains 161 characters Open
$inRelModuleInstance->setRelatedList($moduleInstance, "$label", $actions, "$inRelatedListNode->function", "$inRelatedListNode->field_name", $fields);
- Exclude checks
Line exceeds 120 characters; contains 128 characters Open
if ($cronTask->getName() == $importCronTask->name && $importCronTask->handler == $cronTask->getHandlerClass()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldInstance->setRelatedModules($relatedmodules);
- 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
* @param mixed $customviewnode
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->importCustomView($modulenode, $moduleInstance, $customviewnode);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function updateSharingAccess($modulenode, $moduleInstance)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\EventHandler::registerHandler($eventNode->eventName, $eventNode->className, $eventNode->includeModules, $eventNode->excludeModules, $eventNode->priority, $eventNode->isActive, $moduleId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $moduleInstance
- 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
* Import related list of the module.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$inRelModuleInstance = Module::getInstance((string) $inRelatedListNode->inrelatedmodule);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$actions = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fields[] = "$fieldNode";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $inRelModuleInstance;
- Exclude checks
Spaces must 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 (!$filterInstance) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Update Sharing Access 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
* @param mixed $modulenode
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $moduleInstance
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->updateAction($modulenode, $moduleInstance, $actionnode);
- Exclude checks
Spaces must 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
$inRelModuleInstance->unsetRelatedList($moduleInstance, "$label", "$inRelatedListNode->function", $inRelatedListNode->field_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
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
Cron::register("$importCronTask->name", "$importCronTask->handler", "$importCronTask->frequency", "$modulenode->name", "$importCronTask->status", "$importCronTask->sequence", "$importCronTask->description");
- Exclude checks
Spaces must 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 $moduleInstance
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Update actions of the module.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($modulenode->actions) || empty($modulenode->actions->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
foreach ($modulenode->relatedlists->relatedlist as $relatedlistnode) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function updateInRelatedlist($modulenode, $moduleInstance, $inRelatedListNode)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Cron::deregister($importCronTask->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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function updateRelatedLists($modulenode, $moduleInstance)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($modulenode->inrelatedlists->inrelatedlist as $inRelatedListNode) {
- Exclude checks
Spaces must 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 $relModuleInstance;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Import Custom views 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
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
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$filterInstance->delete();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($modulenode->actions->action as $actionnode) {
- Exclude checks
Spaces must 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 ($modulenode->crons->cron as $importCronTask) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($importCronTask->status)) {
- Exclude checks
Spaces must 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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$actions[] = "$actionnode";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$relatedmodules[] = $relatedmodulenode;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleInstance->unsetRelatedList($relModuleInstance, "$label", "$relatedlistnode->function");
- Exclude checks
Spaces must 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 $modulenode
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$actions[] = "$actionnode";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $modulenode
- Exclude checks
Spaces must 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 (empty($modulenode->eventHandlers) || empty($modulenode->eventHandlers->event)) {
- Exclude checks
Spaces must 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 $moduleInstance
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $modulenode
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->updateRelatedlist($modulenode, $moduleInstance, $relatedlistnode);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $moduleInstance
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$actions = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($relatedlistnode->fields)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleInstance->setRelatedList($relModuleInstance, "$label", $actions, "$relatedlistnode->function", "$relatedlistnode->field_name", $fields);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Link::deleteAll($moduleInstance->id);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function updateCronTasks($modulenode)
- Exclude checks
Spaces must 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 ($modulenode->customviews->customview as $customviewnode) {
- Exclude checks
Spaces must 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 updateRelatedlist($modulenode, $moduleInstance, $relatedlistnode)
- Exclude checks
Spaces must 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 updateActions($modulenode, $moduleInstance)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fields = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fields = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($inRelatedListNode->fields)) {
- Exclude checks
Spaces must 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($importCronTask->sequence))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$importCronTask->sequence = Cron::nextSequence();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $fieldInstance;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Update Custom View of the module.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $moduleInstance
- Exclude checks
Spaces must 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($modulenode->inrelatedlists) && !empty($modulenode->inrelatedlists->inrelatedlist)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($relModuleInstance) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$label = $inRelatedListNode->label;
- Exclude checks
Line exceeds 120 characters; contains 142 characters Open
$inRelModuleInstance->unsetRelatedList($moduleInstance, "$label", "$inRelatedListNode->function", $inRelatedListNode->field_name);
- 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
if (empty($modulenode->crons) || empty($modulenode->crons->cron)) {
- Exclude checks
Spaces must 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 ($cronTasks as $cronTask) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$cronTask->status = Cron::$STATUS_DISABLED;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $filterInstance
- 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
$moduleId = \App\Module::getModuleId($moduleInstance->name);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($modulenode->eventHandlers->event as &$eventNode) {
- Exclude checks
Spaces must 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($relatedlistnode->actions) && !empty($relatedlistnode->actions->action)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($relatedlistnode->fields->field as $fieldNode) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fields[] = "$fieldNode";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($inRelatedListNode->actions) && !empty($inRelatedListNode->actions->action)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($inRelatedListNode->actions->action as $actionnode) {
- 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
$filterInstance = Filter::getInstance($customviewnode->viewname, $moduleInstance->id);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($modulenode->customviews) || empty($modulenode->customviews->customview)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->importCustomView($modulenode, $moduleInstance, $customviewnode);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function updateCustomView($modulenode, $moduleInstance, $customviewnode, $filterInstance)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Update Events 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 function updateEvents($modulenode, $moduleInstance)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $modulenode
- Exclude checks
Line exceeds 120 characters; contains 204 characters Open
\App\EventHandler::registerHandler($eventNode->eventName, $eventNode->className, $eventNode->includeModules, $eventNode->excludeModules, $eventNode->priority, $eventNode->isActive, $moduleId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $actionnode
- Exclude checks
Spaces must 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 updateAction($modulenode, $moduleInstance, $actionnode)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $moduleInstance
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $modulenode
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleInstance->unsetAllRelatedList();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Update action of the module.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$actions = 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
* @param mixed $modulenode
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$inRelModuleInstance->setRelatedList($moduleInstance, "$label", $actions, "$inRelatedListNode->function", "$inRelatedListNode->field_name", $fields);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($relatedlistnode->actions->action as $actionnode) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function updateCustomLinks($modulenode, $moduleInstance)
- Exclude checks
Line exceeds 120 characters; contains 155 characters Open
$moduleInstance->setRelatedList($relModuleInstance, "$label", $actions, "$relatedlistnode->function", "$relatedlistnode->field_name", $fields);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$cronTask->status = Cron::$STATUS_ENABLED;
- Exclude checks
Spaces must 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
$cronTasks = Cron::listAllInstancesByModule($modulenode->name);
- Exclude checks
Line exceeds 120 characters; contains 219 characters Open
Cron::register("$importCronTask->name", "$importCronTask->handler", "$importCronTask->frequency", "$modulenode->name", "$importCronTask->status", "$importCronTask->sequence", "$importCronTask->description");
- Exclude checks
Spaces must 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
The variable $cur_version is not named in camelCase. Open
public function handleMigration($modulenode, $moduleInstance)
{
$this->parseMigration($modulenode);
$cur_version = $moduleInstance->version;
foreach ($this->_migrations as $migversion => $migrationnode) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $cur_version is not named in camelCase. Open
public function handleMigration($modulenode, $moduleInstance)
{
$this->parseMigration($modulenode);
$cur_version = $moduleInstance->version;
foreach ($this->_migrations as $migversion => $migrationnode) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}