YetiForceCompany/YetiForceCRM

View on GitHub
app/RecordCollectors/ChZefix.php

Summary

Maintainability
A
1 hr
Test Coverage
F
0%

Function search has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function search(): array
    {
        $companyId = str_replace([' ', ',', '.', '-'], '', $this->request->getByType('companyId', 'Text'));
        $companyName = $this->request->getByType('companyName', 'Text');
        if (!$this->isActive() || (empty($companyId) && empty($companyName))) {
Severity: Minor
Found in app/RecordCollectors/ChZefix.php - About 35 mins to fix

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 getCompaniesByName has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function getCompaniesByName(string $companyName): void
    {
        try {
            $response = \App\RequestHttp::getClient(['auth' => [$this->username, $this->password]])
                ->post($this->url . 'search', ['json' => ['name' => $companyName]]);
Severity: Minor
Found in app/RecordCollectors/ChZefix.php - About 35 mins to fix

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

Avoid using static access to class '\App\Json' in method 'getCompanyById'.
Open

}
Severity: Minor
Found in app/RecordCollectors/ChZefix.php by phpmd

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\Log' in method 'getCompanyById'.
Open

            \App\Log::warning($e->getMessage(), 'RecordCollectors');
Severity: Minor
Found in app/RecordCollectors/ChZefix.php by phpmd

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 {
            return [];
        }
Severity: Minor
Found in app/RecordCollectors/ChZefix.php by phpmd

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\Json' in method 'getCompaniesByName'.
Open

                $response = \App\Json::decode($response->getBody()->getContents());
Severity: Minor
Found in app/RecordCollectors/ChZefix.php by phpmd

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\Log' in method 'getCompaniesByName'.
Open

            \App\Log::warning($e->getMessage(), 'RecordCollectors');
Severity: Minor
Found in app/RecordCollectors/ChZefix.php by phpmd

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 '197', column '8').
Open

    private function loadCredentials(): void
    {
        if (($params = $this->getParams()) && !empty($params['username'] && !empty($params['password']))) {
            $this->username = $params['username'];
            $this->password = $params['password'];
Severity: Minor
Found in app/RecordCollectors/ChZefix.php by phpmd

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\Utils' in method 'parseData'.
Open

        return \App\Utils::flattenKeys($data, 'ucfirst');
Severity: Minor
Found in app/RecordCollectors/ChZefix.php by phpmd

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 = 'YetiForceRcChZefix';
Severity: Critical
Found in app/RecordCollectors/ChZefix.php by phan

Avoid excessively long variable names like $formFieldsToRecordMap. Keep variable name length under 20.
Open

    public $formFieldsToRecordMap = [
        'Accounts' => [
            'name' => 'accountname',
            'translation1' => 'accountname',
            'uid' => 'registration_number_1',
Severity: Minor
Found in app/RecordCollectors/ChZefix.php by phpmd

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Avoid variables with short names like $i. Configured minimum length is 3.
Open

                $i = 0;
Severity: Minor
Found in app/RecordCollectors/ChZefix.php by phpmd

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

Source https://phpmd.org/rules/naming.html#shortvariable

Spaces must be used to indent lines; tabs are not allowed
Open

    public $settingsFields = [

Spaces must be used to indent lines; tabs are not allowed
Open

        'username' => ['required' => 1, 'purifyType' => 'Text', 'label' => 'Username'],

Spaces must be used to indent lines; tabs are not allowed
Open

        'password' => ['required' => 1, 'purifyType' => 'Text', 'label' => 'Password'],

Spaces must be used to indent lines; tabs are not allowed
Open

    /** {@inheritdoc} */

Spaces must be used to indent lines; tabs are not allowed
Open

    /** {@inheritdoc} */

Spaces must be used to indent lines; tabs are not allowed
Open

    public $docUrl = 'https://www.zefix.admin.ch/';

Spaces must be used to indent lines; tabs are not allowed
Open

        'Accounts' => [

Spaces must be used to indent lines; tabs are not allowed
Open

    public $displayType = 'FillFields';

Spaces must be used to indent lines; tabs are not allowed
Open

    ];

Spaces must be used to indent lines; tabs are not allowed
Open

            'name' => 'accountname',

Spaces must be used to indent lines; tabs are not allowed
Open

    /** {@inheritdoc} */

Spaces must be used to indent lines; tabs are not allowed
Open

    /** {@inheritdoc} */

Spaces must be used to indent lines; tabs are not allowed
Open

    /** {@inheritdoc} */

Spaces must be used to indent lines; tabs are not allowed
Open

    /** {@inheritdoc} */

Spaces must be used to indent lines; tabs are not allowed
Open

    public $formFieldsToRecordMap = [

Spaces must be used to indent lines; tabs are not allowed
Open

    public $description = 'LBL_CH_ZEFIX_DESC';

Spaces must be used to indent lines; tabs are not allowed
Open

    public $icon = 'yfi-zefix-ch';

Spaces must be used to indent lines; tabs are not allowed
Open

    public $allowedModules = ['Accounts', 'Leads', 'Vendors', 'Partners', 'Competition'];

Spaces must be used to indent lines; tabs are not allowed
Open

    /** {@inheritdoc} */

Spaces must be used to indent lines; tabs are not allowed
Open

    public $label = 'LBL_CH_ZEFIX';

Spaces must be used to indent lines; tabs are not allowed
Open

            'addressPoBox' => 'poboxa',

Spaces must be used to indent lines; tabs are not allowed
Open

            'name' => 'vendorname',

Spaces must be used to indent lines; tabs are not allowed
Open

    /** {@inheritdoc} */

Spaces must be used to indent lines; tabs are not allowed
Open

            'companyId' => 'registration_number_1',

Spaces must be used to indent lines; tabs are not allowed
Open

            'companyName' => 'vendorname'

Spaces must be used to indent lines; tabs are not allowed
Open

        } elseif (!empty($companyName) && (empty($companyId) || empty($this->data))) {

Spaces must be used to indent lines; tabs are not allowed
Open

            $this->username = $params['username'];

Spaces must be used to indent lines; tabs are not allowed
Open

    /** {@inheritdoc} */

Spaces must be used to indent lines; tabs are not allowed
Open

            'addressSwissZipCode' => 'addresslevel7a',

Spaces must be used to indent lines; tabs are not allowed
Open

            'addressAddon' => 'localnumbera',

Spaces must be used to indent lines; tabs are not allowed
Open

        ],

Spaces must be used to indent lines; tabs are not allowed
Open

        'Accounts' => [

Spaces must be used to indent lines; tabs are not allowed
Open

    /** {@inheritdoc} */

Spaces must be used to indent lines; tabs are not allowed
Open

    private function loadCredentials(): void

Spaces must be used to indent lines; tabs are not allowed
Open

            'capitalNominal' => 'annual_revenue',

Spaces must be used to indent lines; tabs are not allowed
Open

        }

Spaces must be used to indent lines; tabs are not allowed
Open

            'addressCity' => 'addresslevel5a',

Spaces must be used to indent lines; tabs are not allowed
Open

            'purpose' => 'description'

Spaces must be used to indent lines; tabs are not allowed
Open

            'addressHouseNumber' => 'buildingnumbera',

Spaces must be used to indent lines; tabs are not allowed
Open

            'addressHouseNumber' => 'buildingnumbera',

Spaces must be used to indent lines; tabs are not allowed
Open

        'Competition' => [

Spaces must be used to indent lines; tabs are not allowed
Open

        'companyName' => [

Spaces must be used to indent lines; tabs are not allowed
Open

            'labelModule' => '_Base',

Spaces must be used to indent lines; tabs are not allowed
Open

    ];

Spaces must be used to indent lines; tabs are not allowed
Open

            'companyName' => 'accountname'

Spaces must be used to indent lines; tabs are not allowed
Open

    ];

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

        $companyId = str_replace([' ', ',', '.', '-'], '', $this->request->getByType('companyId', 'Text'));

Spaces must be used to indent lines; tabs are not allowed
Open

            'purpose' => 'description'

Spaces must be used to indent lines; tabs are not allowed
Open

            'addressHouseNumber' => 'buildingnumbera',

Spaces must be used to indent lines; tabs are not allowed
Open

            'canton' => 'addresslevel2a',

Spaces must be used to indent lines; tabs are not allowed
Open

            'canton' => 'addresslevel2a',

Spaces must be used to indent lines; tabs are not allowed
Open

        ],

Spaces must be used to indent lines; tabs are not allowed
Open

            'label' => 'Registration number 1',

Spaces must be used to indent lines; tabs are not allowed
Open

    private $username;

Line exceeds 120 characters; contains 130 characters
Open

        return parent::isActive() && ($params = $this->getParams()) && !empty($params['username'] && !empty($params['password']));

Spaces must be used to indent lines; tabs are not allowed
Open

        if (!empty($companyId)) {

Spaces must be used to indent lines; tabs are not allowed
Open

    {

Spaces must be used to indent lines; tabs are not allowed
Open

        'Leads' => [

Spaces must be used to indent lines; tabs are not allowed
Open

            'translation1' => 'company',

Spaces must be used to indent lines; tabs are not allowed
Open

            'addressPoBox' => 'poboxa',

Spaces must be used to indent lines; tabs are not allowed
Open

            'addressSwissZipCode' => 'addresslevel7a',

Spaces must be used to indent lines; tabs are not allowed
Open

            'addressPoBox' => 'poboxa',

Spaces must be used to indent lines; tabs are not allowed
Open

            'companyId' => 'registration_number_1',

Spaces must be used to indent lines; tabs are not allowed
Open

            'companyName' => 'company'

Spaces must be used to indent lines; tabs are not allowed
Open

        }

Spaces must be used to indent lines; tabs are not allowed
Open

        return $this->response;

Spaces must be used to indent lines; tabs are not allowed
Open

            'translation1' => 'accountname',

Spaces must be used to indent lines; tabs are not allowed
Open

            'addressSwissZipCode' => 'addresslevel7a',

Spaces must be used to indent lines; tabs are not allowed
Open

            'canton' => 'addresslevel2a',

Spaces must be used to indent lines; tabs are not allowed
Open

        ],

Spaces must be used to indent lines; tabs are not allowed
Open

            'purpose' => 'description'

Spaces must be used to indent lines; tabs are not allowed
Open

            'addressAddon' => 'localnumbera',

Spaces must be used to indent lines; tabs are not allowed
Open

            'addressStreet' => 'addresslevel8a',

Spaces must be used to indent lines; tabs are not allowed
Open

    protected $fields = [

Spaces must be used to indent lines; tabs are not allowed
Open

        } else {

Spaces must be used to indent lines; tabs are not allowed
Open

            return [];

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return void

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

     * Function fetching company data by Company ID.

Spaces must be used to indent lines; tabs are not allowed
Open

    private function getCompanyById(string $companyId): void

Spaces must be used to indent lines; tabs are not allowed
Open

            'addressAddon' => 'localnumbera',

Spaces must be used to indent lines; tabs are not allowed
Open

            'translation1' => 'subject',

Spaces must be used to indent lines; tabs are not allowed
Open

            'country' => 'addresslevel1a',

Spaces must be used to indent lines; tabs are not allowed
Open

            'addressSwissZipCode' => 'addresslevel7a',

Spaces must be used to indent lines; tabs are not allowed
Open

            'addressPoBox' => 'poboxa',

Spaces must be used to indent lines; tabs are not allowed
Open

            'label' => 'Account name',

Spaces must be used to indent lines; tabs are not allowed
Open

        'Vendors' => [

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

            'addressHouseNumber' => 'buildingnumbera',

Spaces must be used to indent lines; tabs are not allowed
Open

        ],

Spaces must be used to indent lines; tabs are not allowed
Open

            'name' => 'company',

Spaces must be used to indent lines; tabs are not allowed
Open

        ],

Spaces must be used to indent lines; tabs are not allowed
Open

            'addressAddon' => 'localnumbera',

Spaces must be used to indent lines; tabs are not allowed
Open

        ],

Spaces must be used to indent lines; tabs are not allowed
Open

        ],

Spaces must be used to indent lines; tabs are not allowed
Open

    private $url = 'https://www.zefix.admin.ch/ZefixPublicREST/api/v1/company/';

Spaces must be used to indent lines; tabs are not allowed
Open

            'canton' => 'addresslevel2a',

Spaces must be used to indent lines; tabs are not allowed
Open

            'uid' => 'registration_number_1',

Spaces must be used to indent lines; tabs are not allowed
Open

            'name' => 'subject',

Spaces must be used to indent lines; tabs are not allowed
Open

        'Leads' => [

Spaces must be used to indent lines; tabs are not allowed
Open

            'companyId' => 'registration_number_1',

Spaces must be used to indent lines; tabs are not allowed
Open

    {

Spaces must be used to indent lines; tabs are not allowed
Open

    public function search(): array

Spaces must be used to indent lines; tabs are not allowed
Open

            $this->getCompanyById($companyId);

Spaces must be used to indent lines; tabs are not allowed
Open

     * Function setup Credentials.

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param string $companyId

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

            'purpose' => 'description'

Spaces must be used to indent lines; tabs are not allowed
Open

            'addressSwissZipCode' => 'addresslevel7a',

Spaces must be used to indent lines; tabs are not allowed
Open

    ];

Spaces must be used to indent lines; tabs are not allowed
Open

    /** {@inheritdoc} */

Spaces must be used to indent lines; tabs are not allowed
Open

            'labelModule' => '_Base',

Spaces must be used to indent lines; tabs are not allowed
Open

    /** @var string Username. */

Spaces must be used to indent lines; tabs are not allowed
Open

    /** {@inheritdoc} */

Spaces must be used to indent lines; tabs are not allowed
Open

        return parent::isActive() && ($params = $this->getParams()) && !empty($params['username'] && !empty($params['password']));

Spaces must be used to indent lines; tabs are not allowed
Open

        }

Spaces must be used to indent lines; tabs are not allowed
Open

            'uid' => 'registration_number_1',

Spaces must be used to indent lines; tabs are not allowed
Open

            'addressAddon' => 'localnumbera',

Spaces must be used to indent lines; tabs are not allowed
Open

            'addressStreet' => 'addresslevel8a',

Spaces must be used to indent lines; tabs are not allowed
Open

    protected string $addOnName = 'YetiForceRcChZefix';

Spaces must be used to indent lines; tabs are not allowed
Open

        ],

Spaces must be used to indent lines; tabs are not allowed
Open

        ],

Spaces must be used to indent lines; tabs are not allowed
Open

            'companyId' => 'registration_number_1',

Spaces must be used to indent lines; tabs are not allowed
Open

    /** @var string Password. */

Spaces must be used to indent lines; tabs are not allowed
Open

    public function isActive(): bool

Spaces must be used to indent lines; tabs are not allowed
Open

    {

Spaces must be used to indent lines; tabs are not allowed
Open

        $companyName = $this->request->getByType('companyName', 'Text');

Spaces must be used to indent lines; tabs are not allowed
Open

                $data = [];

Spaces must be used to indent lines; tabs are not allowed
Open

            'addressCity' => 'addresslevel5a',

Spaces must be used to indent lines; tabs are not allowed
Open

            'name' => 'subject',

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->loadCredentials();

Spaces must be used to indent lines; tabs are not allowed
Open

            $response = \App\RequestHttp::getClient(['auth' => [$this->username, $this->password]])

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

    private function getCompaniesByName(string $companyName): void

Spaces must be used to indent lines; tabs are not allowed
Open

                $i = 0;

Spaces must be used to indent lines; tabs are not allowed
Open

            \App\Log::warning($e->getMessage(), 'RecordCollectors');

Spaces must be used to indent lines; tabs are not allowed
Open

            'addressStreet' => 'addresslevel8a',

Spaces must be used to indent lines; tabs are not allowed
Open

            'addressCity' => 'addresslevel5a',

Spaces must be used to indent lines; tabs are not allowed
Open

            'country' => 'addresslevel1a',

Spaces must be used to indent lines; tabs are not allowed
Open

        'companyId' => [

Spaces must be used to indent lines; tabs are not allowed
Open

        'Competition' => [

Spaces must be used to indent lines; tabs are not allowed
Open

            return [];

Spaces must be used to indent lines; tabs are not allowed
Open

            $this->getCompaniesByName($companyName);

Spaces must be used to indent lines; tabs are not allowed
Open

            }

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param array $data

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

            'addressCity' => 'addresslevel5a',

Spaces must be used to indent lines; tabs are not allowed
Open

            'translation1' => 'vendorname',

Spaces must be used to indent lines; tabs are not allowed
Open

            'uid' => 'registration_number_1',

Spaces must be used to indent lines; tabs are not allowed
Open

            'addressStreet' => 'addresslevel8a',

Spaces must be used to indent lines; tabs are not allowed
Open

            'addressCity' => 'addresslevel5a',

Spaces must be used to indent lines; tabs are not allowed
Open

            'addressHouseNumber' => 'buildingnumbera',

Spaces must be used to indent lines; tabs are not allowed
Open

    /** {@inheritdoc} */

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->loadData();

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return void

Spaces must be used to indent lines; tabs are not allowed
Open

                ->post($this->url . 'search', ['json' => ['name' => $companyName]]);

Spaces must be used to indent lines; tabs are not allowed
Open

                        $data[$i] = $this->data;

Spaces must be used to indent lines; tabs are not allowed
Open

        }

Spaces must be used to indent lines; tabs are not allowed
Open

                $this->data = $this->parseData(\App\Json::decode($response->getBody()->getContents())[0] ?? []);

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

                $response = \App\Json::decode($response->getBody()->getContents());

Spaces must be used to indent lines; tabs are not allowed
Open

                        $this->data = [];

Spaces must be used to indent lines; tabs are not allowed
Open

                        $this->response['links'][$i] = $this->data['zefixDetailWeb'] ?? '';

Spaces must be used to indent lines; tabs are not allowed
Open

            $this->response['error'] = $e->getResponse()->getReasonPhrase();

Spaces must be used to indent lines; tabs are not allowed
Open

     * Function parsing data to fields from API.

Spaces must be used to indent lines; tabs are not allowed
Open

    private function parseData(array $data): array

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

                        $this->getCompanyById($company['uid']);

Spaces must be used to indent lines; tabs are not allowed
Open

        } catch (\GuzzleHttp\Exception\GuzzleException $e) {

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

                ->get($this->url . 'uid/' . $companyId);

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param string $companyName

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

                        ++$i;

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

        unset($data['sogcPub']);

Spaces must be used to indent lines; tabs are not allowed
Open

            $this->response['error'] = $e->getResponse()->getReasonPhrase();

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return array

Spaces must be used to indent lines; tabs are not allowed
Open

            return [];

Spaces must be used to indent lines; tabs are not allowed
Open

    {

Spaces must be used to indent lines; tabs are not allowed
Open

        } catch (\GuzzleHttp\Exception\GuzzleException $e) {

Spaces must be used to indent lines; tabs are not allowed
Open

        try {

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return void

Spaces must be used to indent lines; tabs are not allowed
Open

        try {

Spaces must be used to indent lines; tabs are not allowed
Open

                $this->data = $data;

Spaces must be used to indent lines; tabs are not allowed
Open

            }

Spaces must be used to indent lines; tabs are not allowed
Open

        $data['zefixDetailWeb'] = $data['zefixDetailWeb']['en'] ?? $data['cantonalExcerptWeb'] ?? '';

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

            'addressStreet' => 'addresslevel8a',

Spaces must be used to indent lines; tabs are not allowed
Open

            'country' => 'addresslevel1a',

Spaces must be used to indent lines; tabs are not allowed
Open

        'Vendors' => [

Spaces must be used to indent lines; tabs are not allowed
Open

            'canton' => 'addresslevel2a',

Spaces must be used to indent lines; tabs are not allowed
Open

            'purpose' => 'description'

Spaces must be used to indent lines; tabs are not allowed
Open

    protected $modulesFieldsMap = [

Spaces must be used to indent lines; tabs are not allowed
Open

            'companyName' => 'subject'

Spaces must be used to indent lines; tabs are not allowed
Open

        ]

Spaces must be used to indent lines; tabs are not allowed
Open

        if (!$this->isActive() || (empty($companyId) && empty($companyName))) {

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

        }

Spaces must be used to indent lines; tabs are not allowed
Open

        $data['country'] = 'Switzerland';

Spaces must be used to indent lines; tabs are not allowed
Open

            if (200 === $response->getStatusCode()) {

Spaces must be used to indent lines; tabs are not allowed
Open

    {

Spaces must be used to indent lines; tabs are not allowed
Open

        return \App\Utils::flattenKeys($data, 'ucfirst');

Spaces must be used to indent lines; tabs are not allowed
Open

            'country' => 'addresslevel1a',

Spaces must be used to indent lines; tabs are not allowed
Open

        'Partners' => [

Spaces must be used to indent lines; tabs are not allowed
Open

            'addressPoBox' => 'poboxa',

Spaces must be used to indent lines; tabs are not allowed
Open

            'country' => 'addresslevel1a',

Spaces must be used to indent lines; tabs are not allowed
Open

            'translation1' => 'subject',

Spaces must be used to indent lines; tabs are not allowed
Open

        ],

Spaces must be used to indent lines; tabs are not allowed
Open

    /** {@inheritdoc} */

Spaces must be used to indent lines; tabs are not allowed
Open

    private $password;

Spaces must be used to indent lines; tabs are not allowed
Open

        if (($params = $this->getParams()) && !empty($params['username'] && !empty($params['password']))) {

Spaces must be used to indent lines; tabs are not allowed
Open

            $this->password = $params['password'];

Spaces must be used to indent lines; tabs are not allowed
Open

            \App\Log::warning($e->getMessage(), 'RecordCollectors');

Spaces must be used to indent lines; tabs are not allowed
Open

        }

Spaces must be used to indent lines; tabs are not allowed
Open

            $response = \App\RequestHttp::getClient(['auth' => [$this->username, $this->password]])

Spaces must be used to indent lines; tabs are not allowed
Open

            if (200 === $response->getStatusCode()) {

Spaces must be used to indent lines; tabs are not allowed
Open

                    }

Spaces must be used to indent lines; tabs are not allowed
Open

                }

Spaces must be used to indent lines; tabs are not allowed
Open

        if (empty($data)) {

Spaces must be used to indent lines; tabs are not allowed
Open

                foreach ($response as $company) {

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

     * Function fetching companies data by company name.

Spaces must be used to indent lines; tabs are not allowed
Open

    {

Spaces must be used to indent lines; tabs are not allowed
Open

                    if ($i < 5) {

There are no issues that match your filters.

Category
Status