Function importRecords
has a Cognitive Complexity of 111 (exceeds 5 allowed). Consider refactoring. Open
public function importRecords()
{
$moduleName = $this->module;
$tableName = Import_Module_Model::getDbTableName($this->user);
- 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 Data.php
has 579 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/* +***********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
Method importRecords
has 151 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function importRecords()
{
$moduleName = $this->module;
$tableName = Import_Module_Model::getDbTableName($this->user);
Function transformInventoryFieldFromMap
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
public function transformInventoryFieldFromMap($value, $mapData)
{
if (!empty($value)) {
if ($this->currentInventoryRawData['name']) {
[$entityName] = $this->transformInventoryReference($this->currentInventoryRawData['name'], true);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
The class Import_Data_Action has an overall complexity of 160 which is very high. The configured complexity threshold is 50. Open
class Import_Data_Action extends \App\Controller\Action
{
public $id;
public $user;
public $module;
- Exclude checks
The class Import_Data_Action has 18 public methods. Consider refactoring Import_Data_Action to keep number of public methods under 10. Open
class Import_Data_Action extends \App\Controller\Action
{
public $id;
public $user;
public $module;
- Read upRead up
- Exclude checks
TooManyPublicMethods
Since: 0.1
A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.
By default it ignores methods starting with 'get' or 'set'.
Example
Source https://phpmd.org/rules/codesize.html#toomanypublicmethods
Function transformInventoryForImport
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public function transformInventoryForImport($inventoryData)
{
$inventoryModel = Vtiger_Inventory_Model::getInstance($this->module);
$inventoryFields = $inventoryModel->getFields();
$maps = $inventoryModel->getAutoCompleteFields();
- 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 getDefaultFieldValues
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function getDefaultFieldValues()
{
$key = $this->module . '_' . $this->user->getId();
if (\App\Cache::staticHas('DefaultFieldValues', $key)) {
return \App\Cache::staticGet('DefaultFieldValues', $key);
- 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
Import_Data_Action
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class Import_Data_Action extends \App\Controller\Action
{
public $id;
public $user;
public $module;
Function getImportDetails
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public static function getImportDetails(App\User $user, $forModule)
{
$db = App\Db::getInstance();
$importRecords = [];
$tableName = Import_Module_Model::getDbTableName($user);
- 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 getDefaultFieldValues
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getDefaultFieldValues()
{
$key = $this->module . '_' . $this->user->getId();
if (\App\Cache::staticHas('DefaultFieldValues', $key)) {
return \App\Cache::staticGet('DefaultFieldValues', $key);
Method getImportStatusCount
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getImportStatusCount()
{
$statusCount = ['TOTAL' => 0, 'IMPORTED' => 0, 'FAILED' => 0, 'PENDING' => 0,
'CREATED' => 0, 'SKIPPED' => 0, 'UPDATED' => 0, 'MERGED' => 0, ];
$tableName = Import_Module_Model::getDbTableName($this->user);
Method transformInventoryForImport
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function transformInventoryForImport($inventoryData)
{
$inventoryModel = Vtiger_Inventory_Model::getInstance($this->module);
$inventoryFields = $inventoryModel->getFields();
$maps = $inventoryModel->getAutoCompleteFields();
Method transformInventoryFieldFromMap
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function transformInventoryFieldFromMap($value, $mapData)
{
if (!empty($value)) {
if ($this->currentInventoryRawData['name']) {
[$entityName] = $this->transformInventoryReference($this->currentInventoryRawData['name'], true);
Method getImportDetails
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getImportDetails(App\User $user, $forModule)
{
$db = App\Db::getInstance();
$importRecords = [];
$tableName = Import_Module_Model::getDbTableName($user);
Consider simplifying this complex logical expression. Open
if ('' === $fieldValue && '' !== $currentValue && null !== $currentValue) {
$forUnset[] = $fieldName;
} elseif ('' === $fieldValue && ('' === $currentValue || null === $currentValue) && isset($defaultMandatoryFieldValues[$fieldName]) && '' !== $defaultMandatoryFieldValues[$fieldName]) {
$fieldValue = $defaultMandatoryFieldValues[$fieldName];
}
Function getDefaultMandatoryFieldValues
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function getDefaultMandatoryFieldValues()
{
$key = $this->module . '_' . $this->user->getId();
if (\App\Cache::staticHas('DefaultMandatoryFieldValues', $key)) {
return \App\Cache::staticGet('DefaultMandatoryFieldValues', $key);
- 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 getImportStatusCount
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function getImportStatusCount()
{
$statusCount = ['TOTAL' => 0, 'IMPORTED' => 0, 'FAILED' => 0, 'PENDING' => 0,
'CREATED' => 0, 'SKIPPED' => 0, 'UPDATED' => 0, 'MERGED' => 0, ];
$tableName = Import_Module_Model::getDbTableName($this->user);
- 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 getImportRecordStatus
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getImportRecordStatus($value)
{
$temp_status = '';
switch ($value) {
case 'created':
- 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 updateRecordByModel
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function updateRecordByModel($record, $fieldData, $moduleName = false, ?int $relationId = 0, ?int $sourceId = 0)
Function transformInventoryReference
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function transformInventoryReference($value, $getArray = false)
{
$value = trim($value);
if (!empty($value)) {
if (strpos($value, '::::') > 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
Function createRecordByModel
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function createRecordByModel($moduleName, $fieldData, ?int $relationId = 0, ?int $sourceId = 0)
{
$recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);
if (isset($fieldData['inventoryData'])) {
$inventoryData = $fieldData['inventoryData'];
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
The method getDefaultFieldValues() has an NPath complexity of 250. The configured NPath complexity threshold is 200. Open
public function getDefaultFieldValues()
{
$key = $this->module . '_' . $this->user->getId();
if (\App\Cache::staticHas('DefaultFieldValues', $key)) {
return \App\Cache::staticGet('DefaultFieldValues', $key);
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method importRecords() has an NPath complexity of 412612. The configured NPath complexity threshold is 200. Open
public function importRecords()
{
$moduleName = $this->module;
$tableName = Import_Module_Model::getDbTableName($this->user);
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method importRecords() has 169 lines of code. Current threshold is set to 100. Avoid really long methods. Open
public function importRecords()
{
$moduleName = $this->module;
$tableName = Import_Module_Model::getDbTableName($this->user);
- Exclude checks
The method transformInventoryFieldFromMap() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10. Open
public function transformInventoryFieldFromMap($value, $mapData)
{
if (!empty($value)) {
if ($this->currentInventoryRawData['name']) {
[$entityName] = $this->transformInventoryReference($this->currentInventoryRawData['name'], true);
- 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 getDefaultFieldValues() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10. Open
public function getDefaultFieldValues()
{
$key = $this->module . '_' . $this->user->getId();
if (\App\Cache::staticHas('DefaultFieldValues', $key)) {
return \App\Cache::staticGet('DefaultFieldValues', $key);
- 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 importRecords() has a Cyclomatic Complexity of 50. The configured cyclomatic complexity threshold is 10. Open
public function importRecords()
{
$moduleName = $this->module;
$tableName = Import_Module_Model::getDbTableName($this->user);
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
Refactor this function to reduce its Cognitive Complexity from 23 to the 15 allowed. Open
public function transformInventoryForImport($inventoryData)
- 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
This function "importRecords" has 168 lines, which is greater than the 150 lines authorized. Split it into smaller functions. Open
public function importRecords()
- Read upRead up
- Exclude checks
A function that grows too large tends to aggregate too many responsibilities.
Such functions inevitably become harder to understand and therefore harder to maintain.
Above a specific threshold, it is strongly advised to refactor into smaller functions which focus on well-defined tasks.
Those smaller functions will not only be easier to understand, but also probably easier to test.
Refactor this function to reduce its Cognitive Complexity from 20 to the 15 allowed. Open
public function getDefaultFieldValues()
- 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 129 to the 15 allowed. Open
public function importRecords()
- 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
Class "Import_Data_Action" has 24 methods, which is greater than 20 authorized. Split it into smaller classes. Open
class Import_Data_Action extends \App\Controller\Action
- Read upRead up
- Exclude checks
A class that grows too much tends to aggregate too many responsibilities and inevitably becomes harder to understand and therefore to maintain. Above a specific threshold, it is strongly advised to refactor the class into smaller ones which focus on well defined topics.
Refactor this function to reduce its Cognitive Complexity from 32 to the 15 allowed. Open
public function transformInventoryFieldFromMap($value, $mapData)
- 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 Import_Data_Action has a coupling between objects value of 29. Consider to reduce the number of dependencies under 13. Open
class Import_Data_Action extends \App\Controller\Action
{
public $id;
public $user;
public $module;
- 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 transformInventoryReference has a boolean flag argument $getArray, which is a certain sign of a Single Responsibility Principle violation. Open
public function transformInventoryReference($value, $getArray = 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 '519', column '17'). Open
$query = (new \App\Db\Query())->select(['temp_status'])->from($tableName);
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '56', column '14'). Open
throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406);
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '242', column '27'). Open
$queryGenerator = new App\QueryGenerator($moduleName, $this->user->getId());
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
The method updateRecordByModel has a boolean flag argument $moduleName, which is a certain sign of a Single Responsibility Principle violation. Open
public function updateRecordByModel($record, $fieldData, $moduleName = false, ?int $relationId = 0, ?int $sourceId = 0)
- 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 '229', column '32'). Open
$inventoryFieldData = (new \App\Db\Query())->from($inventoryTableName)->where(['id' => $rowId])->all();
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '609', column '16'). Open
$query = new \App\Db\Query();
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '211', column '16'). Open
$query = new \App\Db\Query();
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Avoid using static access to class 'Import_Lock_Action' in method 'initializeImport'. Open
$lockInfo = Import_Lock_Action::isLockedForModule($this->module);
- 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 'runScheduledImport'. Open
'module' => App\Language::translate($importDataController->module, $importDataController->module),
- 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 'Import_Queue_Action' in method 'getScheduledImport'. Open
$importQueue = Import_Queue_Action::getAll(Import_Queue_Action::$IMPORT_STATUS_SCHEDULED);
- 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\Record' in method 'transformInventoryReference'. Open
$value = \App\Record::getCrmIdByLabel($referenceModuleName, $entityLabel);
- 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_Record_Model' in method 'getImportDetails'. Open
$record = \Vtiger_Record_Model::getCleanInstance($forModule);
- 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_Record_Model' in method 'updateRecordByModel'. Open
$recordModel = Vtiger_Record_Model::getInstanceById($record, $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 'Import_Lock_Action' in method 'initializeImport'. Open
Import_Lock_Action::lock($this->id, $this->module, $this->user);
- 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 'Import_Queue_Action' in method 'finishImport'. Open
Import_Queue_Action::remove($this->id);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'Vtiger_Record_Model' in method 'importRecords'. Open
$this->addRelation($row['relation_id'], $row['src_record'], Vtiger_Record_Model::getInstanceById($baseRecordId));
- 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 transformInventoryFieldFromMap uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$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\Cache' in method 'getDefaultMandatoryFieldValues'. Open
if (\App\Cache::staticHas('DefaultMandatoryFieldValues', $key)) {
- 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 'getDefaultMandatoryFieldValues'. Open
$moduleModel = Vtiger_Module_Model::getInstance($this->module);
- 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 'transformInventoryForImport'. Open
$data['currencyparam'] = \App\Json::encode($newCurrencyParam);
- 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 'getImportDetails'. 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 '\App\Cache' in method 'getDefaultFieldValues'. Open
\App\Cache::staticSave('DefaultFieldValues', $key, $defaultValue);
- 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 'Import_Module_Model' in method 'importRecords'. Open
$inventoryTableName = Import_Module_Model::getInventoryDbTableName($this->user);
- 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 transformInventoryFieldFromMap uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$moduleObject = vtlib\Module::getInstance($entityName);
$fieldObject = $moduleObject ? Vtiger_Field_Model::getInstance($mapData['field'], $moduleObject) : null;
if (!\is_array($this->inventoryFieldMapData[$mapData['field']])) {
$this->inventoryFieldMapData[$mapData['field']] = [];
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class 'Vtiger_Field_Model' in method 'transformInventoryFieldFromMap'. Open
$fieldObject = $moduleObject ? Vtiger_Field_Model::getInstance($mapData['field'], $moduleObject) : null;
- 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 'getDefaultMandatoryFieldValues'. Open
$this->defaultValues = \App\Json::decode($this->defaultValues);
- 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\User' in method 'importRecords'. Open
$ownerId = \App\User::getUserIdByFullName(trim($comparisonValue));
- 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_Record_Model' in method 'importRecords'. Open
$recordModel = Vtiger_Record_Model::getInstanceById($baseRecordId);
- 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_Record_Model' in method 'importRecords'. Open
$recordModel = Vtiger_Record_Model::getInstanceById($baseRecordId);
- 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 importRecords uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$entityInfo = $this->createRecordByModel($moduleName, $fieldData, $row['relation_id'] ?? 0, $row['src_record'] ?? 0);
}
- 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\Fields\Currency' in method 'transformInventoryForImport'. Open
$value = \App\Fields\Currency::getCurrencyIdByName($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 'vtlib\Module' in method 'transformInventoryFieldFromMap'. Open
$moduleObject = vtlib\Module::getInstance($entityName);
- 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_Record_Model' in method 'createRecordByModel'. Open
$recordModel = Vtiger_Record_Model::getCleanInstance($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 'getDefaultFieldValues'. Open
if (\App\Cache::staticHas('DefaultFieldValues', $key)) {
- 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 'getDefaultFieldValues'. Open
$moduleModel = Vtiger_Module_Model::getInstance($this->module);
- 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 'getDefaultMandatoryFieldValues'. Open
\App\Cache::staticSave('DefaultMandatoryFieldValues', $key, $defaultMandatoryValues);
- 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\Config' in method 'importRecords'. Open
$importBatchLimit = \App\Config::module('Import', 'BATCH_LIMIT');
- 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\Owner' in method 'importRecords'. Open
$ownerId = \App\Fields\Owner::getGroupId($comparisonValue);
- 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 importRecords uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$referenceFileValueComponents = explode(':::', $comparisonValue);
}
- 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 'Import_Module_Model' in method 'getImportStatusCount'. Open
$tableName = Import_Module_Model::getDbTableName($this->user);
- 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 'getDefaultMandatoryFieldValues'. Open
return \App\Cache::staticGet('DefaultMandatoryFieldValues', $key);
- 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 'getImportDetails'. Open
$moduleModel = Vtiger_Module_Model::getInstance($forModule);
- 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_Record_Model' in method 'addRelation'. Open
$sourceRecord = \App\Record::isExists($sourceId) ? Vtiger_Record_Model::getInstanceById($sourceId) : null;
- 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 importRecords uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$createRecord = true;
}
- 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 'Import_Module_Model' in method 'getImportDetails'. Open
$tableName = Import_Module_Model::getDbTableName($user);
- 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 'Import_Module_Model' in method 'updateImportStatus'. Open
$tableName = Import_Module_Model::getDbTableName($this->user);
- 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 'Import_Module_Model' in method 'importRecords'. Open
$tableName = Import_Module_Model::getDbTableName($this->user);
- 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_Record_Model' in method 'importRecords'. Open
$recordModel = Vtiger_Record_Model::getInstanceById($baseRecordId);
- 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 'transformForImport'. Open
$moduleModel = Vtiger_Module_Model::getInstance($this->module);
- 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\Mailer' in method 'runScheduledImport'. Open
\App\Mailer::sendFromTemplate([
'to' => [$importDataController->user->getDetail('email1') => $importDataController->user->getName()],
'template' => 'ImportCron',
'imported' => $importStatusCount['IMPORTED'],
'total' => $importStatusCount['TOTAL'],
- 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 'getDefaultFieldValues'. Open
$this->defaultValues = \App\Json::decode($this->defaultValues);
- 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 'importRecords'. Open
$fieldData[$fieldName] = \App\Purifier::decodeHtml($row[$fieldName]);
- 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\User' in method 'importRecords'. Open
$ownerId = \App\User::getUserIdByName(trim($comparisonValue));
- 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\User' in method 'getScheduledImport'. Open
$scheduledImports[$importId] = new self($importInfo, \App\User::getUserModel($importInfo['user_id']));
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'Import_Utils_Helper' in method 'initializeImport'. Open
Import_Utils_Helper::showImportLockedError($lockInfo);
- 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 'Import_Lock_Action' in method 'finishImport'. Open
Import_Lock_Action::unLock($this->user, $this->module);
- 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 'importRecords'. 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
The method importRecords uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$createRecord = true;
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class 'Vtiger_Inventory_Model' in method 'transformInventoryForImport'. Open
$inventoryModel = Vtiger_Inventory_Model::getInstance($this->module);
- 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\User' in method 'runScheduledImport'. Open
App\User::setCurrentUserId($importDataController->user->getId());
- 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\Record' in method 'addRelation'. Open
$sourceRecord = \App\Record::isExists($sourceId) ? Vtiger_Record_Model::getInstanceById($sourceId) : null;
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'Users_Privileges_Model' in method 'checkPermission'. Open
$currentUserPrivilegesModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Cache' in method 'getDefaultFieldValues'. Open
return \App\Cache::staticGet('DefaultFieldValues', $key);
- 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\Currency' in method 'transformInventoryForImport'. Open
$valueData = \App\Fields\Currency::getCurrencyIdByName($key);
- 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 getImportDetails uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$importRecords['failed'][] = $record;
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class 'Vtiger_Relation_Model' in method 'addRelation'. Open
$relationModel = Vtiger_Relation_Model::getInstanceById($relationId);
- 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 "MERGED" 3 times. Open
'CREATED' => 0, 'SKIPPED' => 0, 'UPDATED' => 0, 'MERGED' => 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 "SKIPPED" 3 times. Open
'CREATED' => 0, 'SKIPPED' => 0, 'UPDATED' => 0, 'MERGED' => 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 "temp_status" 5 times. Open
\App\Db::getInstance()->createCommand()->update($tableName, ['temp_status' => $entityInfo['status'], 'recordid' => $entityId], ['id' => $entryId])->execute();
- 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 "DefaultFieldValues" 3 times. Open
if (\App\Cache::staticHas('DefaultFieldValues', $key)) {
- 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 "skipped" 3 times. Open
'skipped' => $importStatusCount['SKIPPED'],
- 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 "reference" 3 times. Open
} elseif (!\in_array($fieldInstance->getFieldDataType(), ['datetime', 'date', 'time', 'reference'])) {
- 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" 7 times. Open
\App\Db::getInstance()->createCommand()->update($tableName, ['temp_status' => $entityInfo['status'], 'recordid' => $entityId], ['id' => $entryId])->execute();
- 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 "relation_id" 6 times. Open
if ($row['relation_id'] ?? null) {
- 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 "UPDATED" 3 times. Open
'CREATED' => 0, 'SKIPPED' => 0, 'UPDATED' => 0, 'MERGED' => 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 "IMPORTED" 5 times. Open
$statusCount = ['TOTAL' => 0, 'IMPORTED' => 0, 'FAILED' => 0, 'PENDING' => 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 "field" 7 times. Open
if ($this->inventoryFieldMapData[$mapData['field']] && $this->inventoryFieldMapData[$mapData['field']][$entityName]) {
- 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 "inventoryData" 8 times. Open
$fieldData['inventoryData'] = $inventoryFieldData;
- 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 "src_record" 5 times. Open
$this->addRelation($row['relation_id'], $row['src_record'], Vtiger_Record_Model::getInstanceById($baseRecordId));
- 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 "CREATED" 3 times. Open
'CREATED' => 0, 'SKIPPED' => 0, 'UPDATED' => 0, 'MERGED' => 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 "DefaultMandatoryFieldValues" 3 times. Open
if (\App\Cache::staticHas('DefaultMandatoryFieldValues', $key)) {
- 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 "failed" 3 times. Open
'failed' => $importStatusCount['FAILED'],
- 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 "FAILED" 3 times. Open
$statusCount = ['TOTAL' => 0, 'IMPORTED' => 0, 'FAILED' => 0, 'PENDING' => 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 "owner" 3 times. Open
if ('owner' === $fieldInstance->getFieldDataType()) {
- 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 "TOTAL" 3 times. Open
$statusCount = ['TOTAL' => 0, 'IMPORTED' => 0, 'FAILED' => 0, 'PENDING' => 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.
Avoid unused local variables such as '$header'. Open
foreach ($importRecords['headers'] as $columnName => $header) {
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
Parameter $user
has undeclared type \App\User
(Did you mean class \Tests\App\User) Open
public function __construct($importInfo, App\User $user)
- Exclude checks
Argument 1 (mixed)
is string
but \Users_Privileges_Model::hasModulePermission()
takes int
defined at /code/modules/Users/models/Privileges.php:101
Open
if (!$currentUserPrivilegesModel->hasModulePermission($request->getModule())) {
- Exclude checks
Call to method getId
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
$key = $this->module . '_' . $this->user->getId();
- Exclude checks
Call to method getId
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
$defaultValue[$fieldName] = $this->user->getId();
- Exclude checks
Call to method getId
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
$defaultValue[$mandatoryFieldName] = $this->user->getId();
- Exclude checks
Argument 1 (encodedValue)
is array{}
but \App\Json::decode()
takes string
defined at /code/app/Json.php:37
Open
$this->defaultValues = \App\Json::decode($this->defaultValues);
- Exclude checks
Call to method getId
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
$key = $this->module . '_' . $this->user->getId();
- Exclude checks
Returning type array{TOTAL:0,IMPORTED:0,FAILED:0,PENDING:0,CREATED:0,SKIPPED:0,UPDATED:0,MERGED:0}
but getImportStatusCount()
is declared to return int
Open
return $statusCount;
- Exclude checks
Argument 2 (module)
is \vtlib\Module|\vtlib\ModuleBasic
but \Vtiger_Field_Model::getInstance()
takes \Vtiger_Module_Model|false
defined at /code/modules/Vtiger/models/Field.php:1158
Open
$fieldObject = $moduleObject ? Vtiger_Field_Model::getInstance($mapData['field'], $moduleObject) : null;
- Exclude checks
Call to method count
from undeclared class \yii\db\DataReader
Open
if ($dataReader->count()) {
- Exclude checks
Suspicious array access to null
Open
$entityInfo['status'] = self::IMPORT_RECORD_SKIPPED;
- Exclude checks
Call to undeclared method \Vtiger_Basic_InventoryField::getCurrencyParam
Open
$currencyParam = $fieldInstance->getCurrencyParam([], $currencyParam);
- Exclude checks
Call to method getUserModel
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
$scheduledImports[$importId] = new self($importInfo, \App\User::getUserModel($importInfo['user_id']));
- Exclude checks
Suspicious array access to null
Open
$entityInfo['status'] = self::IMPORT_RECORD_UPDATED;
- Exclude checks
null
passed to foreach instead of array Open
foreach ($inventoryData as &$data) {
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$query->from($tableName)->where(['temp_status' => self::IMPORT_RECORD_NONE]);
- Exclude checks
Call to method __construct
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$queryGenerator = new App\QueryGenerator($moduleName, $this->user->getId());
- Exclude checks
Suspicious array access to null
Open
$entityInfo['status'] = self::IMPORT_RECORD_MERGED;
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$query = (new \App\Db\Query())->select(['temp_status'])->from($tableName);
- Exclude checks
Doc-block of $sourceId
in addRelation
contains phpdoc param type null
which is incompatible with the param type int
declared in the signature Open
* @param int|null $sourceId
- Exclude checks
Call to method createQuery
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$query = $queryGenerator->createQuery();
- Exclude checks
Call to method getGroupId
from undeclared class \App\Fields\Owner
Open
$ownerId = \App\Fields\Owner::getGroupId($comparisonValue);
- Exclude checks
Reference to undeclared property \Import_Data_Action->currentInventoryRawData
Open
if ($this->currentInventoryRawData['name']) {
- Exclude checks
Call to undeclared method \Vtiger_Field_Model::getValuesName
Open
$picklist = $fieldObject->getValuesName();
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
\App\Db::getInstance()->createCommand()->update($tableName, ['temp_status' => $entityInfo['status'], 'recordid' => $entityId], ['id' => $entryId])->execute();
- Exclude checks
When appending to a value of type array{},
found an array access index of type \App\Fields\type,
but expected the index to be of type int|string
Open
$newCurrencyParam[$valueData] = $currencyData;
- Exclude checks
Reference to undeclared property \Import_Data_Action->currentInventoryRawData
Open
[$entityName] = $this->transformInventoryReference($this->currentInventoryRawData['name'], true);
- Exclude checks
Saw an @param annotation for fieldInstance,
but it was not found in the param list of function transformInventoryReference(mixed $value, false|mixed $getArray = null) : mixed
Open
* @param \Vtiger_Field_Model $fieldInstance
- Exclude checks
Call to method getId
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
if ($lockInfo['userid'] != $this->user->getId()) {
- Exclude checks
Call to method read
from undeclared class \yii\db\DataReader
Open
while ($row = $dataReader->read()) {
- Exclude checks
Call to method getModuleFields
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$moduleFields = $queryGenerator->getModuleFields();
- Exclude checks
Call to method close
from undeclared class \yii\db\DataReader
Open
$dataReader->close();
- Exclude checks
Reference to undeclared property \Import_Data_Action->currentInventoryRawData
Open
$this->currentInventoryRawData = $data;
- Exclude checks
Reference to undeclared property \Import_Data_Action->currentInventoryRawData
Open
$this->currentInventoryRawData = [];
- Exclude checks
Call to deprecated function \Vtiger_Field_Model::getFieldLabel()
defined at /code/modules/Vtiger/models/Field.php:215
Open
$importRecords['headers'][$fieldName] = $moduleModel->getFieldByName($fieldName)->getFieldLabel();
- Exclude checks
Argument 1 (encodedValue)
is array{}
but \App\Json::decode()
takes string
defined at /code/app/Json.php:37
Open
$this->defaultValues = \App\Json::decode($this->defaultValues);
- Exclude checks
Call to method getUserIdByName
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
$ownerId = \App\User::getUserIdByName(trim($comparisonValue));
- Exclude checks
Call to method addCondition
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$queryGenerator->addCondition($mergeField, $comparisonValue, 'e');
- Exclude checks
Parameter $user
has undeclared type \App\User
(Did you mean class \Tests\App\User) Open
public static function getImportDetails(App\User $user, $forModule)
- Exclude checks
Call to undeclared method \App\Db\Query::limit
Open
$query->limit($importBatchLimit);
- Exclude checks
Call to method getId
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
$queryGenerator = new App\QueryGenerator($moduleName, $this->user->getId());
- Exclude checks
Call to method getUserIdByFullName
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
$ownerId = \App\User::getUserIdByFullName(trim($comparisonValue));
- Exclude checks
Saw misspelled annotation @returns.
Did you mean @return?
Open
* @returns array Import Records with the list of skipped records and failed records
- Exclude checks
Call to method read
from undeclared class \yii\db\DataReader
Open
while ($row = $dataReader->read()) {
- Exclude checks
Call to method getInstance
from undeclared class \App\Fields\RecordNumber
(Did you mean class \Tests\Base\RecordNumber) Open
\App\Fields\RecordNumber::getInstance($this->module)->updateRecords();
- Exclude checks
Suspicious array access to null
Open
$entityInfo['status'] = self::IMPORT_RECORD_MERGED;
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$query->from($tableName)->where(['temp_status' => [self::IMPORT_RECORD_SKIPPED, self::IMPORT_RECORD_FAILED]]);
- Exclude checks
Call to method getId
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
$defaultMandatoryValues[$mandatoryFieldName] = $this->user->getId();
- Exclude checks
Call to method setFields
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$queryGenerator->setFields(['id']);
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$inventoryFieldData = (new \App\Db\Query())->from($inventoryTableName)->where(['id' => $rowId])->all();
- Exclude checks
Saw an @param annotation for fieldValue,
but it was not found in the param list of function transformInventoryReference(mixed $value, false|mixed $getArray = null) : mixed
Open
* @param string $fieldValue
- Exclude checks
Call to method setCurrentUserId
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
App\User::setCurrentUserId($importDataController->user->getId());
- Exclude checks
Call to undeclared method \App\Db::getTableSchema
Open
$columnNames = $db->getTableSchema($tableName, true)->getColumnNames();
- Exclude checks
Call to method close
from undeclared class \yii\db\DataReader
Open
$dataReader->close();
- Exclude checks
Default value for string
$moduleName
can't be false
Open
public function updateRecordByModel($record, $fieldData, $moduleName = false, ?int $relationId = 0, ?int $sourceId = 0)
- Exclude checks
Avoid excessively long variable names like $defaultMandatoryFieldValues. Keep variable name length under 20. Open
$defaultMandatoryFieldValues = $this->getDefaultMandatoryFieldValues();
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $inventoryFieldMapData. Keep variable name length under 20. Open
protected $inventoryFieldMapData = [];
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $defaultMandatoryValues. Keep variable name length under 20. Open
$defaultMandatoryValues = [];
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $referenceFileValueComponents. Keep variable name length under 20. Open
$referenceFileValueComponents = explode('::::', $comparisonValue);
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $currentUserPrivilegesModel. Keep variable name length under 20. Open
$currentUserPrivilegesModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
- 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 Import_Data_Action extends \App\Controller\Action
- Exclude checks
The class Import_Data_Action is not named in CamelCase. Open
class Import_Data_Action extends \App\Controller\Action
{
public $id;
public $user;
public $module;
- 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 $ID. Configured minimum length is 3. Open
$ID = $recordModel->getId();
- 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 $id. Configured minimum length is 3. Open
public $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
const IMPORT_RECORD_SKIPPED = 2;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
const IMPORT_RECORD_FAILED = 5;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Cache::staticSave('DefaultFieldValues', $key, $defaultValue);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get default mandatory field values.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($this->defaultValues) && !\is_array($this->defaultValues)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleModel = Vtiger_Module_Model::getInstance($this->module);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->importRecords();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $inventoryFieldMapData = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
const IMPORT_RECORD_NONE = 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->module = $importInfo['module'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$defaultValue = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$key = $this->module . '_' . $this->user->getId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldDefaultValue = $fieldInstance->getDefaultFieldValue();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($this->defaultValues[$mandatoryFieldName])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif (!empty($fieldDefaultValue)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Cache::staticSave('DefaultMandatoryFieldValues', $key, $defaultMandatoryValues);
- Exclude checks
Spaces must 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 initializeImport()
- Exclude checks
Spaces must 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 \App\Cache::staticGet('DefaultMandatoryFieldValues', $key);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->defaultValues = \App\Json::decode($this->defaultValues);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif (!\in_array($fieldInstance->getFieldDataType(), ['datetime', 'date', 'time', 'reference'])) {
- Exclude checks
Spaces must 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->updateModuleSequenceNumber();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function __construct($importInfo, App\User $user)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif (!empty($fieldDefaultValue)) {
- Exclude checks
Spaces must 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 $fieldMapping;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
const IMPORT_RECORD_MERGED = 4;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->defaultValues = $importInfo['default_values'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$currentUserPrivilegesModel->hasModulePermission($request->getModule())) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->defaultValues) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleModel = Vtiger_Module_Model::getInstance($this->module);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mandatoryFieldName = $fieldInstance->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 array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $defaultValues = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($moduleModel->getMandatoryFieldModels() as $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
$this->id = $importInfo['id'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currentUserPrivilegesModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return \App\Cache::staticGet('DefaultFieldValues', $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
if (empty($defaultValue[$mandatoryFieldName])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$defaultValue[$fieldName] = $this->user->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
$defaultMandatoryValues = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->finishImport();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $importInfo
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ('owner' === $fieldInstance->getFieldDataType()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$defaultMandatoryValues[$mandatoryFieldName] = $this->user->getId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$defaultMandatoryValues[$mandatoryFieldName] = '????';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $mergeType;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $entitydata = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Constructor.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->defaultValues = \App\Json::decode($this->defaultValues);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif (!\in_array($fieldInstance->getFieldDataType(), ['datetime', 'date', 'time', 'reference'])) {
- Exclude checks
Spaces must 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 (\App\Cache::staticHas('DefaultMandatoryFieldValues', $key)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mandatoryFieldName = $fieldInstance->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
public $importedRecordInfo = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$defaultValue[$mandatoryFieldName] = $this->user->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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function importData()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$lockInfo = Import_Lock_Action::isLockedForModule($this->module);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($lockInfo['userid'] != $this->user->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
throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406);
- Exclude checks
Spaces must 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 getDefaultFieldValues()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('owner' === $fieldInstance->getFieldDataType()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$defaultValue[$mandatoryFieldName] = '????';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (52 === $fieldInstance->getUIType()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Import_Lock_Action::lock($this->id, $this->module, $this->user);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $module;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $type;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $mergeFields;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
const IMPORT_RECORD_CREATED = 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->mergeFields = $importInfo['merge_fields'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$defaultValue = $this->defaultValues;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldDefaultValue = $fieldInstance->getDefaultFieldValue();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getDefaultMandatoryFieldValues()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->mergeType = $importInfo['merge_type'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function import()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($lockInfo) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function checkPermission(App\Request $request)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!\is_array($this->defaultValues)) {
- Exclude checks
Spaces must 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 $defaultValue;
- Exclude checks
Spaces must 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->initializeImport()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Import_Utils_Helper::showImportLockedError($lockInfo);
- Exclude checks
Spaces must 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 $batchImport = true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must 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 (\App\Cache::staticHas('DefaultFieldValues', $key)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($moduleModel->getMandatoryFieldModels() as $fieldInstance) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($moduleModel->getFields() as $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
public $id;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $user;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function process(App\Request $request)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($this->defaultValues)) {
- Exclude checks
Spaces must 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($defaultValue[$fieldName])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $defaultMandatoryValues;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
const IMPORT_RECORD_UPDATED = 3;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param \App\User $user
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get default field values.
- Exclude checks
Spaces must 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
$defaultValue[$fieldName] = $fieldDefaultValue;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$defaultMandatoryValues[$mandatoryFieldName] = $fieldDefaultValue;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->importData();
- Exclude checks
Spaces must 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
$query = new \App\Db\Query();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$importBatchLimit = \App\Config::module('Import', 'BATCH_LIMIT');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mergeTypeValue = $this->mergeType;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$queryGenerator->addCondition($mergeField, $comparisonValue, 'e');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query = $queryGenerator->createQuery();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\in_array($fieldName, $mandatoryFieldNames)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('' === $fieldValue && '' !== $currentValue && null !== $currentValue) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// only if actual record field is empty and file field is empty too
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldValue = $defaultFieldValues[$fieldName];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldData = $this->transformForImport($fieldData);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->updateRecordByModel($baseRecordId, $fieldData, $moduleName, $row['relation_id'] ?? 0, $row['src_record'] ?? 0);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($this->fieldMapping as $fieldName => $index) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$baseRecordId = $query->scalar();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($baseRecordId) {
- Exclude checks
Spaces must 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->updateRecordByModel($baseRecordId, $fieldData, $moduleName, $row['relation_id'] ?? 0, $row['src_record'] ?? 0);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currentValue = $recordModel->get($fieldName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
});
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->fieldMapping = $importInfo['field_mapping'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->user = $user;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$key = $this->module . '_' . $this->user->getId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$defaultMandatoryValues[$mandatoryFieldName] = $this->defaultValues[$mandatoryFieldName];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Import data.
- Exclude checks
Line exceeds 120 characters; contains 166 characters Open
\App\Db::getInstance()->createCommand()->update($tableName, ['temp_status' => $entityInfo['status'], 'recordid' => $entityId], ['id' => $entryId])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function importRecords()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\count($referenceFileValueComponents) > 1) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel = Vtiger_Record_Model::getInstanceById($baseRecordId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
unset($fieldData[$unsetName]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// fill out empty values with defaults for all fields
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Fields\RecordNumber::getInstance($this->module)->updateRecords();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleName = $this->module;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($isInventory) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$inventoryFieldData = (new \App\Db\Query())->from($inventoryTableName)->where(['id' => $rowId])->all();
- Exclude checks
Spaces must 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 ($forUnset as $unsetName) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function finishImport()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tableName = Import_Module_Model::getDbTableName($this->user);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->from($tableName)->where(['temp_status' => self::IMPORT_RECORD_NONE]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldData = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($ownerId)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$referenceFileValueComponents = explode(':::', $comparisonValue);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$comparisonValue = trim($referenceFileValueComponents[1]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($fieldData as $fieldName => &$fieldValue) {
- 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
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// only if actual record field is empty and file field is empty too
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$defaultFieldValues = $this->getDefaultFieldValues();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currentValue = $recordModel->get($fieldName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $entryId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tableName = Import_Module_Model::getDbTableName($this->user);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$rowId = $row['id'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$queryGenerator->setFields(['id']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('reference' == $fieldInstance->getFieldDataType()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
switch ($mergeTypeValue) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$entityInfo['status'] = self::IMPORT_RECORD_UPDATED;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$entityInfo['status'] = self::IMPORT_RECORD_MERGED;
- Exclude checks
Spaces must 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 ($isInventory) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldData[$fieldName] = \App\Purifier::decodeHtml($row[$fieldName]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldInstance = $moduleFields[$mergeField];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($ownerId)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$ownerId = \App\Fields\Owner::getGroupId($comparisonValue);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$referenceFileValueComponents = explode('::::', $comparisonValue);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case Import_Module_Model::AUTO_MERGE_IGNORE:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$defaultFieldValues = $this->getDefaultFieldValues();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($fieldData as $fieldName => &$fieldValue) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case Import_Module_Model::AUTO_MERGE_EXISTINGISPRIORITY:
- Exclude checks
Spaces must 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
$moduleFields = $queryGenerator->getModuleFields();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$comparisonValue = $ownerId ?: 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldValue = $defaultMandatoryFieldValues[$fieldName];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// fill out empty values with defaults for all fields
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel = Vtiger_Record_Model::getInstanceById($baseRecordId);
- Exclude checks
Spaces must 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\Db::getInstance()->createCommand()->update($tableName, ['temp_status' => $entityInfo['status'], 'recordid' => $entityId], ['id' => $entryId])->execute();
- 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
while ($row = $dataReader->read()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('owner' == $fieldInstance->getFieldDataType()) {
- Exclude checks
Spaces must 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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currentValue = $recordModel->get($fieldName);
- Exclude checks
Line exceeds 120 characters; contains 221 characters Open
} elseif ('' === $fieldValue && ('' === $currentValue || null === $currentValue) && isset($defaultMandatoryFieldValues[$fieldName]) && '' !== $defaultMandatoryFieldValues[$fieldName]) {
- Exclude checks
Line exceeds 120 characters; contains 146 characters Open
$this->updateRecordByModel($baseRecordId, $fieldData, $moduleName, $row['relation_id'] ?? 0, $row['src_record'] ?? 0);
- Exclude checks
Line exceeds 120 characters; contains 193 characters Open
if ('' === $fieldValue && ('' === $currentValue || null === $currentValue) && isset($defaultFieldValues[$fieldName]) && '' !== $defaultFieldValues[$fieldName]) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// remove empty values - do not modify existing
- Exclude checks
Spaces must 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 updateImportStatus($entryId, $entityInfo)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$isInventory = $moduleModel->isInventory();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader = $query->createCommand()->query();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($this->mergeFields as $index => $mergeField) {
- Exclude checks
Line exceeds 120 characters; contains 145 characters Open
$this->addRelation($row['relation_id'], $row['src_record'], Vtiger_Record_Model::getInstanceById($baseRecordId));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$forUnset = [];
- Exclude checks
Spaces must 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 ($fieldData as $fieldName => &$fieldValue) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Import_Queue_Action::remove($this->id);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->batchImport) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$queryGenerator = new App\QueryGenerator($moduleName, $this->user->getId());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case Import_Module_Model::AUTO_MERGE_MERGEFIELDS:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('' === $fieldValue && ('' === $currentValue || null === $currentValue) && isset($defaultFieldValues[$fieldName]) && '' !== $defaultFieldValues[$fieldName]) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function updateModuleSequenceNumber()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Import records.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->limit($importBatchLimit);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$ownerId = \App\User::getUserIdByFullName(trim($comparisonValue));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$defaultMandatoryFieldValues = $this->getDefaultMandatoryFieldValues();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldData = array_filter($fieldData, function ($fieldValue) {
- Exclude checks
Line exceeds 120 characters; contains 146 characters Open
$this->updateRecordByModel($baseRecordId, $fieldData, $moduleName, $row['relation_id'] ?? 0, $row['src_record'] ?? 0);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Update import status.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $entityInfo
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($row['relation_id'] ?? null) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$forUnset[] = $fieldName;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldData = $this->transformForImport($fieldData);
- Exclude checks
Spaces must 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
$inventoryTableName = Import_Module_Model::getInventoryDbTableName($this->user);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$createRecord = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($mergeTypeValue) && Import_Module_Model::AUTO_MERGE_NONE !== $mergeTypeValue) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$entityInfo['status'] = self::IMPORT_RECORD_SKIPPED;
- 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
$mandatoryFieldNames = array_keys($defaultMandatoryFieldValues);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ('' === $fieldValue && ('' === $currentValue || null === $currentValue) && isset($defaultMandatoryFieldValues[$fieldName]) && '' !== $defaultMandatoryFieldValues[$fieldName]) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel = Vtiger_Record_Model::getInstanceById($baseRecordId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (null !== $currentValue && '' !== $currentValue) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// existing record data is priority - do not override - save only empty record fields
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ('' === $fieldValue && isset($defaultFieldValues[$fieldName]) && '' !== $defaultFieldValues[$fieldName]) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->updateImportStatus($rowId, $entityInfo);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @throws \App\Exceptions\AppException
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Import_Lock_Action::unLock($this->user, $this->module);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
unset($data['id']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($inventoryFields[$fieldName])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($entityName) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$entityInfo = null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->inventoryFieldMapData[$mapData['field']] && $this->inventoryFieldMapData[$mapData['field']][$entityName]) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!\is_array($this->inventoryFieldMapData[$mapData['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
$ownerId = \App\User::getUserIdByName(trim($comparisonValue));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (strpos($comparisonValue, '::::') > 0) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case Import_Module_Model::AUTO_MERGE_OVERWRITE:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return '' !== $fieldValue;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldValue = '';
- 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
$inventoryFieldData = $this->transformInventoryForImport($inventoryFieldData);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 137 characters Open
$entityInfo = $this->createRecordByModel($moduleName, $fieldData, $row['relation_id'] ?? 0, $row['src_record'] ?? 0);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$inventoryModel = Vtiger_Inventory_Model::getInstance($this->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
[$entityName] = $this->transformInventoryReference($this->currentInventoryRawData['name'], true);
- 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
$entityId = $entityInfo['id'] ?? null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$comparisonValue = $fieldData[$mergeField];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->addRelation($row['relation_id'], $row['src_record'], Vtiger_Record_Model::getInstanceById($baseRecordId));
- Exclude checks
Line exceeds 120 characters; contains 121 characters Open
// existing record data is priority - do not override - save only empty record fields
- 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
$entityInfo = null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return mixed
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$maps = $inventoryModel->getAutoCompleteFields();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif (\array_key_exists($fieldName, $maps)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = $this->transformInventoryFieldFromMap($value, $maps[$fieldName]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function transformInventoryFieldFromMap($value, $mapData)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function transforms value for reference type field.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// remove empty values - do not modify existing
- Exclude checks
Spaces must 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
$value = $this->transformInventoryReference($value);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($valueData) {
- Exclude checks
Line exceeds 120 characters; contains 146 characters Open
$this->updateRecordByModel($baseRecordId, $fieldData, $moduleName, $row['relation_id'] ?? 0, $row['src_record'] ?? 0);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$createRecord = true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($createRecord) {
- 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 (null === $entityInfo) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currencyParam = $data['currencyparam'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Transform inventory field from map.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->currentInventoryRawData['name']) {
- Exclude checks
Line exceeds 120 characters; contains 124 characters Open
$fieldObject = $moduleObject ? Vtiger_Field_Model::getInstance($mapData['field'], $moduleObject) : null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = trim($value);
- Exclude checks
Spaces must 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 ($inventoryData as &$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
$fieldObject = $moduleObject ? Vtiger_Field_Model::getInstance($mapData['field'], $moduleObject) : 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
if (\in_array($value, $picklist)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = array_search($value, $picklist);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Line exceeds 120 characters; contains 147 characters Open
} elseif ('' === $fieldValue && isset($defaultFieldValues[$fieldName]) && '' !== $defaultFieldValues[$fieldName]) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$data['currencyparam'] = \App\Json::encode($newCurrencyParam);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param $inventoryData
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function transformInventoryReference($value, $getArray = 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
$picklist = $fieldObject->getValuesName();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $getArray
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldInstance = $inventoryFields[$fieldName];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\in_array($fieldInstance->getType(), ['Name', 'Reference'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currencyParam = $fieldInstance->getCurrencyParam([], $currencyParam);
- Exclude checks
Spaces must 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 134 characters Open
if ($this->inventoryFieldMapData[$mapData['field']] && $this->inventoryFieldMapData[$mapData['field']][$entityName]) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->inventoryFieldMapData[$mapData['field']][$entityName] = $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
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (strpos($value, '::::') > 0) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldData = $this->transformForImport($fieldData);
- 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
$fieldData['inventoryData'] = $inventoryFieldData;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ('Currency' == $fieldInstance->getType()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = \App\Fields\Currency::getCurrencyIdByName($value);
- Exclude checks
Spaces must 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 mixed
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return '' !== $fieldValue;
- Exclude checks
Spaces must 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
$inventoryFields = $inventoryModel->getFields();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param $value
- Exclude checks
Spaces must 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 = $this->inventoryFieldMapData[$mapData['field']][$entityName];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $value;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$entityInfo = $this->createRecordByModel($moduleName, $fieldData, $row['relation_id'] ?? 0, $row['src_record'] ?? 0);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$entityInfo = ['id' => null, 'status' => self::IMPORT_RECORD_FAILED];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->currentInventoryRawData = $data;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($data as $fieldName => &$value) {
- Exclude checks
Spaces must 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->currentInventoryRawData = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $inventoryData;
- Exclude checks
Spaces must 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 false|int|string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleObject = vtlib\Module::getInstance($entityName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->inventoryFieldMapData[$mapData['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
* @param \Vtiger_Field_Model $fieldInstance
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $value
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$entityInfo['status'] = self::IMPORT_RECORD_MERGED;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader->close();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$valueData = \App\Fields\Currency::getCurrencyIdByName($key);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('picklist' === $fieldObject->getFieldDataType()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldData = array_filter($fieldData, function ($fieldValue) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->updateRecordByModel($baseRecordId, $fieldData, $moduleName, $row['relation_id'] ?? 0, $row['src_record'] ?? 0);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$createRecord = true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($fieldData && $isInventory) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Transform inventory for import.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$newCurrencyParam = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $fieldValue
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (null === $fieldData) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->importedRecordInfo[$rowId] = $entityInfo;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function transformInventoryForImport($inventoryData)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$newCurrencyParam[$valueData] = $currencyData;
- Exclude checks
Spaces must 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($value)) {
- 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 (!\array_key_exists($value, $picklist)) {
- Exclude checks
Spaces must 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
if (!empty($value)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldValue = $defaultFieldValues[$fieldName];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$createRecord = true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldData = $this->transformForImport($fieldData);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($currencyParam as $key => $currencyData) {
- Exclude checks
Spaces must 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 $mapData
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldValueDetails = explode(':::', $value);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
++$statusCount['MERGED'];
- 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
return $statusCount;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'imported' => $importStatusCount['IMPORTED'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'module' => App\Language::translate($importDataController->module, $importDataController->module),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$record = \Vtiger_Record_Model::getCleanInstance($forModule);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif (strpos($value, ':::') > 0) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = \App\Record::getCrmIdByLabel($referenceModuleName, $entityLabel);
- Exclude checks
Spaces must 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 = Vtiger_Module_Model::getInstance($this->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
$dataReader->close();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function runScheduledImport()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'skipped' => $importStatusCount['SKIPPED'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$importDataController->finishImport();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $scheduledImports;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleModel = Vtiger_Module_Model::getInstance($forModule);
- Exclude checks
Spaces must 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
$tableName = Import_Module_Model::getDbTableName($this->user);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'failed' => $importStatusCount['FAILED'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
while ($row = $dataReader->read()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$entityLabel = trim($fieldValueDetails[1]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $fieldData
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
++$statusCount['TOTAL'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
++$statusCount['IMPORTED'];
- 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
case self::IMPORT_RECORD_UPDATED:
- 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
'template' => 'ImportCron',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$importQueue = Import_Queue_Action::getAll(Import_Queue_Action::$IMPORT_STATUS_SCHEDULED);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$importRecords = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($key > 2) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$importRecords['headers'][$fieldName] = $moduleModel->getFieldByName($fieldName)->getFieldLabel();
- Exclude checks
Spaces must 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 transformForImport($fieldData)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case self::IMPORT_RECORD_MERGED:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$scheduledImports = self::getScheduledImport();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$importDataController->batchImport = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$scheduledImports[$importId] = new self($importInfo, \App\User::getUserModel($importInfo['user_id']));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param \App\User $user
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (self::IMPORT_RECORD_SKIPPED === (int) $row['temp_status']) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldData[$fieldName] = $fieldInstance->getUITypeModel()->getValueFromImport($fieldValue, $this->defaultValues[$fieldName] ?? null);
- Exclude checks
Line exceeds 120 characters; contains 145 characters Open
$fieldData[$fieldName] = $fieldInstance->getUITypeModel()->getValueFromImport($fieldValue, $this->defaultValues[$fieldName] ?? null);
- 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
case self::IMPORT_RECORD_FAILED:
- 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
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
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
App\User::setCurrentUserId($importDataController->user->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
$query = new \App\Db\Query();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader = $query->createCommand()->query();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $importRecords;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query = (new \App\Db\Query())->select(['temp_status'])->from($tableName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
--$statusCount['IMPORTED'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$importStatusCount = $importDataController->getImportStatusCount();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @parms \App\User $user Current Users
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tableName = Import_Module_Model::getDbTableName($user);
- Exclude checks
Spaces must 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
'CREATED' => 0, 'SKIPPED' => 0, 'UPDATED' => 0, 'MERGED' => 0, ];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
++$statusCount['UPDATED'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'updated' => $importStatusCount['UPDATED'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $forModule
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$statusCount = ['TOTAL' => 0, 'IMPORTED' => 0, 'FAILED' => 0, 'PENDING' => 0,
- 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
foreach ($importQueue as $importId => $importInfo) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldInstance = $moduleModel->getFieldByName($fieldName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
while (false !== ($status = $dataReader->readColumn(0))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
switch ($status) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case self::IMPORT_RECORD_CREATED:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'to' => [$importDataController->user->getDetail('email1') => $importDataController->user->getName()],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$columnNames = $db->getTableSchema($tableName, true)->getColumnNames();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$importRecords['skipped'][] = $record;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($fieldData as $fieldName => $fieldValue) {
- Exclude checks
Spaces must 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 ($scheduledImports as $importDataController) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$importDataController->importData();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'created' => $importStatusCount['CREATED'],
- Exclude checks
Spaces must 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
$fieldValueDetails = explode('::::', $value);
- Exclude checks
Spaces must 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($fieldValueDetails) && \count($fieldValueDetails) > 1) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$referenceModuleName = trim($fieldValueDetails[0]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get import status count.
- Exclude checks
Spaces must 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 getImportStatusCount()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case self::IMPORT_RECORD_NONE:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
--$statusCount['IMPORTED'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$scheduledImports = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get Record details of import.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @parms string $forModule Imported module
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($columnNames as $key => $fieldName) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader->close();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function parses data to import.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case self::IMPORT_RECORD_SKIPPED:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$importDataController->initializeImport()) {
- Exclude checks
Spaces must 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 getScheduledImport()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @returns array Import Records with the list of skipped records and failed records
- 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
foreach ($importRecords['headers'] as $columnName => $header) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$record->set($columnName, $row[$columnName]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$importRecords['failed'][] = $record;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $getArray ? [$referenceModuleName, $value] : $value;
- Exclude checks
Spaces must 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 int
- 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
$query->from($tableName)->where(['temp_status' => [self::IMPORT_RECORD_SKIPPED, self::IMPORT_RECORD_FAILED]]);
- Exclude checks
Spaces must 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
++$statusCount['FAILED'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
++$statusCount['SKIPPED'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'merged' => $importStatusCount['MERGED'],
- Exclude checks
Spaces must 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 $fieldData;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader = $query->createCommand()->query();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
++$statusCount['PENDING'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
++$statusCount['CREATED'];
- 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
* Function run scheduled import and send email.
- Exclude checks
Spaces must 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\Mailer::sendFromTemplate([
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'total' => $importStatusCount['TOTAL'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getImportDetails(App\User $user, $forModule)
- Exclude checks
Spaces must 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 ($dataReader->count()) {
- 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
$temp_status = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $temp_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
* @param string $moduleName
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$ID = $recordModel->getId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Add relation.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function addRelation(int $relationId, int $sourceId, Vtiger_Record_Model $recordModel)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
&& $sourceRecord && $sourceRecord->isViewable()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $value
- Exclude checks
Spaces must 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 'merged':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$temp_status = self::IMPORT_RECORD_MERGED;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$inventoryData = $fieldData['inventoryData'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$relationModel = Vtiger_Relation_Model::getInstanceById($relationId);
- Exclude checks
Spaces must 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 updateRecordByModel($record, $fieldData, $moduleName = false, ?int $relationId = 0, ?int $sourceId = 0)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return int
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$sourceRecord = \App\Record::isExists($sourceId) ? Vtiger_Record_Model::getInstanceById($sourceId) : null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($relationModel
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
&& $relationModel->getRelationModuleName() === $this->module
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
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
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Line exceeds 120 characters; contains 123 characters Open
public function updateRecordByModel($record, $fieldData, $moduleName = false, ?int $relationId = 0, ?int $sourceId = 0)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($fieldData as $fieldName => &$value) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->set($fieldName, $value);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->save();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get import record status.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'failed':
- Exclude checks
Spaces must 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->addRelation($relationId, $sourceId, $recordModel);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'created':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'skipped':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$temp_status = self::IMPORT_RECORD_UPDATED;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->initInventoryData($inventoryData, false);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($relationId) {
- Exclude checks
Spaces must 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 ($relationId) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$temp_status = self::IMPORT_RECORD_CREATED;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'updated':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$temp_status = self::IMPORT_RECORD_FAILED;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function createRecordByModel($moduleName, $fieldData, ?int $relationId = 0, ?int $sourceId = 0)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->set($fieldName, $value);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int|null $sourceId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int|null $sourceId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel = Vtiger_Record_Model::getInstanceById($record, $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
$temp_status = self::IMPORT_RECORD_SKIPPED;
- 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
case 'none':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $fieldData
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($inventoryData)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $relationId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $record
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $fieldData
- 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
$recordModel->save();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
&& $relationModel->getParentModuleModel()->getName() === $sourceRecord->getModuleName()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int|null $relationId
- Exclude checks
Spaces must 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 getImportRecordStatus($value)
- 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
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$temp_status = self::IMPORT_RECORD_NONE;
- 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
* @return array|null
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($ID)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$relationModel->addRelation($sourceRecord->getId(), $recordModel->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
* @param int|null $sourceId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($fieldData['inventoryData'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
unset($fieldData['inventoryData']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Create record.
- Exclude checks
Spaces must 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
default:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return ['id' => $ID, 'status' => self::IMPORT_RECORD_CREATED];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($fieldData['inventoryData'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($fieldData['inventoryData']) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
switch ($value) {
- Exclude checks
Spaces must 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 ($fieldData as $fieldName => &$value) {
- 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
unset($fieldData['inventoryData']);
- Exclude checks
Spaces must 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 Vtiger_Record_Model $recordModel
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Update record.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->initInventoryData($fieldData['inventoryData'], false);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int|null $relationId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->addRelation($relationId, $sourceId, $recordModel);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Class name "Import_Data_Action" is not in camel caps format Open
class Import_Data_Action extends \App\Controller\Action
- Exclude checks
The variable $temp_status is not named in camelCase. Open
public function getImportRecordStatus($value)
{
$temp_status = '';
switch ($value) {
case 'created':
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $temp_status is not named in camelCase. Open
public function getImportRecordStatus($value)
{
$temp_status = '';
switch ($value) {
case 'created':
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $temp_status is not named in camelCase. Open
public function getImportRecordStatus($value)
{
$temp_status = '';
switch ($value) {
case 'created':
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $temp_status is not named in camelCase. Open
public function getImportRecordStatus($value)
{
$temp_status = '';
switch ($value) {
case 'created':
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $temp_status is not named in camelCase. Open
public function getImportRecordStatus($value)
{
$temp_status = '';
switch ($value) {
case 'created':
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $temp_status is not named in camelCase. Open
public function getImportRecordStatus($value)
{
$temp_status = '';
switch ($value) {
case 'created':
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $ID is not named in camelCase. Open
public function createRecordByModel($moduleName, $fieldData, ?int $relationId = 0, ?int $sourceId = 0)
{
$recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);
if (isset($fieldData['inventoryData'])) {
$inventoryData = $fieldData['inventoryData'];
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $temp_status is not named in camelCase. Open
public function getImportRecordStatus($value)
{
$temp_status = '';
switch ($value) {
case 'created':
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $ID is not named in camelCase. Open
public function createRecordByModel($moduleName, $fieldData, ?int $relationId = 0, ?int $sourceId = 0)
{
$recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);
if (isset($fieldData['inventoryData'])) {
$inventoryData = $fieldData['inventoryData'];
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $temp_status is not named in camelCase. Open
public function getImportRecordStatus($value)
{
$temp_status = '';
switch ($value) {
case 'created':
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $ID is not named in camelCase. Open
public function createRecordByModel($moduleName, $fieldData, ?int $relationId = 0, ?int $sourceId = 0)
{
$recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);
if (isset($fieldData['inventoryData'])) {
$inventoryData = $fieldData['inventoryData'];
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}