Function read
has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring. Open
public function read()
{
$this->createTable();
$fieldMapping = $this->request->get('field_mapping');
$inventoryFieldMapping = $this->request->get('inventory_field_mapping');
- 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 getFirstRowData
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
public function getFirstRowData($hasHeader = true)
{
$isInventory = $this->moduleModel->isInventory();
$rowData = $headers = $standardData = $inventoryData = [];
foreach ($this->data as $currentRow => $data) {
- 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 read
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function read()
{
$this->createTable();
$fieldMapping = $this->request->get('field_mapping');
$inventoryFieldMapping = $this->request->get('inventory_field_mapping');
Method getFirstRowData
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getFirstRowData($hasHeader = true)
{
$isInventory = $this->moduleModel->isInventory();
$rowData = $headers = $standardData = $inventoryData = [];
foreach ($this->data as $currentRow => $data) {
Function arrayCombine
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function arrayCombine($keys, $values)
{
$combine = $dup = [];
foreach ($keys as $key => $keyData) {
if (isset($combine[$keyData])) {
- 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 read() has an NPath complexity of 26042. The configured NPath complexity threshold is 200. Open
public function read()
{
$this->createTable();
$fieldMapping = $this->request->get('field_mapping');
$inventoryFieldMapping = $this->request->get('inventory_field_mapping');
- 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 getFirstRowData() has a Cyclomatic Complexity of 15. The configured cyclomatic complexity threshold is 10. Open
public function getFirstRowData($hasHeader = true)
{
$isInventory = $this->moduleModel->isInventory();
$rowData = $headers = $standardData = $inventoryData = [];
foreach ($this->data as $currentRow => $data) {
- 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 read() has a Cyclomatic Complexity of 25. The configured cyclomatic complexity threshold is 10. Open
public function read()
{
$this->createTable();
$fieldMapping = $this->request->get('field_mapping');
$inventoryFieldMapping = $this->request->get('inventory_field_mapping');
- 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 53 to the 15 allowed. Open
public function read()
- 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 36 to the 15 allowed. Open
public function getFirstRowData($hasHeader = true)
- Read upRead up
- Exclude checks
Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.
See
Avoid using undefined variables such as '$inventoryHeaders' which will lead to PHP notices. Open
$rowData['LBL_INVENTORY_FIELDS'] = $this->arrayCombine($inventoryHeaders, $inventoryData);
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$inventoryHeaders' which will lead to PHP notices. Open
$inventoryHeaders[$key] = \App\Purifier::purify($value);
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$inventoryHeaders' which will lead to PHP notices. Open
if (!empty($isInventory) && isset($inventoryHeaders[$key])) {
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$inventoryNames' which will lead to PHP notices. Open
$key = array_search($columnParamsName, $inventoryNames);
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$inventoryNames' which will lead to PHP notices. Open
if (\in_array($columnParamsName, $inventoryNames)) {
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$inventoryNames' which will lead to PHP notices. Open
$inventoryNames[$index] = $name;
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Missing class import via use statement (line '30', column '14'). Open
$csv = new \ParseCsv\Csv();
- 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 getFirstRowData has a boolean flag argument $hasHeader, which is a certain sign of a Single Responsibility Principle violation. Open
public function getFirstRowData($hasHeader = true)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Avoid using static access to class '\App\Config' in method '__construct'. Open
$csv->encoding($this->request->get('file_encoding'), \App\Config::main('default_charset', 'UTF-8'));
- 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 'getFirstRowData'. Open
$inventoryHeaders[$key] = \App\Purifier::purify($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
The method getFirstRowData uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$standardData[$key] = $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
The method getFirstRowData uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
foreach ($data as $key => $value) {
if (!empty($isInventory) && isset($inventoryHeaders[$key])) {
$inventoryData[$key] = $value;
} else {
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method getFirstRowData uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$rowData = $standardData;
}
- 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\Purifier' in method 'getFirstRowData'. Open
$headers[$key] = \App\Purifier::purify($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
The method getFirstRowData uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$headers[$key] = \App\Purifier::purify($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 'Vtiger_Inventory_Model' in method 'read'. Open
$inventoryModel = Vtiger_Inventory_Model::getInstance($this->moduleModel->getName());
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method read uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$skip = $index;
}
- 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 unused local variables such as '$dataType'. Open
foreach ($fieldModel->getCustomColumn() as $columnParamsName => $dataType) {
- 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
Variable $inventoryNames
is undeclared Open
if (\in_array($columnParamsName, $inventoryNames)) {
- Exclude checks
Variable $inventoryNames
is undeclared Open
$key = array_search($columnParamsName, $inventoryNames);
- Exclude checks
Parameter $user
has undeclared type \App\User
(Did you mean class \Tests\App\User) Open
public function __construct(App\Request $request, App\User $user)
- Exclude checks
Reference to instance property heading
from undeclared class \ParseCsv\Csv
Open
$csv->heading = false;
- Exclude checks
Reference to instance property use_mb_convert_encoding
from undeclared class \ParseCsv\Csv
Open
$csv->use_mb_convert_encoding = true;
- Exclude checks
Reference to instance property data
from undeclared class \ParseCsv\Csv
Open
$this->data = $csv->data;
- Exclude checks
Call to method encoding
from undeclared class \ParseCsv\Csv
Open
$csv->encoding($this->request->get('file_encoding'), \App\Config::main('default_charset', 'UTF-8'));
- Exclude checks
Variable $inventoryNames
was undeclared, but array fields are being added to it. Open
$inventoryNames[$index] = $name;
- Exclude checks
Reference to instance property delimiter
from undeclared class \ParseCsv\Csv
Open
$csv->delimiter = $this->request->get('delimiter');
- Exclude checks
Call to method parseFile
from undeclared class \ParseCsv\Csv
Open
$csv->parseFile($this->getFilePath());
- Exclude checks
Call to method __construct
from undeclared class \ParseCsv\Csv
Open
$csv = new \ParseCsv\Csv();
- Exclude checks
Variable $inventoryHeaders
was undeclared, but array fields are being added to it. Open
$inventoryHeaders[$key] = \App\Purifier::purify($value);
- Exclude checks
Avoid excessively long variable names like $inventoryFieldMapping. Keep variable name length under 20. Open
$inventoryFieldMapping = $this->request->get('inventory_field_mapping');
- 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_CSVReader_Reader extends Import_FileReader_Reader
- Exclude checks
The class Import_CSVReader_Reader is not named in CamelCase. Open
class Import_CSVReader_Reader extends Import_FileReader_Reader
{
/**
* Parsed file data.
*
- Read upRead up
- Exclude checks
CamelCaseClassName
Since: 0.2
It is considered best practice to use the CamelCase notation to name classes.
Example
class class_name {
}
Source
Spaces must be used to indent lines; tabs are not allowed Open
$csv = new \ParseCsv\Csv();
- Exclude checks
Spaces must 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
private $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
*/
- Exclude checks
Spaces must 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
$csv->encoding($this->request->get('file_encoding'), \App\Config::main('default_charset', 'UTF-8'));
- Exclude checks
Spaces must 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
* Creates a table using one table's values as keys, and the other's as 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
$keyData = $keyData . '(' . ++$dup[$keyData] . ')';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function arrayCombine($keys, $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
* @param array $keys
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($combine[$keyData])) {
- Exclude checks
Spaces must 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\Request $request
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$csv->delimiter = $this->request->get('delimiter');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($keys as $key => $keyData) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$csv->heading = false;
- 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
foreach ($data as $key => $value) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$inventoryData[$key] = $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 ($hasHeader) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$values = array_merge($values, array_fill($noOfFirstRowData, $noOfHeaders - $noOfFirstRowData, ''));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ($noOfHeaders < $noOfFirstRowData) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$inventoryFieldMapping = $this->request->get('inventory_field_mapping');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$inventoryModel = Vtiger_Inventory_Model::getInstance($this->moduleModel->getName());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$allValuesEmpty = true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldValue = $data[$index];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Import_CSVReader_Reader constructor.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function __construct(App\Request $request, App\User $user)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$csv->parseFile($this->getFilePath());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->data = $csv->data;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $values
- 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
} 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
$inventoryMappedData[$i][$fieldName] = $fieldValue;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$csv->use_mb_convert_encoding = true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!isset($dup[$keyData])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool $hasHeader
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$isInventory = $this->moduleModel->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
*
- Exclude checks
Spaces must 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 ($noOfHeaders > $noOfFirstRowData) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$sourceId = $this->request->getInteger('src_record');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$skip = $index;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mappedData = $inventoryMappedData = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\in_array($columnParamsName, $inventoryNames)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($isInventory) && isset($inventoryHeaders[$key])) {
- 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
$fieldMapping = $this->request->get('field_mapping');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mappedData[$fieldName] = $fieldValue;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $combine;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getFirstRowData($hasHeader = true)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$rowData = $headers = $standardData = $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
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($this->data as $i => $data) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldValueTemp = $fieldValue;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($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
* Parsed file 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
{
- Exclude checks
Spaces must 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 ($fieldModel->getCustomColumn() as $columnParamsName => $dataType) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function gets data of the first record to 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
foreach ($this->data as $currentRow => $data) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($data as $key => $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
$allValuesEmpty = 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
parent::__construct($request, $user);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$combine = $dup = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dup[$keyData] = 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($isInventory) && 0 === strpos($value, 'Inventory::')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$standardData[$key] = $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
$noOfFirstRowData = \count($values);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$skip = $importId = $skipData = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($data as $index => $fullName) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mappedData['relation_id'] = $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
$fieldValueTemp = str_replace(',', '.', $fieldValueTemp);
- Exclude checks
Spaces must 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
$rowData = $standardData;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function creates tables for import in database.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function read()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($sourceId && $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
$relationId = $this->request->getInteger('relationId');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$name = substr($fullName, 11);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$inventoryNames[$index] = $name;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($inventoryFieldMapping as $fieldName => $index) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldValue = $data[$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
}
- Exclude checks
Spaces must 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->createTable();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->moduleModel->isInventory()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->moduleModel->isInventory() && 0 === strpos($fullName, 'Inventory::')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$importId = $this->addRecordToDB($mappedData);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$headers[$key] = \App\Purifier::purify($value);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $keys
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $values
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldModel = $inventoryFields[$fieldName];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$combine[$keyData] = $values[$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
$value = substr($value, 11);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$standardData = $this->syncRowData($headers, $standardData);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($inventoryData) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $rowData;
- Exclude checks
Spaces must 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 syncRowData($keys, $values)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('recordIteration' !== $name) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mappedData['src_record'] = $sourceId;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$key = array_search($columnParamsName, $inventoryNames);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$skip || !$importId || ($skip && $skipData !== $data[$skip])) {
- Exclude checks
Spaces must 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 (0 === $currentRow || (1 === $currentRow && $hasHeader)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($hasHeader && 0 === $currentRow) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Adjust first row data to get in sync with the number of headers.
- 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
} 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
$this->addInventoryToDB($inventoryMappedData, $importId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($skip) {
- Exclude checks
Spaces must 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
$rowData['LBL_STANDARD_FIELDS'] = $this->arrayCombine($headers, $standardData);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($fieldMapping as $fieldName => $index) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldValue = $fieldValueTemp;
- Exclude checks
Spaces must 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 ($importId && $inventoryMappedData) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$inventoryHeaders[$key] = \App\Purifier::purify($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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$rowData['LBL_INVENTORY_FIELDS'] = $this->arrayCombine($inventoryHeaders, $inventoryData);
- 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
$noOfHeaders = \count($keys);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$values = \array_slice($values, 0, \count($keys), true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $values;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->request->get('has_header') && 0 === $i) {
- 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
if (is_numeric($fieldValueTemp)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$inventoryMappedData[$i][$columnParamsName] = $data[$key];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$allValuesEmpty) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$skipData = $data[$skip];
- Exclude checks
Class name "Import_CSVReader_Reader" is not in camel caps format Open
class Import_CSVReader_Reader extends Import_FileReader_Reader
- Exclude checks