import accesses the super-global variable $_FILES. Open
public function import($qualifiedModuleName = false)
{
$id = '';
$fileInstance = \App\Fields\File::loadFromRequest($_FILES['imported_xml']);
if (!$fileInstance->validate() || 'xml' !== $fileInstance->getExtension(true)) {
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
Function importDataFromXML
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
public function importDataFromXML($uploadedXml)
{
$combine = ['tabid' => 'source', 'reltabid' => 'target'];
$instances = [];
$i = 0;
- 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
File Module.php
has 326 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Module Class for MappedFields Settings.
*
The class Settings_MappedFields_Module_Model has an overall complexity of 76 which is very high. The configured complexity threshold is 50. Open
class Settings_MappedFields_Module_Model extends Settings_Vtiger_Module_Model
{
protected $record = false;
public $baseTable = 'a_yf_mapped_config';
public $mappingTable = 'a_yf_mapped_fields';
- Exclude checks
Function save
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public function save($saveMapping = false)
{
\App\Log::trace('Entering ' . __METHOD__ . '(' . $saveMapping . ') method ...');
$db = \App\Db::getInstance();
$fields = self::$allFields;
- 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
Settings_MappedFields_Module_Model
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class Settings_MappedFields_Module_Model extends Settings_Vtiger_Module_Model
{
protected $record = false;
public $baseTable = 'a_yf_mapped_config';
public $mappingTable = 'a_yf_mapped_fields';
Method importDataFromXML
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function importDataFromXML($uploadedXml)
{
$combine = ['tabid' => 'source', 'reltabid' => 'target'];
$instances = [];
$i = 0;
Function transformAdvanceFilterToWorkFlowFilter
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function transformAdvanceFilterToWorkFlowFilter()
{
\App\Log::trace('Entering ' . __METHOD__ . '() method ...');
$conditions = $this->get('conditions');
$wfCondition = [];
- 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 getFields
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function getFields($source = false)
{
\App\Log::trace('Entering ' . __METHOD__ . '() method ...');
$moduleModel = Vtiger_Module_Model::getInstance($this->getName());
$fields = [];
- 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 save
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function save($saveMapping = false)
{
\App\Log::trace('Entering ' . __METHOD__ . '(' . $saveMapping . ') method ...');
$db = \App\Db::getInstance();
$fields = self::$allFields;
Method getFields
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getFields($source = false)
{
\App\Log::trace('Entering ' . __METHOD__ . '() method ...');
$moduleModel = Vtiger_Module_Model::getInstance($this->getName());
$fields = [];
The method getFields() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10. Open
public function getFields($source = false)
{
\App\Log::trace('Entering ' . __METHOD__ . '() method ...');
$moduleModel = Vtiger_Module_Model::getInstance($this->getName());
$fields = [];
- 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 save() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10. Open
public function save($saveMapping = false)
{
\App\Log::trace('Entering ' . __METHOD__ . '(' . $saveMapping . ') method ...');
$db = \App\Db::getInstance();
$fields = self::$allFields;
- 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 importDataFromXML() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10. Open
public function importDataFromXML($uploadedXml)
{
$combine = ['tabid' => 'source', 'reltabid' => 'target'];
$instances = [];
$i = 0;
- 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 "Settings_MappedFields_Module_Model" has 23 methods, which is greater than 20 authorized. Split it into smaller classes. Open
class Settings_MappedFields_Module_Model extends Settings_Vtiger_Module_Model
- 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.
Reduce the number of returns of this function 4, down to the maximum allowed 3. Open
public static function getFieldsByStep($step = 1)
- Read upRead up
- Exclude checks
Having too many return statements in a function increases the function's essential complexity because the flow of execution is broken each time a return statement is encountered. This makes it harder to read and understand the logic of the function.
Noncompliant Code Example
With the default threshold of 3:
function myFunction(){ // Noncompliant as there are 4 return statements if (condition1) { return true; } else { if (condition2) { return false; } else { return true; } } return false; }
Refactor this function to reduce its Cognitive Complexity from 21 to the 15 allowed. Open
public function save($saveMapping = false)
- 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 35 to the 15 allowed. Open
public function importDataFromXML($uploadedXml)
- 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 Settings_MappedFields_Module_Model has a coupling between objects value of 16. Consider to reduce the number of dependencies under 13. Open
class Settings_MappedFields_Module_Model extends Settings_Vtiger_Module_Model
{
protected $record = false;
public $baseTable = 'a_yf_mapped_config';
public $mappingTable = 'a_yf_mapped_fields';
- 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 import has a boolean flag argument $qualifiedModuleName, which is a certain sign of a Single Responsibility Principle violation. Open
public function import($qualifiedModuleName = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
The method save has a boolean flag argument $saveMapping, which is a certain sign of a Single Responsibility Principle violation. Open
public function save($saveMapping = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
The method getFields has a boolean flag argument $source, which is a certain sign of a Single Responsibility Principle violation. Open
public function getFields($source = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Missing class import via use statement (line '288', column '15'). Open
return (new \App\Db\Query())->from($this->baseTable)
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Avoid using static access to class '\App\Module' in method 'getId'. Open
return \App\Module::getModuleId($this->getName());
- 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\Purifier' in method 'importDataFromXML'. Open
$mapping[$i][$columnKey] = 'default' === $columnKey ? \App\Purifier::purify($columnValue) : $columnValue;
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'Vtiger_Module_Model' in method 'getFields'. Open
$moduleModel = Vtiger_Module_Model::getInstance($this->getName());
- 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 'deleteMapping'. Open
\App\Log::trace('Exiting ' . __METHOD__ . ' 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 'Vtiger_Module_Model' in method 'importDataFromXML'. Open
$instances[$combine[$fieldsKey]] = Vtiger_Module_Model::getInstance((string) $fieldsValue);
- 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 'getCleanInstance'. Open
\App\Log::trace('Entering ' . __METHOD__ . '(' . $moduleName . ') 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 'Vtiger_MappedFields_Model' in method 'getInstanceById'. Open
$instance->record = Vtiger_MappedFields_Model::getInstanceById($recordId, $moduleName);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Cache' in method 'save'. Open
\App\Cache::delete('MappedFieldsTemplatesByModule', \App\Module::getModuleName($this->record->get('tabid')));
- 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_Loader' in method 'getCleanInstance'. Open
$handlerClass = Vtiger_Loader::getComponentClassName('Model', 'MappedFields', $moduleName);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Log' in method 'getFields'. Open
\App\Log::trace('Entering ' . __METHOD__ . '() 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 save uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$db->createCommand()->update($this->baseTable, $params, [$this->baseIndex => $this->getRecordId()])->execute();
}
- 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 'save'. Open
\App\Log::trace('Exiting ' . __METHOD__ . ' 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 'getCleanInstance'. Open
\App\Log::trace('Exiting ' . __METHOD__ . ' 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 importDataFromXML uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$value = (string) $fieldsValue;
}
- 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 importDataFromXML uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$id = null;
$message = 'LBL_NO_PERMISSION_TO_IMPORT';
}
- 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 'getInstance'. Open
\App\Log::trace('Exiting ' . __METHOD__ . ' 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 'getInstanceById'. Open
\App\Log::trace('Entering ' . __METHOD__ . '(' . $recordId . ',' . $moduleName . ') 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 'save'. Open
\App\Log::trace('Entering ' . __METHOD__ . '(' . $saveMapping . ') 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\Db' in method 'save'. Open
$db = \App\Db::getInstance();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'Settings_MappedFields_Field_Model' in method 'importDataFromXML'. Open
$fieldObject = Settings_MappedFields_Field_Model::getInstance($columnValue, $instances[$columnKey], $mapping[$i]['type']);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'Vtiger_Module_Model' in method 'getInstance'. Open
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Log' in method 'getInstanceById'. Open
\App\Log::trace('Exiting ' . __METHOD__ . ' 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\Cache' in method 'delete'. Open
\App\Cache::delete('MappedFieldsTemplatesByModule', \App\Module::getModuleName($this->record->get('tabid')));
- 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 import uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
[$id, $message] = $this->importDataFromXML($fileInstance->getPath());
}
- 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 'Settings_MappedFields_Field_Model' in method 'getSpecialFields'. Open
$fieldInstane = Settings_MappedFields_Field_Model::fromArray($data);
- 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 'getFields'. Open
\App\Log::trace('Exiting ' . __METHOD__ . ' 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\Json' in method 'save'. Open
$params[$field] = \App\Json::encode($value);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Fields\File' in method 'import'. Open
$fileInstance = \App\Fields\File::loadFromRequest($_FILES['imported_xml']);
- 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 'Settings_MappedFields_Field_Model' in method 'getFields'. Open
$fields[$blockName][$field->getColumnName()] = Settings_MappedFields_Field_Model::getInstanceFromInventoryFieldObject($field);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Module' in method 'save'. Open
\App\Cache::delete('MappedFieldsTemplatesByModule', \App\Module::getModuleName($this->record->get('tabid')));
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'Vtiger_Module_Model' in method 'getSupportedModules'. Open
$moduleModels = Vtiger_Module_Model::getAll([0, 2]);
- 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 'Settings_MappedFields_Field_Model' in method 'getFields'. Open
$fields[$blockName][$fieldModel->getId()] = Settings_MappedFields_Field_Model::getInstanceFromWebserviceFieldObject($fieldModel);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Module' in method 'importDataFromXML'. Open
$value = (int) \App\Module::getModuleId((string) $fieldsValue);
- 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_Inventory_Model' in method 'getFields'. Open
$inventoryModel = Vtiger_Inventory_Model::getInstance($this->getName());
- 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 'deleteMapping'. Open
\App\Log::trace('Entering ' . __METHOD__ . '() 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\Module' in method 'delete'. Open
\App\Cache::delete('MappedFieldsTemplatesByModule', \App\Module::getModuleName($this->record->get('tabid')));
- 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 save uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$params[$field] = $value;
}
- 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 'transformAdvanceFilterToWorkFlowFilter'. Open
\App\Log::trace('Entering ' . __METHOD__ . '() 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 'transformAdvanceFilterToWorkFlowFilter'. Open
\App\Log::trace('Exiting ' . __METHOD__ . ' 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\Language' in method 'import'. Open
return ['id' => $id, 'message' => \App\Language::translate($message, $qualifiedModuleName)];
- 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 'getInstance'. Open
\App\Log::trace('Entering ' . __METHOD__ . '(' . $moduleName . ') 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
Define a constant instead of duplicating this literal "Integer" 3 times. Open
'status' => 'Integer',
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "tabid" 10 times. Open
'tabid' => 'LBL_MODULE',
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "Exiting " 7 times. Open
\App\Log::trace('Exiting ' . __METHOD__ . ' method ...');
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "Entering " 7 times. Open
\App\Log::trace('Entering ' . __METHOD__ . '(' . $moduleName . ') method ...');
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "value" 3 times. Open
$wfCondition[] = ['fieldname' => '', 'operation' => '', 'value' => '', 'valuetype' => '',
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "source" 3 times. Open
public static $step2Fields = ['source', 'target', 'default', 'type'];
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "valuetype" 3 times. Open
$wfCondition[] = ['fieldname' => '', 'operation' => '', 'value' => '', 'valuetype' => '',
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "conditions" 5 times. Open
'conditions',
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "status" 4 times. Open
'status' => 'LBL_STATUS',
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "groupid" 3 times. Open
'joincondition' => '', 'groupid' => '0', ];
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal ") method ..." 4 times. Open
\App\Log::trace('Entering ' . __METHOD__ . '(' . $moduleName . ') method ...');
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal " method ..." 7 times. Open
\App\Log::trace('Exiting ' . __METHOD__ . ' method ...');
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "default" 3 times. Open
public static $step2Fields = ['source', 'target', 'default', 'type'];
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "permissions" 3 times. Open
'permissions',
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "target" 3 times. Open
public static $step2Fields = ['source', 'target', 'default', 'type'];
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "reltabid" 8 times. Open
'reltabid' => 'LBL_REL_MODULE',
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "() method ..." 3 times. Open
\App\Log::trace('Entering ' . __METHOD__ . '() method ...');
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting ' . __METHOD__ . ' method ...');
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting ' . __METHOD__ . ' method ...');
- Exclude checks
Call to method set
on non-class type false
Open
$this->getRecord()->set('conditions', $wfCondition);
- Exclude checks
Saw unextractable annotation for comment '* @return <array> Restricted ui types'</array>
Open
* @return <array> Restricted ui types
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Entering ' . __METHOD__ . '(' . $moduleName . ') method ...');
- Exclude checks
Assigning object
to property but \Settings_MappedFields_Module_Model->record
is false
Open
$instance->record = $mf;
- Exclude checks
Saw unextractable annotation for comment '* @return <settings_mappedfields_module_model>'</settings_mappedfields_module_model>
Open
* @return <Settings_MappedFields_Module_Model>
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$db->createCommand()->update($this->baseTable, $params, [$this->baseIndex => $this->getRecordId()])->execute();
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Entering ' . __METHOD__ . '() method ...');
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Entering ' . __METHOD__ . '() method ...');
- Exclude checks
Call to method get
on non-class type false
Open
$value = $this->record->get($field);
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting ' . __METHOD__ . ' method ...');
- Exclude checks
Saw unextractable annotation for comment '* @return <settings_mappedfields_module_model>'</settings_mappedfields_module_model>
Open
* @return <Settings_MappedFields_Module_Model>
- Exclude checks
Call to method setMapping
on non-class type false
Open
$this->record->setMapping($mapp);
- Exclude checks
Return type of getSpecialFields()
is undeclared type \instance
Open
public static function getSpecialFields()
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
return \App\Db::getInstance()->createCommand()->delete($this->baseTable, [$this->baseIndex => $this->getRecordId()])
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
\App\Db::getInstance()->createCommand()->delete($this->mappingTable, [$this->mappingIndex => $mappedIds])
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$db->createCommand()->insert($this->mappingTable, $params)->execute();
- Exclude checks
Invalid offset 0
of array type array{}
Open
$fieldObject = Settings_MappedFields_Field_Model::getInstance($columnValue, $instances[$columnKey], $mapping[$i]['type']);
- Exclude checks
Call to method getMapping
on non-class type false
Open
return $this->record->getMapping();
- Exclude checks
Return type of setMapping()
is undeclared type \instance
Open
public function setMapping($mapp = [])
- Exclude checks
Call to method get
on non-class type false
Open
return $this->record->get($key);
- Exclude checks
Returning type array<string>|array{}</string>
but getSpecialFields()
is declared to return \instance
Open
return $models;
- Exclude checks
Call to method set
on non-class type false
Open
$this->record->set('id', $db->getLastInsertID($this->baseTable . '_id_seq'));
- Exclude checks
Call to method getId
on non-class type false
Open
return $this->record->getId();
- Exclude checks
Call to method get
on non-class type false
Open
\App\Cache::delete('MappedFieldsTemplatesByModule', \App\Module::getModuleName($this->record->get('tabid')));
- Exclude checks
Call to method get
on non-class type false
Open
$tabid = $this->getRecord()->get('tabid');
- Exclude checks
Call to method get
on non-class type false
Open
$reltabid = $this->getRecord()->get('reltabid');
- Exclude checks
Saw unextractable annotation for comment '* @return <number>'</number>
Open
* @return <Number>
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting ' . __METHOD__ . ' method ...');
- Exclude checks
Suspicious type false
of a variable or expression used to build a string. (Expected type to be able to cast to a string) Open
\App\Log::trace('Entering ' . __METHOD__ . '(' . $saveMapping . ') method ...');
- Exclude checks
Call to method set
on non-class type false
Open
$this->getRecord()->set($fieldsKey, $value);
- Exclude checks
Saw unextractable annotation for comment '* @return <array> list of mapping details'</array>
Open
* @return <Array> list of mapping details
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Entering ' . __METHOD__ . '(' . $saveMapping . ') method ...');
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$db->createCommand()->insert($this->baseTable, $params)->execute();
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Entering ' . __METHOD__ . '(' . $moduleName . ') method ...');
- Exclude checks
Saw unextractable annotation for comment '* @return <array of vtlib>'</array>
Open
* @return <Array of vtlib\Field>
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting ' . __METHOD__ . ' method ...');
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting ' . __METHOD__ . ' method ...');
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Entering ' . __METHOD__ . '(' . $recordId . ',' . $moduleName . ') method ...');
- Exclude checks
Returning type \Settings_MappedFields_Module_Model
but setMapping()
is declared to return \instance
Open
return $this;
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
return (new \App\Db\Query())->from($this->baseTable)
- Exclude checks
Call to method get
on non-class type false
Open
\App\Cache::delete('MappedFieldsTemplatesByModule', \App\Module::getModuleName($this->record->get('tabid')));
- Exclude checks
Saw unextractable annotation for comment '* @return <array> Restricted ui types'</array>
Open
* @return <array> Restricted ui types
- Exclude checks
Return type of get()
is undeclared type \Value
Open
public function get($key)
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting ' . __METHOD__ . ' method ...');
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Entering ' . __METHOD__ . '() method ...');
- Exclude checks
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (!empty($conditions)) {
foreach ($conditions as $index => $condition) {
$columns = $condition['columns'];
if ('1' == $index && empty($columns)) {
$wfCondition[] = ['fieldname' => '', 'operation' => '', 'value' => '', 'valuetype' => '',
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 186.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Avoid excessively long variable names like $supportedModuleModels. Keep variable name length under 20. Open
$supportedModuleModels = [];
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class Settings_MappedFields_Module_Model extends Settings_Vtiger_Module_Model
- Exclude checks
Avoid variables with short names like $id. Configured minimum length is 3. Open
$id = null;
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $db. Configured minimum length is 3. Open
$db = \App\Db::getInstance();
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $i. Configured minimum length is 3. Open
$i = 0;
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
The class Settings_MappedFields_Module_Model is not named in CamelCase. Open
class Settings_MappedFields_Module_Model extends Settings_Vtiger_Module_Model
{
protected $record = false;
public $baseTable = 'a_yf_mapped_config';
public $mappingTable = 'a_yf_mapped_fields';
- Read upRead up
- Exclude checks
CamelCaseClassName
Since: 0.2
It is considered best practice to use the CamelCase notation to name classes.
Example
class class_name {
}
Source
Avoid variables with short names like $mf. Configured minimum length is 3. Open
$mf = new $handlerClass();
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $id. Configured minimum length is 3. Open
$id = '';
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Spaces must be used to indent lines; tabs are not allowed Open
'reltabid' => 'LBL_REL_MODULE',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $step4Fields = ['permissions'];
- Exclude checks
Spaces must 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 \App\Module::getModuleId($this->getName());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return self::$step1Fields;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $allFields = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $step1Fields = ['status', 'tabid', 'reltabid'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var array Validator for fields
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getImportViewUrl()
- Exclude checks
Spaces must 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
'tabid',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'permissions',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'permissions' => ['Text'],
- Exclude checks
Spaces must 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 getRecord()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get the Restricted Ui Types.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'status',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'reltabid' => 'Integer',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return self::$step4Fields;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
default:
- Exclude checks
Spaces must 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 $baseIndex = 'id';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $validatorFields = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getFieldsByStep($step = 1)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 1:
- 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
public $parent = 'Settings';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getCreateRecordUrl()
- Exclude checks
Spaces must 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
'status' => 'LBL_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
return self::$step3Fields;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 2:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return <array> Restricted ui types
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return <array> Restricted ui types
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'tabid' => 'LBL_MODULE',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'reltabid',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $step2Fields = ['source', 'target', 'default', 'type'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 3:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $step3Fields = ['conditions'];
- Exclude checks
Spaces must 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 getRecordId()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getSupportedModules()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleModels = Vtiger_Module_Model::getAll([0, 2]);
- Exclude checks
Spaces must 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('Exiting ' . __METHOD__ . ' 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
* Function to get instance of module.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getInstanceById($recordId, $moduleName = 'Vtiger')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to set mapping details.
- Exclude checks
Spaces must 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 instance
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$blockName = 'LBL_ADVANCED_BLOCK';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return 'index.php?module=MappedFields&parent=Settings&view=Edit';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 4:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'params',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return 'index.php?module=MappedFields&parent=Settings&view=Import';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get the Module/Tab id.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return <Number>
- Exclude checks
Spaces must 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 [4, 51, 52, 57, 58, 69, 70];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$restrictedModules = ['OSSMailView', 'ModComments'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$supportedModuleModels[$tabId] = $moduleModel;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fields = self::getFieldsByStep();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance = new self();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return <Array> list of mapping details
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return <Array of vtlib\Field>
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($fieldModel->isActiveField() && !(false === $source && !($fieldModel->isEditable() && !\in_array($fieldModel->getUIType(), $this->getRestrictedUitypes())))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fields[$blockName][$fieldModel->getId()] = Settings_MappedFields_Field_Model::getInstanceFromWebserviceFieldObject($fieldModel);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$supportedModuleModels = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getCleanInstance($moduleName = 'Vtiger')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return <Settings_MappedFields_Module_Model>
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $moduleModel;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must 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 $this;
- Exclude checks
Spaces must 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
foreach ($this->getSpecialFields() as $fieldName => $fieldInstance) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $record = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'conditions',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'tabid' => 'Integer',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $name = 'MappedFields';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
switch ($step) {
- Exclude checks
Spaces must 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 Value for the given key
- Exclude checks
Spaces must 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('Entering ' . __METHOD__ . '(' . $recordId . ',' . $moduleName . ') method ...');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getMapping()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$models = [];
- Exclude checks
Spaces must 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 (!$blockName) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $mappingTable = 'a_yf_mapped_fields';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $mappingIndex = 'mappedid';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get the Restricted Ui Types.
- Exclude checks
Spaces must 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 <Settings_MappedFields_Module_Model>
- Exclude checks
Spaces must 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('Entering ' . __METHOD__ . '(' . $moduleName . ') 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
* Function to get mapping details.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldInstane = Settings_MappedFields_Field_Model::fromArray($data);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fields['LBL_NOT_ASSIGNET_TO_BLOCK'][$fieldName] = $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
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'status' => 'Integer',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->record;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return self::$step2Fields;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($moduleModels as $tabId => $moduleModel) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$data[$field] = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->record->get($key);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($moduleModel) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to set mapping details.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function returns fields of module.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$blockName = $fieldModel->getBlockName();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $baseTable = 'a_yf_mapped_config';
- Exclude checks
Spaces must 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 getId()
- Exclude checks
Spaces must 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 getRestrictedUitypes()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$data = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function get($key)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting ' . __METHOD__ . ' method ...');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return instance
- Exclude checks
Spaces must 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 ($inventoryModel->getFields() as $field) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get instance.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($fields as $field) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getInstance($moduleName = 'Settings:Vtiger')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$objectProperties = get_object_vars($moduleModel);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleModel->{$properName} = $propertyValue;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->record->getMapping();
- Exclude checks
Spaces must 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->record->setMapping($mapp);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getSpecialFields()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 142 characters Open
$fields[$blockName][$field->getColumnName()] = Settings_MappedFields_Field_Model::getInstanceFromInventoryFieldObject($field);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Db::getInstance()->createCommand()->delete($this->mappingTable, [$this->mappingIndex => $mappedIds])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Entering ' . __METHOD__ . '(' . $saveMapping . ') method ...');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db->createCommand()->insert($this->baseTable, $params)->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
[$id, $message] = $this->importDataFromXML($fileInstance->getPath());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\array_key_exists($fieldsKey, $combine)) {
- Exclude checks
Line exceeds 120 characters; contains 133 characters Open
$mapping[$i][$columnKey] = 'default' === $columnKey ? \App\Purifier::purify($columnValue) : $columnValue;
- Exclude checks
Spaces must 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
$handlerClass = Vtiger_Loader::getComponentClassName('Model', 'MappedFields', $moduleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance->record = $mf;
- Exclude checks
Spaces must 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
$fields = ['id' => ['name' => 'id', 'id' => 'id', 'fieldDataType' => 'reference', 'label' => 'LBL_SELF_ID', 'typeofdata' => 'SELF']];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleModel = Vtiger_Module_Model::getInstance($this->getName());
- Exclude checks
Line exceeds 120 characters; contains 174 characters Open
if ($fieldModel->isActiveField() && !(false === $source && !($fieldModel->isEditable() && !\in_array($fieldModel->getUIType(), $this->getRestrictedUitypes())))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fields[$blockName][$field->getColumnName()] = Settings_MappedFields_Field_Model::getInstanceFromInventoryFieldObject($field);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting ' . __METHOD__ . ' method ...');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $fields;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Cache::delete('MappedFieldsTemplatesByModule', \App\Module::getModuleName($this->record->get('tabid')));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fields = self::$allFields;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($conditions)) {
- 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
if ($moduleModel->isEntityModule() && !\in_array($moduleModel->getName(), $restrictedModules)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $instance;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Entering ' . __METHOD__ . '(' . $moduleName . ') 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
* @param mixed $mapp
- Exclude checks
Spaces must 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 getFields($source = 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
* Function transforms Advance filter to workflow conditions.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$wfCondition[] = ['fieldname' => '', 'operation' => '', 'value' => '', 'valuetype' => '',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$columnValue = (string) $columnValue;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
continue;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = (string) $fieldsValue;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get the value for a given key.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $moduleName
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function setMapping($mapp = [])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($source) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!\is_array($mappedIds)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$params[$field] = implode(',', $value);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$params[$this->mappingIndex] = $this->getRecordId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db->createCommand()->insert($this->mappingTable, $params)->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$columns = $condition['columns'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'value' => $column['value'], 'valuetype' => $column['valuetype'], 'joincondition' => $column['column_condition'],
- Exclude checks
Spaces must 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->getRecord()->set('conditions', $wfCondition);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instances = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$xml = simplexml_load_file($uploadedXml);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instances[$combine[$fieldsKey]] = Vtiger_Module_Model::getInstance((string) $fieldsValue);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$columnKey = (string) $columnKey;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mapping[$i][$columnKey] = 'default' === $columnKey ? \App\Purifier::purify($columnValue) : $columnValue;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
continue;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->record->getId();
- Exclude checks
Spaces must 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
$instance = new self();
- Exclude checks
Line exceeds 120 characters; contains 141 characters Open
$fields = ['id' => ['name' => 'id', 'id' => 'id', 'fieldDataType' => 'reference', 'label' => 'LBL_SELF_ID', 'typeofdata' => 'SELF']];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $source
- 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
$blockName = 'LBL_NOT_ASSIGNET_TO_BLOCK';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$params = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = $this->record->get($field);
- Exclude checks
Line exceeds 120 characters; contains 123 characters Open
$db->createCommand()->update($this->baseTable, $params, [$this->baseIndex => $this->getRecordId()])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($saveMapping) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Cache::delete('MappedFieldsTemplatesByModule', \App\Module::getModuleName($this->record->get('tabid')));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('1' == $index && empty($columns)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($columns) && \is_array($columns)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return ['id' => $id, 'message' => \App\Language::translate($message, $qualifiedModuleName)];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($fieldsValue as $fieldValue) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$fieldObject) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance->record = Vtiger_MappedFields_Model::getInstanceById($recordId, $moduleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($fields as $fieldName => $data) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Entering ' . __METHOD__ . '() method ...');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($moduleModel->getFields() as $fieldName => $fieldModel) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$inventoryModel = Vtiger_Inventory_Model::getInstance($this->getName());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($columns as $column) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'groupjoin' => $condition['condition'] ?? '', 'groupid' => $column['groupid'], ];
- Exclude checks
Spaces must 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 ($fieldValue as $columnKey => $columnValue) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($tabid) || empty($reltabid)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$id = null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mf = new $handlerClass();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleModel = new self();
- Exclude checks
Spaces must 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 ($fields as $field) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting ' . __METHOD__ . ' method ...');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = (int) \App\Module::getModuleId((string) $fieldsValue);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$message = 'LBL_IMPORT_OK';
- Exclude checks
Spaces must 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 deleteMapping($mappedIds)
- Exclude checks
Spaces must 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('Entering ' . __METHOD__ . '() method ...');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->count();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db->createCommand()->update($this->baseTable, $params, [$this->baseIndex => $this->getRecordId()])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$params = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must 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
public function importsAllowed()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->record->set('id', $db->getLastInsertID($this->baseTable . '_id_seq'));
- Exclude checks
Spaces must 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($params['source']) && !empty($params['target'])) {
- Exclude checks
Spaces must 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
$conditions = $this->get('conditions');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$id = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$message = 'LBL_UPLOAD_ERROR';
- Exclude checks
Spaces must 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 $moduleName
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mf->setData($data);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting ' . __METHOD__ . ' method ...');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $instance;
- Exclude checks
Spaces must 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 $models;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Line exceeds 120 characters; contains 145 characters Open
$fields[$blockName][$fieldModel->getId()] = Settings_MappedFields_Field_Model::getInstanceFromWebserviceFieldObject($fieldModel);
- Exclude checks
Line exceeds 120 characters; contains 124 characters Open
return \App\Db::getInstance()->createCommand()->delete($this->baseTable, [$this->baseIndex => $this->getRecordId()])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db = \App\Db::getInstance();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\in_array($field, ['conditions', 'params'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$params[$field] = $value;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->getRecordId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Entering ' . __METHOD__ . '() method ...');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$wfCondition = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$message = 'LBL_NO_PERMISSION_TO_IMPORT';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting ' . __METHOD__ . ' method ...');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($mapp[$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
$i = 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mapping = [];
- Exclude checks
Line exceeds 120 characters; contains 146 characters Open
$fieldObject = Settings_MappedFields_Field_Model::getInstance($columnValue, $instances[$columnKey], $mapping[$i]['type']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->save(true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$id = $this->getRecordId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return [$id, $message];
- Exclude checks
Spaces must 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 save($saveMapping = 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
if (!$this->getRecordId()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->deleteMapping($this->getRecordId());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function transformAdvanceFilterToWorkFlowFilter()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($conditions as $index => $condition) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'joincondition' => '', 'groupid' => '0', ];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($xml as $fieldsKey => $fieldsValue) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
++$i;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->getRecord()->set($fieldsKey, $value);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$stepFields = self::getFieldsByStep(2);
- Exclude checks
Spaces must 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
$wfCondition[] = ['fieldname' => $column['columnname'], 'operation' => $column['comparator'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting ' . __METHOD__ . ' method ...');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$fileInstance->validate() || 'xml' !== $fileInstance->getExtension(true)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$combine = ['tabid' => 'source', 'reltabid' => 'target'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
continue;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mappedIds = [$mappedIds];
- Exclude checks
Spaces must 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 delete()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return (new \App\Db\Query())->from($this->baseTable)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$params[$name] = $mapp[$name];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function importDataFromXML($uploadedXml)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($value)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ('fields' === $fieldsKey) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mapping[$i][$columnKey] = $fieldObject->getId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$message = 'LBL_MODULE_NOT_EXIST';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return \App\Db::getInstance()->createCommand()->delete($this->baseTable, [$this->baseIndex => $this->getRecordId()])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$params[$field] = \App\Json::encode($value);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($this->getMapping() as $mapp) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($stepFields as $name) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fileInstance = \App\Fields\File::loadFromRequest($_FILES['imported_xml']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldObject = Settings_MappedFields_Field_Model::getInstance($columnValue, $instances[$columnKey], $mapping[$i]['type']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tabid = $this->getRecord()->get('tabid');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $supportedModuleModels;
- Exclude checks
Spaces must 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 $key
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($objectProperties as $properName => $propertyValue) {
- Exclude checks
Spaces must 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
$models[$fieldName] = $fieldInstane;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($moduleModel->isInventory()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['tabid' => $this->get('tabid'), 'reltabid' => $this->get('reltabid')])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif (\is_array($value)) {
- Exclude checks
Line exceeds 120 characters; contains 141 characters Open
'value' => $column['value'], 'valuetype' => $column['valuetype'], 'joincondition' => $column['column_condition'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function import($qualifiedModuleName = false)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\in_array($columnKey, ['default', 'type'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$reltabid = $this->getRecord()->get('reltabid');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$id = null;
- 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
} elseif (!$this->importsAllowed()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->setMapping($mapping);
- Exclude checks
Class name "Settings_MappedFields_Module_Model" is not in camel caps format Open
class Settings_MappedFields_Module_Model extends Settings_Vtiger_Module_Model
- Exclude checks