Method getFields
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getFields(string $moduleName): array
{
$config = App\Config::security();
$fields = [
'proxyConnection' => [
Avoid using static access to class 'App\Config' in method 'getFields'. Open
$config = App\Config::security();
- 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 '\Vtiger_Field_Model' in method 'getFields'. Open
$fields[$key] = \Vtiger_Field_Model::init($moduleName, $value, $key);
- 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
Define a constant instead of duplicating this literal "fieldvalue" 6 times. Open
'fieldvalue' => $config['proxyConnection'] ?? ''
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "uitype" 6 times. Open
'uitype' => 56,
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "label" 6 times. Open
'label' => 'LBL_PROXY_CONNECTION',
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "labelDesc" 6 times. Open
'labelDesc' => 'LBL_QUICK_CREATE_MODULES_DESC',
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "purifyType" 6 times. Open
'purifyType' => 'boolean',
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class Settings_Proxy_ConfigForm_Model
- Exclude checks
The class Settings_Proxy_ConfigForm_Model is not named in CamelCase. Open
class Settings_Proxy_ConfigForm_Model
{
/**
* Function determines fields available in edition view.
*
- Read upRead up
- Exclude checks
CamelCaseClassName
Since: 0.2
It is considered best practice to use the CamelCase notation to name classes.
Example
class class_name {
}
Source
Spaces must be used for alignment; tabs are not allowed Open
*
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'labelDesc' => 'LBL_PROXY_PORT_DESC',
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'proxyProtocol' => [
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'uitype' => 99,
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* Function determines fields available in edition view.
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
],
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'proxyPort' => [
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @return Vtiger_Field_Model[]
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'picklistValues' => ['http' => 'http', 'https' => 'https', 'tcp' => 'tcp'],
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
],
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'fieldvalue' => $config['proxyPort'] ?? ''
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'uitype' => 17,
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
foreach ($fields as $key => $value) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
],
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
{
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'purifyType' => 'text',
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'uitype' => 106,
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @author Arkadiusz Sołek <a.solek@yetiforce.com>
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @author Mariusz Krzaczkowski <m.krzaczkowski@yetiforce.com>
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$config = App\Config::security();
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$fields = [
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'purifyType' => 'text',
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
];
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'proxyConnection' => [
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'purifyType' => 'url',
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'label' => 'LBL_PROXY_HOST',
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'proxyLogin' => [
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'purifyType' => 'boolean',
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
return $fields;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'uitype' => 56,
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'fieldvalue' => $config['proxyProtocol'] ?? ''
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'mandatory' => true
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'label' => 'LBL_PROXY_CONNECTION',
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
],
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'purifyType' => 'integer',
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'proxyHost' => [
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
public static function getFields(string $moduleName): array
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'labelDesc' => 'LBL_QUICK_CREATE_MODULES_DESC',
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'uitype' => 16,
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'fieldvalue' => $config['proxyLogin'] ?? ''
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'labelDesc' => 'LBL_PROXY_PASSWORD_DESC',
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @param string $moduleName
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'fieldvalue' => $config['proxyConnection'] ?? ''
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'purifyType' => 'text',
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'fieldvalue' => $config['proxyHost'] ?? ''
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'labelDesc' => 'LBL_PROXY_LOGIN_DESC',
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
],
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'label' => 'LBL_PROXY_PROTOCOL',
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'labelDesc' => 'LBL_PROXY_PROTOCOL_DESC',
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'labelDesc' => 'LBL_PROXY_HOST_DESC',
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'label' => 'LBL_PROXY_PORT',
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'proxyPassword' => [
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'uitype' => 7,
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
],
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'label' => 'LBL_PROXY_LOGIN',
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'label' => 'LBL_PROXY_PASSWORD',
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'fieldvalue' => $config['proxyPassword'] ?? '',
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$fields[$key] = \Vtiger_Field_Model::init($moduleName, $value, $key);
- Exclude checks
Class name "Settings_Proxy_ConfigForm_Model" is not in camel caps format Open
class Settings_Proxy_ConfigForm_Model
- Exclude checks