Method process
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function process(App\Request $request)
{
$sSingleOrderTabId = \App\Module::getModuleId('SSingleOrders');
$fInvoiceTabId = \App\Module::getModuleId('FInvoice');
$productCategoryId = \App\Module::getModuleId('ProductCategory');
Function process
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function process(App\Request $request)
{
$sSingleOrderTabId = \App\Module::getModuleId('SSingleOrders');
$fInvoiceTabId = \App\Module::getModuleId('FInvoice');
$productCategoryId = \App\Module::getModuleId('ProductCategory');
- 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
Missing class import via use statement (line '50', column '24'). Open
$fieldsExists = (new \App\Db\Query())->select(['fieldname'])->from('vtiger_field')->where(['tabid' => $sSingleOrderTabId, 'fieldname' => array_keys($fields)])->column();
- 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 '60', column '24'). Open
$fieldsExists = (new \App\Db\Query())->select(['fieldname'])->from('vtiger_field')->where(['tabid' => $fInvoiceTabId, 'fieldname' => array_keys($fields)])->column();
- 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 '69', column '24'). Open
$fieldsExists = (new \App\Db\Query())->select(['fieldname'])->from('vtiger_field')->where(['tabid' => $productCategoryId, 'fieldname' => array_keys($fields)])->column();
- 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 '24', column '23'). Open
$importerType = new \App\Db\Importers\Base();
- 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 '94', column '25'). Open
$fieldInstance = new Vtiger_Field_Model();
- 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 'vtlib\Block' in method 'process'. Open
$blocks = vtlib\Block::getAllForModule(vtlib\Module::getInstance('FInvoice'));
- 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 assigning values to variables in if clauses and the like (line '61', column '7'). Open
public function process(App\Request $request)
{
$sSingleOrderTabId = \App\Module::getModuleId('SSingleOrders');
$fInvoiceTabId = \App\Module::getModuleId('FInvoice');
$productCategoryId = \App\Module::getModuleId('ProductCategory');
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Avoid using static access to class 'vtlib\Block' in method 'process'. Open
$blockModel = vtlib\Block::getInstance('LBL_BASIC_INFORMATION', 'ProductCategory');
- 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 'process'. Open
$blocks = vtlib\Block::getAllForModule(vtlib\Module::getInstance('SSingleOrders'));
- 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 assigning values to variables in if clauses and the like (line '70', column '7'). Open
public function process(App\Request $request)
{
$sSingleOrderTabId = \App\Module::getModuleId('SSingleOrders');
$fInvoiceTabId = \App\Module::getModuleId('FInvoice');
$productCategoryId = \App\Module::getModuleId('ProductCategory');
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Avoid using static access to class 'vtlib\Block' in method 'process'. Open
$blockModel = vtlib\Block::getInstance('LBL_CUSTOM_INFORMATION', 'FInvoice');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Module' in method 'process'. Open
$sSingleOrderTabId = \App\Module::getModuleId('SSingleOrders');
- 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\Cron' in method 'process'. Open
\App\Cron::updateStatus(\App\Cron::STATUS_ENABLED, 'LBL_MAGENTO');
- 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 'process'. Open
$blocks = vtlib\Block::getAllForModule(vtlib\Module::getInstance('FInvoice'));
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Module' in method 'process'. Open
$fInvoiceTabId = \App\Module::getModuleId('FInvoice');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'vtlib\Block' in method 'process'. Open
$blocks = vtlib\Block::getAllForModule(vtlib\Module::getInstance('ProductCategory'));
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'vtlib\Block' in method 'process'. Open
$blockModel = vtlib\Block::getInstance('LBL_CUSTOM_INFORMATION', 'SSingleOrders');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'vtlib\Block' in method 'process'. Open
$blocks = vtlib\Block::getAllForModule(vtlib\Module::getInstance('SSingleOrders'));
- 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 assigning values to variables in if clauses and the like (line '51', column '7'). Open
public function process(App\Request $request)
{
$sSingleOrderTabId = \App\Module::getModuleId('SSingleOrders');
$fInvoiceTabId = \App\Module::getModuleId('FInvoice');
$productCategoryId = \App\Module::getModuleId('ProductCategory');
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Avoid using static access to class '\App\Module' in method 'process'. Open
$productCategoryId = \App\Module::getModuleId('ProductCategory');
- 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\EventHandler' in method 'process'. Open
\App\EventHandler::setActive('IStorages_RecalculateStockHandler_Handler', 'IStoragesAfterUpdateStock');
- 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 'process'. Open
$blocks = vtlib\Block::getAllForModule(vtlib\Module::getInstance('ProductCategory'));
- 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 "fieldname" 6 times. Open
$fieldsExists = (new \App\Db\Query())->select(['fieldname'])->from('vtiger_field')->where(['tabid' => $sSingleOrderTabId, 'fieldname' => array_keys($fields)])->column();
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "tabid" 3 times. Open
$fieldsExists = (new \App\Db\Query())->select(['fieldname'])->from('vtiger_field')->where(['tabid' => $sSingleOrderTabId, 'fieldname' => array_keys($fields)])->column();
- 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 "maximumlength" 5 times. Open
'maximumlength' => '4294967295',
- 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 "uitype" 5 times. Open
'uitype' => 325,
- 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 "vtiger_field" 3 times. Open
$fieldsExists = (new \App\Db\Query())->select(['fieldname'])->from('vtiger_field')->where(['tabid' => $sSingleOrderTabId, 'fieldname' => array_keys($fields)])->column();
- 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 "label" 5 times. Open
'label' => 'FL_MAGENTO_SERVER',
- 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 "SSingleOrders" 3 times. Open
$sSingleOrderTabId = \App\Module::getModuleId('SSingleOrders');
- 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 "columntype" 5 times. Open
'columntype' => $importerType->integer(10)->defaultValue(0)->notNull()->unsigned(),
- 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 "picklistValues" 3 times. Open
'picklistValues' => ['PLL_PENDING', 'PLL_PENDING_PAYMENT', 'PLL_PENDING_PAYPAL', 'PLL_PAID', 'PLL_PROCESSING', 'PLL_ON_HOLD', 'PLL_SEND', 'PLL_FRAUD', 'PLL_PAYMENT_REVIEW', 'PLL_PAYPAL_CANCELED_REVERSAL', 'PLL_PAYPAL_REVERSED', 'PLL_CANCELLED', 'PLL_CLOSED', 'PLL_COMPLETE']
- 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 "ProductCategory" 3 times. Open
$productCategoryId = \App\Module::getModuleId('ProductCategory');
- 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 "typeofdata" 5 times. Open
'typeofdata' => 'I~O'
- 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 "FInvoice" 3 times. Open
$fInvoiceTabId = \App\Module::getModuleId('FInvoice');
- 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 "displaytype" 5 times. Open
'displaytype' => 2,
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Call to method defaultValue
from undeclared class \yii\db\ColumnSchemaBuilder
(Did you mean class \App\Db\Drivers\Mysql\ColumnSchemaBuilder or class \App\Db\Drivers\Pgsql\ColumnSchemaBuilder) Open
'columntype' => $importerType->integer(10)->defaultValue(0)->notNull()->unsigned(),
- Exclude checks
Call to method defaultValue
from undeclared class \yii\db\ColumnSchemaBuilder
(Did you mean class \App\Db\Drivers\Mysql\ColumnSchemaBuilder or class \App\Db\Drivers\Pgsql\ColumnSchemaBuilder) Open
'columntype' => $importerType->integer(10)->defaultValue(0)->notNull()->unsigned(),
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$fieldsExists = (new \App\Db\Query())->select(['fieldname'])->from('vtiger_field')->where(['tabid' => $productCategoryId, 'fieldname' => array_keys($fields)])->column();
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$fieldsExists = (new \App\Db\Query())->select(['fieldname'])->from('vtiger_field')->where(['tabid' => $sSingleOrderTabId, 'fieldname' => array_keys($fields)])->column();
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$fieldsExists = (new \App\Db\Query())->select(['fieldname'])->from('vtiger_field')->where(['tabid' => $fInvoiceTabId, 'fieldname' => array_keys($fields)])->column();
- Exclude checks
Call to method defaultValue
from undeclared class \yii\db\ColumnSchemaBuilder
(Did you mean class \App\Db\Drivers\Mysql\ColumnSchemaBuilder or class \App\Db\Drivers\Pgsql\ColumnSchemaBuilder) Open
'columntype' => $importerType->stringType(255)->defaultValue(''),
- Exclude checks
Similar blocks of code found in 3 locations. Consider refactoring. Open
if ($fieldsToAdd = array_diff_key($fields, array_flip($fieldsExists))) {
$blockModel = vtlib\Block::getInstance('LBL_CUSTOM_INFORMATION', 'FInvoice');
if (!$blockModel) {
$blocks = vtlib\Block::getAllForModule(vtlib\Module::getInstance('FInvoice'));
$blockModel = current($blocks);
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 97.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
if ($fieldsToAdd = array_diff_key($fields, array_flip($fieldsExists))) {
$blockModel = vtlib\Block::getInstance('LBL_CUSTOM_INFORMATION', 'SSingleOrders');
if (!$blockModel) {
$blocks = vtlib\Block::getAllForModule(vtlib\Module::getInstance('SSingleOrders'));
$blockModel = current($blocks);
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 97.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
if ($fieldsToAdd = array_diff_key($fields, array_flip($fieldsExists))) {
$blockModel = vtlib\Block::getInstance('LBL_BASIC_INFORMATION', 'ProductCategory');
if (!$blockModel) {
$blocks = vtlib\Block::getAllForModule(vtlib\Module::getInstance('ProductCategory'));
$blockModel = current($blocks);
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 97.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class Settings_Magento_Active_Action extends Settings_Vtiger_Save_Action
- Exclude checks
The class Settings_Magento_Active_Action is not named in CamelCase. Open
class Settings_Magento_Active_Action extends Settings_Vtiger_Save_Action
{
/** {@inheritdoc} */
public function process(App\Request $request)
{
- 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
public function process(App\Request $request)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$importerType = new \App\Db\Importers\Base();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'typeofdata' => 'I~O'
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'typeofdata' => 'I~O'
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'displaytype' => 2,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($fieldsToAdd = array_diff_key($fields, array_flip($fieldsExists))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'magento_server_id' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
], 'magento_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
unset($fields['status_magento']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'maximumlength' => '4294967295',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$blockModel) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fInvoiceTabId = \App\Module::getModuleId('FInvoice');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$blockModel = vtlib\Block::getInstance('LBL_CUSTOM_INFORMATION', 'SSingleOrders');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($fieldsToAdd = array_diff_key($fields, array_flip($fieldsExists))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fields = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'columntype' => $importerType->integer(10)->defaultValue(0)->notNull()->unsigned(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'columntype' => $importerType->integer(10)->defaultValue(0)->notNull()->unsigned(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$blockModel) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$blocks = vtlib\Block::getAllForModule(vtlib\Module::getInstance('SSingleOrders'));
- Exclude checks
Line exceeds 120 characters; contains 173 characters Open
$fieldsExists = (new \App\Db\Query())->select(['fieldname'])->from('vtiger_field')->where(['tabid' => $fInvoiceTabId, 'fieldname' => array_keys($fields)])->column();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'typeofdata' => 'V~O',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$blockModel = vtlib\Block::getInstance('LBL_CUSTOM_INFORMATION', 'FInvoice');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'picklistValues' => ['PLL_PENDING', 'PLL_PENDING_PAYMENT', 'PLL_PENDING_PAYPAL', 'PLL_PAID', 'PLL_PROCESSING', 'PLL_ON_HOLD', 'PLL_SEND', 'PLL_FRAUD', 'PLL_PAYMENT_REVIEW', 'PLL_PAYPAL_CANCELED_REVERSAL', 'PLL_PAYPAL_REVERSED', 'PLL_CANCELLED', 'PLL_CLOSED', 'PLL_COMPLETE']
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$blockModel = current($blocks);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'uitype' => 325,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'label' => 'FL_MAGENTO_STATUS',
- Exclude checks
Line exceeds 120 characters; contains 291 characters Open
'picklistValues' => ['PLL_PENDING', 'PLL_PENDING_PAYMENT', 'PLL_PENDING_PAYPAL', 'PLL_PAID', 'PLL_PROCESSING', 'PLL_ON_HOLD', 'PLL_SEND', 'PLL_FRAUD', 'PLL_PAYMENT_REVIEW', 'PLL_PAYPAL_CANCELED_REVERSAL', 'PLL_PAYPAL_REVERSED', 'PLL_CANCELLED', 'PLL_CLOSED', 'PLL_COMPLETE']
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->addFields($fieldsToAdd, $blockModel);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$blockModel = vtlib\Block::getInstance('LBL_BASIC_INFORMATION', 'ProductCategory');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldInstance = new Vtiger_Field_Model();
- 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
'displaytype' => 2,
- Exclude checks
Line exceeds 120 characters; contains 177 characters Open
$fieldsExists = (new \App\Db\Query())->select(['fieldname'])->from('vtiger_field')->where(['tabid' => $sSingleOrderTabId, 'fieldname' => array_keys($fields)])->column();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldsExists = (new \App\Db\Query())->select(['fieldname'])->from('vtiger_field')->where(['tabid' => $fInvoiceTabId, 'fieldname' => array_keys($fields)])->column();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$blockModel) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'label' => 'FL_MAGENTO_SERVER',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'uitype' => 16,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'maximumlength' => '4294967295',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldsExists = (new \App\Db\Query())->select(['fieldname'])->from('vtiger_field')->where(['tabid' => $sSingleOrderTabId, 'fieldname' => array_keys($fields)])->column();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$blockModel = current($blocks);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$blocks = vtlib\Block::getAllForModule(vtlib\Module::getInstance('FInvoice'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldsExists = (new \App\Db\Query())->select(['fieldname'])->from('vtiger_field')->where(['tabid' => $productCategoryId, 'fieldname' => array_keys($fields)])->column();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldInstance->set('name', $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 addFields(array $fieldsToAdd, vtlib\Block $blockModel): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldInstance->set('maximumlength', $fieldData['maximumlength']);
- Exclude checks
Spaces must 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 177 characters Open
$fieldsExists = (new \App\Db\Query())->select(['fieldname'])->from('vtiger_field')->where(['tabid' => $productCategoryId, 'fieldname' => array_keys($fields)])->column();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$blocks = vtlib\Block::getAllForModule(vtlib\Module::getInstance('ProductCategory'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->addFields($fieldsToAdd, $blockModel);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
header('Location: index.php?parent=Settings&module=Magento&view=List');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $fieldsToAdd
- Exclude checks
Spaces must 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 ($fieldsToAdd as $fieldName => $fieldData) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$sSingleOrderTabId = \App\Module::getModuleId('SSingleOrders');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'columntype' => $importerType->stringType(255)->defaultValue(''),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$blockModel = current($blocks);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldInstance->set('uitype', $fieldData['uitype']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
], 'status_magento' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'maximumlength' => '255',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($fieldsToAdd = array_diff_key($fields, array_flip($fieldsExists))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->addFields($fieldsToAdd, $blockModel);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldInstance->set('table', $blockModel->module->basetable);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldInstance->set('displaytype', $fieldData['displaytype']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$productCategoryId = \App\Module::getModuleId('ProductCategory');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'displaytype' => 2,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'label' => 'FL_MAGENTO_ID',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'uitype' => 7,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
]
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldInstance->save($blockModel);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldInstance->setNoRolePicklistValues($fieldData['picklistValues']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Add fields.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param vtlib\Block $blockModel
- Exclude checks
Spaces must 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\EventHandler::setActive('IStorages_RecalculateStockHandler_Handler', 'IStoragesAfterUpdateStock');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldInstance->set('columntype', $fieldData['columntype']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldInstance->set('label', $fieldData['label']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Cron::updateStatus(\App\Cron::STATUS_ENABLED, 'LBL_MAGENTO');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldInstance->set('column', $fieldName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($fieldData['picklistValues'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldInstance->set('typeofdata', $fieldData['typeofdata']);
- Exclude checks
Class name "Settings_Magento_Active_Action" is not in camel caps format Open
class Settings_Magento_Active_Action extends Settings_Vtiger_Save_Action
- Exclude checks