Method search
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function search(): array
{
if (!$this->isActive()) {
return [];
}
Function search
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function search(): array
{
if (!$this->isActive()) {
return [];
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
The method search() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10. Open
public function search(): array
{
if (!$this->isActive()) {
return [];
}
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
Avoid using undefined variables such as '$query' which will lead to PHP notices. Open
$query['email'] = $mail;
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$query' which will lead to PHP notices. Open
$query['country'] = $country;
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$query' which will lead to PHP notices. Open
$query['phone'] = $phone;
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$query' which will lead to PHP notices. Open
$query['ein'] = $vatNumber;
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$query' which will lead to PHP notices. Open
$query['api_key'] = $this->apiKey;
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$query' which will lead to PHP notices. Open
$query['name'] = $name;
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$query' which will lead to PHP notices. Open
$this->getDataFromApi($query);
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Missing class import via use statement (line '283', column '14'). Open
throw new \App\Exceptions\IllegalValue('You must fist setup Api Key in Config Panel', 403);
- Read upRead up
- Exclude checks
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\Json' in method 'getDataFromApi'. Open
$data = isset($response) ? \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 assigning values to variables in if clauses and the like (line '280', column '8'). Open
private function loadConfig(): void
{
if (($params = $this->getParams()) && !empty($params['api_key'])) {
$this->apiKey = $params['api_key'];
} else {
- 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\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
Avoid using static access to class '\App\Json' in method 'getDataFromApi'. Open
$this->data[$key] = $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\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
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);
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\App\RequestHttp' in method 'getDataFromApi'. Open
$client = \App\RequestHttp::getClient(['timeout' => 60]);
- 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 'bool' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST)
Open
protected bool $paid = false;
- Exclude checks
Avoid excessively long variable names like $formFieldsToRecordMap. Keep variable name length under 20. Open
public $formFieldsToRecordMap = [
'Accounts' => [
'name' => 'accountname',
'eins0' => 'vat_id',
'website' => 'website',
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Spaces must be used to indent lines; tabs are not allowed Open
public $label = 'LBL_ORB';
- 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
const LIMIT = 4;
- 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
public $icon = 'yfi-orb';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $docUrl = 'https://api.orb-intelligence.com/';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $allowedModules = ['Accounts', 'Leads', 'Partners', 'Vendors', 'Competition'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $description = 'LBL_ORB_DESC';
- 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 $displayType = 'FillFields';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var int Limit for fetching companies */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'addressZip' => 'addresslevel7a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'labelModule' => 'Other.RecordCollector',
- 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
'name' => 'vendorname',
- 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
'phone' => 'phone'
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'addressAddress2' => 'buildingnumbera',
- 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
],
- 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
'email' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
]
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'country' => 'addresslevel1a',
- 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
public $formFieldsToRecordMap = [
- 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
'Partners' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'eins0' => 'vat_id',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'addressAddress1' => 'addresslevel8a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'addressCity' => 'addresslevel5a',
- 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
'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
'Accounts' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'addressState' => 'addresslevel2a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'sic_code' => 'siccode',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'addressZip' => 'addresslevel7a',
- 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
'label' => 'Phone',
- 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
'vatNumber' => 'vat_id',
- 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
'eins0' => '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
'addressAddress1' => 'addresslevel8a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'addressCity' => 'addresslevel5a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'description' => 'description',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'addressAddress2' => 'buildingnumbera',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'description' => 'description',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'labelModule' => '_Base',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'label' => 'Email',
- 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
'phone' => 'phone'
- 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
'description' => 'description',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'addressCity' => 'addresslevel5a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'eins0' => 'vat_id',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'addressAddress1' => 'addresslevel8a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'cik' => 'registration_number_1',
- 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
'Partners' => [
- 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
'cik' => 'registration_number_1',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'website' => 'website',
- 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
'addressAddress2' => 'buildingnumbera',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'addressCountry' => 'addresslevel1a'
- 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
],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected bool $paid = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'api_key' => ['required' => 1, 'purifyType' => 'Text', 'label' => 'LBL_API_KEY']
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'eins0' => 'vat_id',
- 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
'Vendors' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'addressCountry' => 'addresslevel1a'
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'phone' => 'phone',
- 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
'addressState' => 'addresslevel2a',
- 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
'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
'addressAddress1' => 'addresslevel8a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'cik' => 'registration_number_1',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'addressCountry' => 'addresslevel1a'
- 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
'addressZip' => 'addresslevel7a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'addressAddress1' => 'addresslevel8a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'addressCity' => '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
'sic_code' => 'siccode',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'addressCountry' => 'addresslevel1a'
- 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
'addressAddress2' => 'buildingnumbera',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var string ORB Intelligence sever address */
- 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
'name' => 'subject',
- 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
'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
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'addressState' => 'addresslevel2a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'addressZip' => 'addresslevel7a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'cik' => 'registration_number_1',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'eins0' => 'vat_id',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'addressZip' => 'addresslevel7a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'addressState' => 'addresslevel2a',
- 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' => 'email',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'description' => 'description',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'addressState' => 'addresslevel2a',
- 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' => 'vendorname',
- 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
protected $url = 'https://api.orb-intelligence.com/';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'uitype' => 35
- 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
'name' => 'accountname',
- 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
'phone' => 'phone'
- 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
'website' => 'website',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'website' => 'website',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'addressAddress2' => 'buildingnumbera',
- 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
'name' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'labelModule' => '_Base',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'label' => 'Account 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
'vatNumber' => 'vat_id',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private $apiKey;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'cik' => 'registration_number_1',
- 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
'email' => 'email',
- 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
],
- 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
],
- 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
'addressCity' => 'addresslevel5a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'addressCountry' => 'addresslevel1a'
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'description' => 'description',
- 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' => 'Country',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'label' => 'LBL_ORB_VAT',
- 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
'phone' => 'phone'
- 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
'Competition' => [
- 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
/** @var string Api Key. */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$vatNumber = str_replace([' ', ',', '.', '-'], '', $this->request->getByType('vatNumber', 'Text'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query['phone'] = $phone;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$data = \array_slice($data['results'], 0, self::LIMIT, true);
- 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
return parent::isActive() && ($params = $this->getParams()) && !empty($params['api_key']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function fetching company data by params.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$response = $client->get($this->url . '3/match/?' . http_build_query($query));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($data as $key => $result) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->data[$key] = $this->parseData(\App\Json::decode($response->getBody()->getContents()));
- 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['api_key'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query['country'] = $country;
- 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
* @return void
- 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
try {
- 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
public function search(): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$this->isActive()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} catch (\GuzzleHttp\Exception\GuzzleException $e) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->loadConfig();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query['email'] = $mail;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->getDataFromApi($query);
- 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
throw new \App\Exceptions\IllegalValue('You must fist setup Api Key in Config Panel', 403);
- 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
public function isActive(): bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$name = $this->request->getByType('name', 'Text');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$phone = $this->request->getByType('phone', '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
\App\Log::warning($e->getMessage(), 'RecordCollectors');
- 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
private function loadConfig(): 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
$query['name'] = $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
* @param array $query
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($data)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$country = $this->request->getByType('country', 'Text');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif (empty($name) && !empty($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
return;
- 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 ORB Intelligence API.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mail = $this->request->getByType('email', 'Text');
- 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
} elseif (!empty($name)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif (empty($name) && !empty($mail)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$response = [];
- 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
$this->response['error'] = $e->getMessage();
- 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
$query['api_key'] = $this->apiKey;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$country) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('United States' === $country && !empty($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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->response['error'] = $e->getMessage();
- 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
private function parseData(array $data): 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
}
- 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
$this->loadData();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$data = isset($response) ? \App\Json::decode($response->getBody()->getContents()) : [];
- 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
$client = \App\RequestHttp::getClient(['timeout' => 60]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function setup Api Key.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->apiKey = $params['api_key'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query['ein'] = $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
private function getDataFromApi(array $query): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$response = $client->get($result['fetch_url']);
- Exclude checks