YetiForceCompany/YetiForceCRM

View on GitHub
app/RecordCollectors/PlCeidg.php

Summary

Maintainability
B
4 hrs
Test Coverage
F
0%

Function getDataFromApi has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    private function getDataFromApi(array $query): void
    {
        $query['limit'] = self::LIMIT;
        try {
            $response = \App\RequestHttp::getClient()->request('GET', $this->url . '?' . http_build_query($query), [
Severity: Minor
Found in app/RecordCollectors/PlCeidg.php - About 1 hr 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

Method getDataFromApi has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function getDataFromApi(array $query): void
    {
        $query['limit'] = self::LIMIT;
        try {
            $response = \App\RequestHttp::getClient()->request('GET', $this->url . '?' . http_build_query($query), [
Severity: Minor
Found in app/RecordCollectors/PlCeidg.php - About 1 hr to fix

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

        public function search(): array
        {
            if (!$this->isActive()) {
                return [];
            }
    Severity: Minor
    Found in app/RecordCollectors/PlCeidg.php - About 25 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

    Missing class import via use statement (line '278', column '14').
    Open

                throw new \App\Exceptions\IllegalValue('You must fist setup Api Key in Config Panel', 403);
    Severity: Minor
    Found in app/RecordCollectors/PlCeidg.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Avoid using static access to class '\App\Log' in method 'getDataFromApi'.
    Open

                \App\Log::warning($e->getMessage(), 'RecordCollectors');
    Severity: Minor
    Found in app/RecordCollectors/PlCeidg.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 loadConfig uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

            } else {
                throw new \App\Exceptions\IllegalValue('You must fist setup Api Key in Config Panel', 403);
            }
    Severity: Minor
    Found in app/RecordCollectors/PlCeidg.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\Fields\Country' in method 'parseData'.
    Open

                $data['adresDzialalnosci']['kraj'] = \App\Fields\Country::getCountryName($data['adresDzialalnosci']['kraj']);
    Severity: Minor
    Found in app/RecordCollectors/PlCeidg.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 '207', column '7').
    Open

        public function search(): array
        {
            if (!$this->isActive()) {
                return [];
            }
    Severity: Minor
    Found in app/RecordCollectors/PlCeidg.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 assigning values to variables in if clauses and the like (line '213', column '7').
    Open

        public function search(): array
        {
            if (!$this->isActive()) {
                return [];
            }
    Severity: Minor
    Found in app/RecordCollectors/PlCeidg.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 assigning values to variables in if clauses and the like (line '275', column '8').
    Open

        private function loadConfig(): void
        {
            if (($params = $this->getParams()) && !empty($params['api_key'])) {
                $this->apiKey = $params['api_key'];
            } else {
    Severity: Minor
    Found in app/RecordCollectors/PlCeidg.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 'getDataFromApi'.
    Open

                            $this->data[$key] = \App\Utils::flattenKeys($this->parseData($response['firma'][0]), 'ucfirst');
    Severity: Minor
    Found in app/RecordCollectors/PlCeidg.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 '216', column '7').
    Open

        public function search(): array
        {
            if (!$this->isActive()) {
                return [];
            }
    Severity: Minor
    Found in app/RecordCollectors/PlCeidg.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\Fields\Country' in method 'parseData'.
    Open

                $data['adresKorespondencyjny']['kraj'] = \App\Fields\Country::getCountryName($data['adresKorespondencyjny']['kraj']);
    Severity: Minor
    Found in app/RecordCollectors/PlCeidg.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\Json' in method 'getDataFromApi'.
    Open

                        $response = \App\Json::decode($response->getBody()->getContents()) ?? [];
    Severity: Minor
    Found in app/RecordCollectors/PlCeidg.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\Json' in method 'getDataFromApi'.
    Open

                $rows = \App\Json::decode($response->getBody()->getContents()) ?? [];
    Severity: Minor
    Found in app/RecordCollectors/PlCeidg.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 'getDataFromApi'.
    Open

                        \App\Log::warning($e->getMessage(), 'RecordCollectors');
    Severity: Minor
    Found in app/RecordCollectors/PlCeidg.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 '210', column '7').
    Open

        public function search(): array
        {
            if (!$this->isActive()) {
                return [];
            }
    Severity: Minor
    Found in app/RecordCollectors/PlCeidg.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

    syntax error, unexpected 'string' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST)
    Open

        protected string $addOnName = 'YetiForceRcPlCeidg';
    Severity: Critical
    Found in app/RecordCollectors/PlCeidg.php by phan

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            'Vendors' => [
                'nazwa' => 'vendorname',
                'email' => 'email',
                'wlascicielRegon' => 'registration_number_2',
                'naglowekANumerKRS' => 'registration_number_1',
    Severity: Major
    Found in app/RecordCollectors/PlCeidg.php and 1 other location - About 1 hr to fix
    app/YetiForce/Watchdog.php on lines 25..48

    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 107.

    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

    Further Reading

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

        public $formFieldsToRecordMap = [
            'Accounts' => [
                'nazwa' => 'accountname',
                'email' => 'email1',
                'wlascicielNip' => 'vat_id',
    Severity: Minor
    Found in app/RecordCollectors/PlCeidg.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

    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

        ];

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

                'adresKorespondencyjnyWojewodztwo' => 'addresslevel2b',

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

                'nazwa' => 'accountname',

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

                'wlascicielRegon' => 'registration_number_2',

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

                'adresDzialalnosciPowiat' => 'addresslevel3a',

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

        /** @var int Limit for fetching companies */

    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

            'Accounts' => [

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

                'pkdGlowny' => 'siccode',

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

                'adresKorespondencyjnyBudynek' => 'buildingnumberb',

    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

                'adresDzialalnosciUlica' => 'addresslevel8a',

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

                'adresDzialalnosciUlica' => 'addresslevel8a',

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

                'adresDzialalnosciWojewodztwo' => 'addresslevel2a',

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

        public $docUrl = 'https://dane.biznes.gov.pl';

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

                'naglowekANumerKRS' => 'registration_number_1',

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

                'adresDzialalnosciKod' => 'addresslevel7a',

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

                'adresDzialalnosciMiasto' => 'addresslevel5a',

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

        const LIMIT = 4;

    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

            'api_key' => ['required' => 1, 'purifyType' => 'Text', 'label' => 'LBL_API_KEY'],

    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

        /** {@inheritdoc} */

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

                'naglowekANumerKRS' => 'registration_number_1',

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

        public $icon = 'yfi-cedig-pl';

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

        public $label = 'LBL_PL_CEIDG';

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

                'adresDzialalnosciBudynek' => 'buildingnumbera',

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

                'adresKorespondencyjnyMiasto' => 'addresslevel5b',

    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

                'email' => 'email1',

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

            ],

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

                'nazwa' => 'company',

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

                'wlascicielNip' => 'vat_id',

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

                'adresDzialalnosciBudynek' => '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

                'adresDzialalnosciWojewodztwo' => 'addresslevel2a',

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

                'adresKorespondencyjnyKod' => 'addresslevel7b',

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

                'adresDzialalnosciMiasto' => 'addresslevel5a',

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

                'adresDzialalnosciKraj' => 'addresslevel1a'

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

        public $allowedModules = ['Accounts', 'Leads', 'Vendors', '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 $settingsFields = [

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

                'adresDzialalnosciGmina' => 'addresslevel4a',

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

                'adresKorespondencyjnyKraj' => 'addresslevel1b'

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

                'email' => 'email1',

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

        public $description = 'LBL_PL_CEIDG_DESC';

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

                'wlascicielNip' => 'vat_id',

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

                'adresDzialalnosciPowiat' => 'addresslevel3a',

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

                'adresKorespondencyjnyGmina' => 'addresslevel4b',

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

                'wlascicielRegon' => 'registration_number_2',

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

                'adresDzialalnosciGmina' => 'addresslevel4a',

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

                'adresDzialalnosciMiasto' => 'addresslevel5a',

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

                'adresDzialalnosciUlica' => 'addresslevel8a',

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

                'adresDzialalnosciKod' => 'addresslevel7a',

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

                'adresDzialalnosciUlica' => 'addresslevel8a',

    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

                'taxNumber' => 'registration_number_2',

    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

            $query = [];

    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->getDataFromApi($query);

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

                    'headers' => ['Authorization' => 'Bearer ' . $this->apiKey],

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

                $rows = \App\Json::decode($response->getBody()->getContents()) ?? [];

    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

            ],

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

                'wlascicielNip' => 'vat_id',

    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

                'taxNumber' => 'registration_number_2',

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

            ],

    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

            $this->loadConfig();

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

            if ($ncr = str_replace([' ', ',', '.', '-'], '', $this->request->getByType('ncr', 'Text'))) {

    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

                'adresDzialalnosciKraj' => 'addresslevel1a',

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

                'adresKorespondencyjnyUlica' => 'addresslevel8b',

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

                'adresKorespondencyjnyPowiat' => 'addresslevel3b',

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

                'adresDzialalnosciKod' => 'addresslevel7a',

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

                'email' => 'email',

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

                'adresDzialalnosciKraj' => 'addresslevel1a',

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

                'adresKorespondencyjnyGmina' => 'addresslevel4b',

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

                'email' => 'email',

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

                'wlascicielNip' => 'vat_id',

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

                'adresDzialalnosciBudynek' => 'buildingnumbera',

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

        /** @var string Polish CEIDG sever address */

    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

                'vatId' => 'vat_id',

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

                'vatId' => 'vat_id',

    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

            }

    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

            $query['limit'] = self::LIMIT;

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

                'adresDzialalnosciPowiat' => 'addresslevel3a',

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

                'label' => 'Vat ID',

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

                'ncr' => 'registration_number_1',

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

            $this->moduleName = $this->request->getModule();

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

            if ($vatId = str_replace([' ', ',', '.', '-'], '', $this->request->getByType('vatId', 'Text'))) {

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

                $query['nip'] = $ncr;

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

        {

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

                'email' => 'email',

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

                'naglowekANumerKRS' => 'registration_number_1',

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

        protected $url = 'https://dane.biznes.gov.pl/api/ceidg/v2/firmy';

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

            }

    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

                'adresDzialalnosciGmina' => 'addresslevel4a',

    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 2',

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

                'adresDzialalnosciWojewodztwo' => 'addresslevel2a',

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

            'name' => [

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

                'adresKorespondencyjnyKod' => 'addresslevel7b',

    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

        }

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

                'adresDzialalnosciMiasto' => 'addresslevel5a',

    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

        ];

    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->response['error'] = $e->getMessage();

    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

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

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

            if (!$this->isActive()) {

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

                $query['regon'] = $taxNumber;

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

         * Function fetching from Polish Central Registration And Information On Business API.

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

         * @param array $query

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

                'adresDzialalnosciBudynek' => 'buildingnumbera',

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

                'adresDzialalnosciUlica' => 'addresslevel8a',

    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

                'adresKorespondencyjnyMiasto' => 'addresslevel5b',

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

                'adresKorespondencyjnyPowiat' => 'addresslevel3b',

    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

                'adresDzialalnosciWojewodztwo' => '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

            'ncr' => [

    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

            try {

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

                'adresDzialalnosciKod' => 'addresslevel7a',

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

                'adresDzialalnosciBudynek' => 'buildingnumbera',

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

                'adresDzialalnosciPowiat' => 'addresslevel3a',

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

            'vatId' => [

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

            ],

    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

                'vatId' => 'vat_id',

    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

                'ncr' => 'registration_number_1',

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

                $query['nip'] = $vatId;

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

                $query['nazwa'] = $name;

    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

         */

    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

        /** @var string Api Key. */

    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

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

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

                'wlascicielRegon' => 'registration_number_2',

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

        protected string $addOnName = 'YetiForceRcPlCeidg';

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

            'taxNumber' => [

    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()->request('GET', $this->url . '?' . http_build_query($query), [

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

                'nazwa' => 'vendorname',

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

                'adresKorespondencyjnyUlica' => 'addresslevel8b',

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

        ];

    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

                'ncr' => 'registration_number_1',

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

            if ($name = $this->request->getByType('name', 'Text')) {

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

                'adresDzialalnosciMiasto' => 'addresslevel5a',

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

                'adresKorespondencyjnyBudynek' => 'buildingnumberb',

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

                'adresKorespondencyjnyKraj' => 'addresslevel1b'

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

                'nazwa' => 'subject',

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

                'adresDzialalnosciKod' => 'addresslevel7a',

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

                'adresDzialalnosciKraj' => 'addresslevel1a'

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

            ]

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

                'ncr' => 'registration_number_1',

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

                'taxNumber' => 'registration_number_2',

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

                'vatId' => 'vat_id',

    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 [];

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

        private function getDataFromApi(array $query): 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

         * @return void

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

                'adresDzialalnosciKraj' => 'addresslevel1a'

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

                'wlascicielNip' => 'vat_id',

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

                'adresDzialalnosciGmina' => 'addresslevel4a',

    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

                'taxNumber' => 'registration_number_2',

    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

        public function search(): array

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

            if (!$query) {

    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()->request('GET', $value['link'], [

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

         * Function parsing data to fields from Securities and Exchange Commission API.

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

            if (isset($data['adresKorespondencyjny']['kraj'])) {

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

            unset($data['id'], $data['link']);

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

                $this->getDataFromApi(['nip_sc' => $query['nip'], 'limit' => self::LIMIT]);

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

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

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

                $data['adresDzialalnosci']['kraj'] = \App\Fields\Country::getCountryName($data['adresDzialalnosci']['kraj']);

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

                'nazwa' => 'subject',

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

                'adresDzialalnosciPowiat' => 'addresslevel3a',

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

                'adresDzialalnosciWojewodztwo' => 'addresslevel2a',

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

                'adresKorespondencyjnyWojewodztwo' => 'addresslevel2b',

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

                'adresDzialalnosciGmina' => 'addresslevel4a',

    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

                'label' => 'LBL_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

            ],

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

        private $apiKey;

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

            if ($taxNumber = str_replace([' ', ',', '.', '-'], '', $this->request->getByType('taxNumber', 'Text'))) {

    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

        private function parseData(array $data): array

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

                $data['adresKorespondencyjny']['kraj'] = \App\Fields\Country::getCountryName($data['adresKorespondencyjny']['kraj']);

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

            }

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

                            'headers' => ['Authorization' => 'Bearer ' . $this->apiKey],

    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 (isset($response['firma'][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

        private function loadConfig(): 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

            if (!empty($rows['firmy'])) {

    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['pkd'] = implode(',', $data['pkd']);

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

            return $data;

    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

            } elseif (isset($query['regon'])) {

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

                        }

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

                foreach ($rows['firmy'] as $key => $value) {

    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

         *

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

                            $this->data[$key] = \App\Utils::flattenKeys($this->parseData($response['firma'][0]), 'ucfirst');

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

                $this->getDataFromApi(['regon_sc' => $query['regon'], 'limit' => self::LIMIT]);

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

         * Function setup Api Key.

    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

         */

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

            } elseif (isset($query['nip'])) {

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

        }

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

            }

    Line exceeds 120 characters; contains 129 characters
    Open

                $data['adresKorespondencyjny']['kraj'] = \App\Fields\Country::getCountryName($data['adresKorespondencyjny']['kraj']);

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

                throw new \App\Exceptions\IllegalValue('You must fist setup Api Key in Config Panel', 403);

    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 (isset($data['adresDzialalnosci']['kraj'])) {

    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

            if (isset($data['pkd'])) {

    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

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

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

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

    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->apiKey = $params['api_key'];

    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 array

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

        {

    Line exceeds 120 characters; contains 121 characters
    Open

                $data['adresDzialalnosci']['kraj'] = \App\Fields\Country::getCountryName($data['adresDzialalnosci']['kraj']);

    There are no issues that match your filters.

    Category
    Status