Function search
has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring. Open
public function search(): array
{
if (!$this->isActive()) {
return [];
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method search
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function search(): array
{
if (!$this->isActive()) {
return [];
}
The method search() has an NPath complexity of 1382. The configured NPath complexity threshold is 200. Open
public function search(): array
{
if (!$this->isActive()) {
return [];
}
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method search() has a Cyclomatic Complexity of 21. The configured cyclomatic complexity threshold is 10. Open
public function search(): array
{
if (!$this->isActive()) {
return [];
}
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
Avoid using static access to class '\App\RecordCollectors\Helper\GusClient' in method 'search'. Open
$client = \App\RecordCollectors\Helper\GusClient::getInstance($this->getClientParams($moduleName));
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid assigning values to variables in if clauses and the like (line '184', column '8'). Open
public function search(): array
{
if (!$this->isActive()) {
return [];
}
- 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\Language' in method 'search'. Open
$skip[$fieldName]['label'] = \App\Language::translate($fieldsModel[$fieldName]->getFieldLabel(), $moduleName);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Language' in method 'search'. Open
$fieldsData[$fieldName]['label'] = \App\Language::translate($fieldModel->getFieldLabel(), $moduleName);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method search uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$fieldsModel = \Vtiger_Module_Model::getInstance($moduleName)->getFields();
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\Vtiger_Record_Model' in method 'search'. Open
$recordModel = \Vtiger_Record_Model::getInstanceById($recordId, $moduleName);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method search uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$skip[$fieldName]['label'] = $fieldName;
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\App\Log' in method 'search'. Open
\App\Log::warning($e->faultstring, 'RecordCollectors');
- 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
syntax error, unexpected 'string' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST)
Open
protected string $addOnName = 'YetiForcePlGus';
- Exclude checks
Similar blocks of code found in 5 locations. Consider refactoring. Open
'Accounts' => [
'Nazwa' => 'accountname',
'Regon' => 'registration_number_2',
'Krs' => 'registration_number_1',
'Nip' => 'vat_id',
- 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 91.
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 5 locations. Consider refactoring. Open
'Leads' => [
'Nazwa' => 'company',
'Nip' => 'vat_id',
'Regon' => 'registration_number_2',
'NumerBudynku' => 'buildingnumbera',
- 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 91.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Avoid excessively long variable names like $formFieldsToRecordMap. Keep variable name length under 20. Open
public $formFieldsToRecordMap = [
'Accounts' => [
'Nazwa' => 'accountname',
'Regon' => 'registration_number_2',
'Krs' => 'registration_number_1',
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Spaces must be used to indent lines; tabs are not allowed Open
public $description = 'LBL_PL_GUS_DESC';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Regon' => 'registration_number_2',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Wojewodztwo' => 'addresslevel2a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Ulica' => 'addresslevel8a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'KodPocztowy' => 'addresslevel7a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'KodPocztowy' => 'addresslevel7a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Miejscowosc' => 'addresslevel5a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'vatId' => [
- Exclude checks
Spaces must 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
'vatId' => 'vat_id',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Competition' => [
- 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 $icon = 'yfi-gus-regon-pl';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'NumerBudynku' => 'buildingnumbera',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Wojewodztwo' => 'addresslevel2a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Kraj' => 'addresslevel1a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'NumerBudynku' => 'buildingnumbera',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'label' => 'Registration number 1',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Regon' => 'registration_number_2',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Miejscowosc' => 'addresslevel5a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'NumerBudynku' => 'buildingnumbera',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'vatId' => 'vat_id',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'NumerBudynku' => 'buildingnumbera',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'AdresEmail' => 'email1',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Gmina' => 'addresslevel4a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Powiat' => 'addresslevel3a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'NumerFaksu' => 'fax',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Competition' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'NumerLokalu' => 'localnumbera',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Leads' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$ncr = str_replace([' ', ',', '.', '-'], '', $this->request->getByType('ncr', 'Text'));
- Exclude checks
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
public $allowedModules = ['Accounts', 'Leads', 'Vendors', 'Competition', 'Partners'];
- 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
'KodPocztowy' => 'addresslevel7a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'NumerLokalu' => 'localnumbera',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$this->isActive()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$taxNumber = str_replace([' ', ',', '.', '-'], '', $this->request->getByType('taxNumber', 'Text'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Powiat' => 'addresslevel3a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Nip' => 'vat_id',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Partners' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Ulica' => 'addresslevel8a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Regon' => 'registration_number_2',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Wojewodztwo' => 'addresslevel2a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'labelModule' => '_Base',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'ncr' => 'registration_number_1',
- 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 $docUrl = 'https://api.stat.gov.pl/Home/RegonApi';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Accounts' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'NumerBudynku' => 'buildingnumbera',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Nazwa' => 'vendorname',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $fields = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'labelModule' => '_Base',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'labelModule' => '_Base',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'label' => 'Registration number 2',
- 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
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'vatId' => 'vat_id',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'NumerLokalu' => 'localnumbera',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Leads' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Nazwa' => 'company',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'AdresEmail' => 'email',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Powiat' => 'addresslevel3a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Powiat' => 'addresslevel3a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Accounts' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'vatId' => 'vat_id',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'taxNumber' => 'registration_number_2',
- 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
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Miejscowosc' => 'addresslevel5a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'NumerBudynku' => 'buildingnumbera',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'AdresStronyInternetowej' => 'website',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Nazwa' => 'subject',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Nip' => 'vat_id',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Wojewodztwo' => 'addresslevel2a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'taxNumber' => 'registration_number_2',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'ncr' => 'registration_number_1',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Vendors' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'taxNumber' => 'registration_number_2',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function search(): 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
'Krs' => 'registration_number_1',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Gmina' => 'addresslevel4a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'NumerLokalu' => 'localnumbera',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Gmina' => 'addresslevel4a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Nazwa' => 'subject',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Miejscowosc' => 'addresslevel5a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'ncr' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'ncr' => 'registration_number_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
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Kraj' => 'addresslevel1a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Nip' => 'vat_id',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Powiat' => 'addresslevel3a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'vatId' => 'vat_id',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $formFieldsToRecordMap = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'NumerFaksu' => 'fax',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Gmina' => 'addresslevel4a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'taxNumber' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'taxNumber' => 'registration_number_2',
- 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
'NumerTelefonu' => 'phone',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Vendors' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Miejscowosc' => 'addresslevel5a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'KodPocztowy' => 'addresslevel7a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Kraj' => 'addresslevel1a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'label' => 'Vat ID',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$vatId = preg_replace('/[^0-9]/', '', $this->request->getByType('vatId', 'Text'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($recordId = $this->request->getInteger('record')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$additional = $fieldsData = $skip = $dataCounter = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataCounter[$key] = 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($fieldsModel[$fieldName]) || !$fieldsModel[$fieldName]->isActiveField()) {
- Exclude checks
Spaces must 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 $params;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $displayType = 'FillFields';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Nip' => 'vat_id',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Kraj' => 'addresslevel1a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'NumerTelefonu' => 'phone',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Wojewodztwo' => 'addresslevel2a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'NumerLokalu' => 'localnumbera',
- Exclude checks
Spaces must 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
$moduleName = $this->request->getModule();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($infoFromGus as $key => &$row) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($row[$apiKey]) && '' !== $row[$apiKey]) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($value) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$response['additional'] = $additional;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$response['dataCounter'] = $dataCounter;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get params.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $label = 'LBL_PL_GUS';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Nazwa' => 'accountname',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Ulica' => 'addresslevel8a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'AdresStronyInternetowej' => 'website',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Nip' => 'vat_id',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Kraj' => 'addresslevel1a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'ncr' => 'registration_number_1',
- 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
if (isset($fieldsModel[$fieldName]) && empty($skip[$fieldName]['label'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$params = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Ulica' => 'addresslevel8a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'KodPocztowy' => 'addresslevel7a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Ulica' => 'addresslevel8a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Gmina' => 'addresslevel4a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected string $addOnName = 'YetiForcePlGus';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $modulesFieldsMap = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Partners' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($row[$apiKey])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('phone' === $fieldModel->getFieldDataType()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$response['fields'] = $fieldsData;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$response['keys'] = array_keys($infoFromGus);
- Exclude checks
Spaces must 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
$skip[$fieldName]['data'][$key] = $row[$apiKey];
- Exclude checks
Line exceeds 120 characters; contains 146 characters Open
$skip[$fieldName]['label'] = \App\Language::translate($fieldsModel[$fieldName]->getFieldLabel(), $moduleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldsData[$fieldName]['data'][$key] = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$details = $fieldModel->getUITypeModel()->getPhoneDetails($value, 'PL');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldModel = $fieldsModel[$fieldName];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($row as $name => $value) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$response['error'] = $e->faultstring;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
unset($row[$apiKey]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldModel = $fieldsModel[$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
$additional[$name][$key] = $value;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$response = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($this->formFieldsToRecordMap[$moduleName] as $apiKey => $fieldName) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$skip[$fieldName]['label'] = $fieldName;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} catch (\SoapFault $e) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$infoFromGus = $client->search($vatId, $ncr, $taxNumber);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel = \Vtiger_Record_Model::getInstanceById($recordId, $moduleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($row)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$skip[$fieldName]['label'] = \App\Language::translate($fieldsModel[$fieldName]->getFieldLabel(), $moduleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldsData[$fieldName]['label'] = \App\Language::translate($fieldModel->getFieldLabel(), $moduleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $moduleName
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$params[] = 'pkd';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldsModel = $recordModel->getModule()->getFields();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
continue;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldName = $details['fieldName'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = $details['number'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($fieldName !== $details['fieldName']) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'edit' => $fieldModel->getEditViewDisplayValue($value),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$response['skip'] = $skip;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::warning($e->faultstring, 'RecordCollectors');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = trim($row[$apiKey]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
++$dataCounter[$key];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($this->formFieldsToRecordMap[$moduleName]['PKDPodstawowyKod']) || isset($this->formFieldsToRecordMap[$moduleName]['PKDPozostaleNazwy']) || isset($this->formFieldsToRecordMap[$moduleName]['PKDPozostaleKodyNazwy'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$client = \App\RecordCollectors\Helper\GusClient::getInstance($this->getClientParams($moduleName));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldsModel = \Vtiger_Module_Model::getInstance($moduleName)->getFields();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
unset($row[$apiKey]);
- Exclude checks
Line exceeds 120 characters; contains 127 characters Open
$fieldsData[$fieldName]['label'] = \App\Language::translate($fieldModel->getFieldLabel(), $moduleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'display' => $fieldModel->getDisplayValue($value),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('' !== $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
* @return string[]
- Exclude checks
Line exceeds 120 characters; contains 233 characters Open
if (isset($this->formFieldsToRecordMap[$moduleName]['PKDPodstawowyKod']) || isset($this->formFieldsToRecordMap[$moduleName]['PKDPozostaleNazwy']) || isset($this->formFieldsToRecordMap[$moduleName]['PKDPozostaleKodyNazwy'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
try {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$response['recordModel'] = $recordModel;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'raw' => $value,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $response;
- Exclude checks
Spaces must 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 ($infoFromGus && isset($this->formFieldsToRecordMap[$moduleName])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
continue;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must 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 getClientParams(string $moduleName): array
- Exclude checks