Method addAdditionalInvData
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function addAdditionalInvData(): array
{
$additionalData = [];
$additionalAmount = $this->data['grand_total'] - $this->data['subtotal_incl_tax'] - $this->data['discount_amount'] - $this->data['shipping_incl_tax'];
if (!empty($additionalAmount)) {
Function addAdditionalInvData
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function addAdditionalInvData(): array
{
$additionalData = [];
$additionalAmount = $this->data['grand_total'] - $this->data['subtotal_incl_tax'] - $this->data['discount_amount'] - $this->data['shipping_incl_tax'];
if (!empty($additionalAmount)) {
- 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 getDataCrm
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getDataCrm(bool $onEdit = false): array
{
$parsedData = parent::getDataCrm($onEdit);
if (!empty($shippingAddress = $this->getAddressDataCrm('shipping'))) {
$parsedData = \array_replace_recursive($parsedData, $shippingAddress);
- 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 getDataCrm has a boolean flag argument $onEdit, which is a certain sign of a Single Responsibility Principle violation. Open
public function getDataCrm(bool $onEdit = false): array
- 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 assigning values to variables in if clauses and the like (line '187', column '14'). Open
public function getDataCrm(bool $onEdit = false): array
{
$parsedData = parent::getDataCrm($onEdit);
if (!empty($shippingAddress = $this->getAddressDataCrm('shipping'))) {
$parsedData = \array_replace_recursive($parsedData, $shippingAddress);
- 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
The method getAddressDataByType uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$data = $this->data['billing_address'] ?? [];
}
- 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 assigning values to variables in if clauses and the like (line '190', column '14'). Open
public function getDataCrm(bool $onEdit = false): array
{
$parsedData = parent::getDataCrm($onEdit);
if (!empty($shippingAddress = $this->getAddressDataCrm('shipping'))) {
$parsedData = \array_replace_recursive($parsedData, $shippingAddress);
- 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 '\Vtiger_Inventory_Model' in method 'addAdditionalInvData'. Open
$taxes = \Vtiger_Inventory_Model::getGlobalTaxes();
- 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 'addAdditionalInvData'. Open
$recordModel = \Vtiger_Record_Model::getInstanceById($serviceId, 'Services');
- 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 "state" 8 times. Open
'ssingleorders_status' => 'state',
- 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 "PLL_ON_HOLD" 3 times. Open
'holded' => 'PLL_ON_HOLD',
- 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_status" 4 times. Open
'ssingleorders_status' => 'state',
- 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 "mapAndAddNew" 3 times. Open
'payment_methods' => 'mapAndAddNew',
- 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 "PLL_PAYMENT_REVIEW" 3 times. Open
'payment_review' => 'PLL_PAYMENT_REVIEW',
- 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 "price" 3 times. Open
'price' => 'price',
- 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 "complete" 4 times. Open
'complete' => '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 "canceled" 4 times. Open
'canceled' => 'PLL_CANCELLED',
- 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 "shipping" 3 times. Open
if (!empty($shippingAddress = $this->getAddressDataCrm('shipping'))) {
- 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 "PLL_CLOSED" 3 times. Open
'closed' => 'PLL_CLOSED',
- 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 "payment_review" 4 times. Open
'payment_review' => 'PLL_PAYMENT_REVIEW',
- 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 "PLL_COMPLETE" 3 times. Open
'complete' => '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 "PLL_PROCESSING" 3 times. Open
'processing' => 'PLL_PROCESSING',
- 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 "PLL_CANCELLED" 3 times. Open
'canceled' => 'PLL_CANCELLED',
- 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 "processing" 4 times. Open
'processing' => 'PLL_PROCESSING',
- 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 "holded" 4 times. Open
'holded' => 'PLL_ON_HOLD',
- 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" 8 times. Open
'status_magento' => 'status',
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "closed" 4 times. Open
'closed' => 'PLL_CLOSED',
- 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.
Identical blocks of code found in 2 locations. Consider refactoring. Open
public function getDataCrm(bool $onEdit = false): array
{
$parsedData = parent::getDataCrm($onEdit);
if (!empty($shippingAddress = $this->getAddressDataCrm('shipping'))) {
$parsedData = \array_replace_recursive($parsedData, $shippingAddress);
- 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 224.
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
The property $ssingleorders_status is not named in camelCase. Open
class Order extends Inventory
{
/** {@inheritdoc} */
protected $moduleName = 'SSingleOrders';
/** {@inheritdoc} */
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $payment_methods is not named in camelCase. Open
class Order extends Inventory
{
/** {@inheritdoc} */
protected $moduleName = 'SSingleOrders';
/** {@inheritdoc} */
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $status_magento is not named in camelCase. Open
class Order extends Inventory
{
/** {@inheritdoc} */
protected $moduleName = 'SSingleOrders';
/** {@inheritdoc} */
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
Line exceeds 120 characters; contains 182 characters Open
* The file is part of the paid functionality. Using the file is allowed only after purchasing a subscription. File modification allowed only with the consent of the system producer.
- Exclude checks
Spaces must 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 $mappedFields = [
- Exclude checks
Spaces must 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
'payment_review' => 'PLL_PAYMENT_REVIEW',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'pending_payment' => 'PLL_PENDING_PAYMENT',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'paypal_canceled_reversal' => 'PLL_PAYPAL_CANCELED_REVERSAL',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $payment_methods = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$serviceId = $this->synchronizer->config->get('payment_cash_service_id');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'currency' => $this->dataCrm['currency_id'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'qty' => 1,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getAddressDataByType(string $addressType)
- Exclude checks
Spaces must 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 $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
* @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
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'subject' => 'increment_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
'name' => 'product_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
* @var string[]
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'complete' => 'PLL_COMPLETE',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'redsys' => 'PLL_REDSYS',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'cashondelivery' => 'PLL_CASH_ON_DELIVERY',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'taxmode' => 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
'sale_date' => 'created_at',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $fieldsType = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* status_magento field map.
- Exclude checks
Spaces must 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 ('paypal_express' === $this->data['payment']['method']) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$additionalAmount = round($additionalAmount * 100 / (100 + $tax), 4);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'subunit' => '',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'purchase' => 0,
- 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
return [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $moduleName = 'SSingleOrders';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'sale_date' => 'date',
- Exclude checks
Spaces must 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
'PLL_CANCELLED' => ['state' => 'canceled', 'status' => 'canceled'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- 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
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$taxes = \Vtiger_Inventory_Model::getGlobalTaxes();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'name' => $serviceId,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'unit' => '',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($parsedData['phone_a'])) {
- Exclude checks
Spaces must 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
'ssingleorders_source' => 'PLL_MAGENTO',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'ssingleorders_status' => 'state',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'attention' => 'customer_note',
- 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
'pending' => 'PLL_PENDING',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'pending_paypal' => 'PLL_PENDING_PAYPAL',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'paid' => 'PLL_PAID',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Payment method value map.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'paypal_express' => 'PLL_PAYPAL_EXPRESS',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$additionalAmount = $this->data['grand_total'] - $this->data['subtotal_incl_tax'] - $this->data['discount_amount'] - $this->data['shipping_incl_tax'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'comment1' => '',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'sum_total' => '',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getDataCrm(bool $onEdit = false): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$parsedData = parent::getDataCrm($onEdit);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'leadsource' => 'Magento',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($parsedData['phone'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'new' => 'PLL_NEW',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'paypal_reversed' => 'PLL_PAYPAL_REVERSED',
- Exclude checks
Line exceeds 120 characters; contains 158 characters Open
$additionalAmount = $this->data['grand_total'] - $this->data['subtotal_incl_tax'] - $this->data['discount_amount'] - $this->data['shipping_incl_tax'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'taxparam' => '{"aggregationType":"individual","individualTax":' . $tax . '}',
- Exclude checks
Spaces must 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($parsedData['phone_b'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->dataCrm = $parsedData;
- Exclude checks
Spaces must 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 $additionalFieldsCrm = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'parent_id' => 'relation_parent_id',
- 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
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'PLL_PAYMENT_REVIEW' => ['state' => 'payment_review', 'status' => 'payment_review'],
- Exclude checks
Spaces must 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
$additionalData = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tax = 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$additionalData = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($billingAddress = $this->getAddressDataCrm('billing'))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($parsedData['mobile'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- 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
$data = $this->data['extension_attributes']['shipping_assignments'][0]['shipping']['address'] ?? [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'parent_id' => 'parentRecord',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $status_magento = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'fraud' => 'PLL_FRAUD',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'closed' => 'PLL_CLOSED',
- 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
if ('shipping' === $addressType) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'increment_id' => $this->dataCrm['subject'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'sum_gross' => '',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'birthday' => 'customer_dob',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'ssingleorders_status' => 'mapAndAddNew',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Magento state mapping to CRM statuses.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'holded' => 'PLL_ON_HOLD',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'send' => 'PLL_SEND',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'complete' => 'PLL_COMPLETE',
- 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
'PLL_ON_HOLD' => ['state' => 'holded', 'status' => 'holded'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Parse additional inventory data.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ('cashondelivery' === $this->data['payment']['method']) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tax = $taxes[$recordModel->get('taxes')]['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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'entity' => array_merge([
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'date_start' => 'created_at',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'date_start' => 'date',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $ssingleorders_status = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'canceled' => 'PLL_CANCELLED',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'holded' => 'PLL_ON_HOLD',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Mapping statuses from the CRM to Magento.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'PLL_NEW' => ['state' => 'new', 'status' => 'pending'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'price' => $additionalAmount,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$parsedData = \array_replace_recursive($parsedData, $shippingAddress);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$parsedData = $this->parsePhone('phone_b', $parsedData);
- Exclude checks
Spaces must 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 getUpdateData(): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::$statusForMagento[$this->dataCrm['ssingleorders_status']]
- 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
public static $mappedFieldsInv = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'addresslevel1a' => 'country',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'status_magento' => 'mapAndAddNew',
- Exclude checks
Spaces must 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
'processing' => 'PLL_PROCESSING',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'PLL_PROCESSING' => ['state' => 'processing', 'status' => 'processing'],
- Exclude checks
Spaces must 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
'discountmode' => 1,
- Exclude checks
Line exceeds 120 characters; contains 131 characters Open
'discountparam' => '{"aggregationType":"individual","individualDiscountType":"amount","individualDiscount":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
{
- 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
'price' => 'price',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'closed' => 'PLL_CLOSED',
- Exclude checks
Spaces must 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
'banktransfer' => 'PLL_TRANSFER',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($serviceId)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$parsedData = $this->parsePhone('phone_a', $parsedData);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'entity_id' => $this->dataCrm['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
'sum_tax' => '',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'sum_net' => '',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'firstname' => 'customer_firstname',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'qty' => 'qty_ordered',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'discount' => 'discount_amount',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'addresslevel1b' => 'country',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'payment_methods' => 'mapAndAddNew',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'payment_review' => 'PLL_PAYMENT_REVIEW',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$serviceId = $this->synchronizer->config->get('payment_paypal_service_id');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($taxes[$recordModel->get('taxes')])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'discountparam' => '{"aggregationType":"individual","individualDiscountType":"amount","individualDiscount":0}',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$parsedData = $this->parsePhone('phone', $parsedData);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Data update in magento.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'sum_discount' => '',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'payment_status' => '',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Inventory fields.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'canceled' => 'PLL_CANCELLED',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* It is used when updating data in Magento.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $statusForMagento = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'PLL_CLOSED' => ['state' => 'closed', 'status' => 'closed'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($additionalAmount)) {
- 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 = $this->data['billing_address'] ?? [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty(self::$statusForMagento[$this->dataCrm['ssingleorders_status']])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'email' => 'customer_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
'processing' => 'PLL_PROCESSING',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'PLL_COMPLETE' => ['state' => 'complete', 'status' => 'complete'],
- Exclude checks
Spaces must 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 addAdditionalInvData(): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel = \Vtiger_Record_Model::getInstanceById($serviceId, 'Services');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $additionalData;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$parsedData = \array_replace_recursive($parsedData, $billingAddress);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'payment_methods' => 'payment|method',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'status_magento' => 'status',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'salutationtype' => 'customer_gender',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'lastname' => 'customer_lastname',
- 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
if (!empty($shippingAddress = $this->getAddressDataCrm('shipping'))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$parsedData = $this->parsePhone('mobile', $parsedData);
- Exclude checks
Multi-line function call not indented correctly; expected 16 spaces but found 12 Open
],
- Exclude checks
Opening parenthesis of a multi-line function call must be the last content on the line Open
'entity' => array_merge([
- Exclude checks