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
$this->data = \App\Utils::flattenKeys($this->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 = 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
syntax error, unexpected 'string' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST)
Open
protected string $addOnName = 'YetiForceRcUsaEdgar';
- Exclude checks
Avoid excessively long variable names like $formFieldsToRecordMap. Keep variable name length under 20. Open
public $formFieldsToRecordMap = [
'Accounts' => [
'name' => 'accountname',
'cik' => 'registration_number_1',
'ein' => 'vat_id',
- 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
'addressesBusinessStreet1' => 'addresslevel8a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'addressesMailingsCity' => 'addresslevel5b',
- 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
'ein' => 'vat_id',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'addressesMailingZipCode' => 'addresslevel7b',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Competition' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Partners' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'addressesBusinessCity' => 'addresslevel5a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'addressesBusinessStateOrCountryDescription' => 'addresslevel2a',
- 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 SEC sever address */
- 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
public $icon = 'yfi-edgar-usa';
- 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
'addressesBusinessZipCode' => 'addresslevel7a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'addressesBusinessStreet2' => 'buildingnumbera',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'addressesBusinessStateOrCountryDescription' => 'addresslevel2a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'addressesBusinessCity' => 'addresslevel5a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
]
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function search(): array
- 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
'addressesBusinessStreet1' => '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
'Accounts' => [
- 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
$this->parseData();
- 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 string $cik
- 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 int Central Index Key length */
- 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
'addressesBusinessStreet2' => 'buildingnumbera',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'addressesBusinessZipCode' => 'addresslevel7a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'addressesMailingZipCode' => 'addresslevel7b',
- 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
'addressesBusinessZipCode' => '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
'addressesBusinessStreet1' => 'addresslevel8a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'addressesMailingStreet2' => 'buildingnumberb',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'cik' => [
- 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
const CIK_LEN = 10;
- 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
'name' => 'accountname',
- 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
'name' => 'company',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'ein' => 'vat_id',
- 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
$this->getDataFromApi($cik);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\strlen($cik) < self::CIK_LEN) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $label = 'LBL_USA_EDGAR';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'addressesBusinessStreet2' => 'buildingnumbera',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'addressesBusinessCity' => 'addresslevel5a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Vendors' => [
- 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 = 'YetiForceRcUsaEdgar';
- 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
'cik' => 'registration_number_1',
- 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
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $docUrl = 'https://www.sec.gov/edgar/sec-api-documentation';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'webiste' => 'website',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'sic' => 'siccode',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'addressesBusinessStateOrCountryDescription' => 'addresslevel2b'
- 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
'cik' => 'registration_number_1',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'ein' => 'vat_id',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'webiste' => 'website',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'addressesBusinessStateOrCountryDescription' => 'addresslevel2b'
- 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://data.sec.gov/submissions/CIK';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Leads' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'name' => 'vendorname',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$this->isActive()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** {@inheritdoc} */
- 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
'addressesBusinessCity' => 'addresslevel5a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'addressesMailingStreet2' => 'buildingnumberb',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'addressesBusinessStateOrCountryDescription' => 'addresslevel2a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$cik) {
- 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
public $description = 'LBL_USA_EDGAR_DESC';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'webiste' => 'website',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'sic' => 'siccode',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'ein' => 'vat_id',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'addressesBusinessStateOrCountryDescription' => 'addresslevel2a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'labelModule' => '_Base',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private function getDataFromApi(string $cik): void
- 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
'addressesBusinessCity' => 'addresslevel5a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'addressesMailingsCity' => 'addresslevel5b',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'addressesBusinessStreet2' => '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
];
- 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
return [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'ein' => 'vat_id',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'addressesBusinessStateOrCountryDescription' => 'addresslevel2a',
- 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
],
- 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
public $allowedModules = ['Accounts', 'Leads', 'Partners', 'Vendors', 'Competition'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'addressesBusinessStreet1' => '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
$cik = str_replace([' ', ',', '.', '-'], '', $this->request->getByType('cik', '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
/** {@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
'addressesMailingStreet1' => 'addresslevel8b',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'addressesBusinessStreet2' => 'buildingnumbera',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'addressesBusinessZipCode' => 'addresslevel7a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'addressesMailingStreet1' => 'addresslevel8b',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'addressesBusinessZipCode' => '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
],
- 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
* Function finding company data by Central Index Key (CIK).
- 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
'addressesBusinessStreet1' => 'addresslevel8a',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'label' => 'Registration number 1',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->response;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
unset($this->data['filings']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$response = \App\RequestHttp::getClient()->get($this->url . $cik . '.json', [
- 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->data = isset($response) ? \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
private function parseData(): 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
$cik = str_repeat('0', $countZeroToAdd) . $cik;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'headers' => [
- 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
]);
- 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
* @return void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($this->data)) {
- 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->data = \App\Utils::flattenKeys($this->data, 'ucfirst');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$countZeroToAdd = self::CIK_LEN - \strlen($cik);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function parsing data to fields from Securities and Exchange Commission API.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'User-Agent' => 'YetiForce S. A. devs@yetiforce.com',
- 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
/**
- 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