Function getDataFromApi
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function getDataFromApi($params): void
{
$params['format'] = 'json';
if (!empty($this->token)) {
$params['token'] = $this->token;
- 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 getDataFromApi
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getDataFromApi($params): void
{
$params['format'] = 'json';
if (!empty($this->token)) {
$params['token'] = $this->token;
Avoid assigning values to variables in if clauses and the like (line '192', column '7'). Open
public function search(): array
{
$params = [];
if ($vatNumber = str_replace([' ', ',', '.', '-'], '', $this->request->getByType('vatNumber', 'Text'))) {
$params['vat'] = $vatNumber;
- 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 assigning values to variables in if clauses and the like (line '215', column '8'). Open
private function setToken(): void
{
if (($params = $this->getParams()) && !empty($params['token'])) {
$this->token = $params['token'];
}
- 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 assigning values to variables in if clauses and the like (line '189', column '7'). Open
public function search(): array
{
$params = [];
if ($vatNumber = str_replace([' ', ',', '.', '-'], '', $this->request->getByType('vatNumber', 'Text'))) {
$params['vat'] = $vatNumber;
- 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 assigning values to variables in if clauses and the like (line '195', column '7'). Open
public function search(): array
{
$params = [];
if ($vatNumber = str_replace([' ', ',', '.', '-'], '', $this->request->getByType('vatNumber', 'Text'))) {
$params['vat'] = $vatNumber;
- 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\Json' in method 'getDataFromApi'. Open
$this->data = $this->parseData(\App\Json::decode($response->getBody()->getContents()));
- 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\Log' in method 'getDataFromApi'. Open
\App\Log::warning($e->getMessage(), '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
Avoid using static access to class '\App\Utils' in method 'parseData'. Open
return \App\Utils::flattenKeys($data, 'ucfirst');
- 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 = 'YetiForceRcDkCvr';
- Exclude checks
Avoid excessively long variable names like $formFieldsToRecordMap. Keep variable name length under 20. Open
public $formFieldsToRecordMap = [
'Accounts' => [
'name' => 'accountname',
'vat' => 'vat_id',
'phone' => 'phone',
- 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
/** {@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
public $description = 'LBL_DK_CVR_DESC';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'country' => 'addresslevel1a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'vat' => 'vat_id',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'phone' => 'phone',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var string CH sever address */
- 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
'fax' => 'fax',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'productionunits0City' => 'addresslevel5a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'companydesc' => 'description',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'vat' => 'vat_id',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'industrydesc' => 'description',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'fax' => 'fax',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'industrydesc' => 'description',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'productionunits0Zipcode' => 'addresslevel7a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'productionunits0Zipcode' => 'addresslevel7a',
- 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
public $label = 'LBL_DK_CVR';
- 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
'companydesc' => 'description',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'address' => 'addresslevel8a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'name' => 'subject',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'industrydesc' => 'description',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'address' => 'addresslevel8a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'city' => 'addresslevel5a',
- 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
'country' => 'addresslevel1a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'fax' => 'fax',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'productionunits0Zipcode' => 'addresslevel7a',
- 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
'country' => 'addresslevel1a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $icon = 'yfi-cvr-dk';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'vat' => 'vat_id',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'city' => 'addresslevel5a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'email' => 'email',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'name' => 'vendorname',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'zipcode' => 'addresslevel7a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'name' => 'subject',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'productionunits0City' => 'addresslevel5a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
const EXTERNAL_URL = 'https://cvrapi.dk/virksomhed/';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $allowedModules = ['Accounts', 'Leads', 'Vendors', 'Partners', 'Competition'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'name' => 'company',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'vat' => 'vat_id',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'companydesc' => 'description',
- 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
public $settingsFields = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'productionunits0Address' => 'addresslevel8a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'productionunits0Zipcode' => 'addresslevel7a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'country' => 'addresslevel1a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'address' => 'addresslevel8a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'address' => 'addresslevel8a',
- 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
'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
'phone' => 'phone',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $docUrl = 'https://cvrapi.dk/documentation';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'fax' => 'fax',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'industrycode' => 'siccode',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'productionunits0Address' => 'addresslevel8a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'zipcode' => 'addresslevel7a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'phone' => 'phone',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'name' => 'accountname',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'zipcode' => 'addresslevel7a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'companydesc' => 'description',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'email' => 'email',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'email' => 'email1',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'email' => 'email',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'productionunits0Address' => 'addresslevel8a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'city' => 'addresslevel5a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'city' => 'addresslevel5a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'vat' => 'vat_id',
- 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
'phone' => 'phone',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'phone' => 'phone',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'zipcode' => 'addresslevel7a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'productionunits0City' => 'addresslevel5a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'industrydesc' => 'description',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'typeofdata' => 'V~M',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'dk' => 'Denmark'
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'vatNumber' => 'vat_id',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'vatNumber' => 'vat_id',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->loadData();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($this->data['name'])) {
- 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
'token' => ['required' => 0, 'purifyType' => 'Text', 'label' => 'LBL_API_KEY_OPTIONAL'],
- 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
'productionunits0Address' => 'addresslevel8a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'industrydesc' => 'description',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'address' => 'addresslevel8a',
- 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
protected $modulesFieldsMap = [
- 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
private $token;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($name = $this->request->getByType('name', 'Text')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$this->isActive() && empty($params)) {
- 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
$this->token = $params['token'];
- 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->data && empty($this->data['error'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'productionunits0Address' => 'addresslevel8a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'picklistValues' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($vatNumber = str_replace([' ', ',', '.', '-'], '', $this->request->getByType('vatNumber', 'Text'))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Accounts' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'productionunits0City' => 'addresslevel5a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'companydesc' => 'description',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'productionunits0Zipcode' => 'addresslevel7a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'uitype' => 16,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'label' => 'Vat ID',
- 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
* @param array $params
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$response = \App\RequestHttp::getClient()->get($this->url . http_build_query($params));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::warning($e->getMessage(), 'RecordCollectors');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'dk':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
default:
- 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
'email' => 'email',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'productionunits0City' => 'addresslevel5a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'phone' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$params['vat'] = $vatNumber;
- 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
try {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- 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
protected string $addOnName = 'YetiForceRcDkCvr';
- 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
'vatNumber' => 'vat_id',
- 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
private function setToken(): void
- 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
],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function setup token key.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private function getDataFromApi($params): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($this->token)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$params['token'] = $this->token;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'country' => 'addresslevel1a',
- 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
'country' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'label' => 'FL_COMPANY_NAME',
- 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
$params['country'] = $this->request->getByType('country', 'Text');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->getDataFromApi($params);
- 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
private function parseData(array $data): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'zipcode' => 'addresslevel7a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'city' => 'addresslevel5a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'vatNumber' => 'vat_id',
- 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
$this->setToken();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'no':
- 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
* @param array $data
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'name' => [
- 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
'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
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$params['format'] = 'json';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'no' => 'Norway',
- 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
private $url = 'http://cvrapi.dk/api?';
- 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
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->response['error'] = $e->getResponse()->getReasonPhrase();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->data['country'] = 'Norway';
- 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
'Competition' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
]
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var string CH sever address */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var string Token key */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$params['name'] = $name;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$params['phone'] = $phone;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function fetching company data by Company Number (CVR).
- 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
$this->response['links'][0] = self::EXTERNAL_URL . $params['country'] . '/' . urlencode(str_replace(' ', '-', $this->data['name'])) . '/' . urlencode($this->data['vat']);
- 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
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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (200 === $response->getStatusCode()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->data['country'] = 'Denmark';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'label' => 'Country',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'picklistModule' => 'Other.Country',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($phone = $this->request->getByType('phone', 'Text')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->response;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->data = $this->parseData(\App\Json::decode($response->getBody()->getContents()));
- Exclude checks
Line exceeds 120 characters; contains 190 characters Open
$this->response['links'][0] = self::EXTERNAL_URL . $params['country'] . '/' . urlencode(str_replace(' ', '-', $this->data['name'])) . '/' . urlencode($this->data['vat']);
- 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
} catch (\GuzzleHttp\Exception\GuzzleException $e) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return \App\Utils::flattenKeys($data, 'ucfirst');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'fax' => 'fax',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'vatNumber' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'label' => 'FL_PHONE',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- 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
switch ($params['country']) {
- 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
* Function parsing data to fields from API.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
]
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (($params = $this->getParams()) && !empty($params['token'])) {
- Exclude checks