modules/Settings/Companies/models/Module.php
Missing class import via use statement (line '96', column '9'). Open
Open
(new \App\Db\Query())->select(['subindustry'])->from('vtiger_subindustry')->orderBy('sortorderid')->column()
- 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
Missing class import via use statement (line '95', column '9'). Open
Open
(new \App\Db\Query())->select(['industry'])->from('vtiger_industry')->orderBy('sortorderid')->column(),
- 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
syntax error, unexpected 'array' (T_ARRAY), expecting function (T_FUNCTION) or const (T_CONST)
Open
Open
public static array $formFields = [
- Exclude checks
Each class must be in a namespace of at least one level (a top-level vendor name) Open
Open
class Settings_Companies_Module_Model extends Settings_Vtiger_Module_Model
- Exclude checks
The class Settings_Companies_Module_Model is not named in CamelCase. Open
Open
class Settings_Companies_Module_Model extends Settings_Vtiger_Module_Model
{
/**
* @inheritdoc
*/
- 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
Avoid variables with short names like $b. Configured minimum length is 3. Open
Open
usort($columnNames, function ($a, $b) use ($editFields) {
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $a. Configured minimum length is 3. Open
Open
usort($columnNames, function ($a, $b) use ($editFields) {
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @inheritdoc
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @inheritdoc
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
'name' => 'LBL_NAME',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @inheritdoc
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
'website' => 'LBL_WEBSITE',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public $name = 'Companies';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @return string URL
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function getDefaultUrl(): string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public $baseTable = 's_yf_companies';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public static array $formFields = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return 'index.php?parent=Settings&module=Companies&view=Edit';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public $listFields = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
'website' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public $baseIndex = 'id';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
'infoText' => 'LBL_VAT_ID_INFO',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
'name' => [],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* Function to get the column names.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* List of fields in form.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @var array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
'country' => [],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @return bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* Function to get the url for default view of the module.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* New entities mustn't be created.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
'industry' => [],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
'infoText' => 'LBL_WEBSITE_INFO',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @inheritdoc
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
'vat_id' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function hasCreatePermissions(): bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
(new \App\Db\Query())->select(['industry'])->from('vtiger_industry')->orderBy('sortorderid')->column(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
});
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return $tableSchema->getColumnNames();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public static function getFormFields(): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$tableSchema = \App\Db::getInstance('admin')->getTableSchema('s_#__companies', true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return array_merge(
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
unset($columnNames[array_search('id', $columnNames)]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @return string[]
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return static::$formFields;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return array_search($a, $editFields) < array_search($b, $editFields) ? -1 : 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
if ($tableSchema) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$editFields = array_keys(self::$formFields);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* Return list fields in form.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return $columnNames;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @return array|false
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public static function getColumnNames()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* Names of fields.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public static function getIndustryList(): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function getNameFields()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
(new \App\Db\Query())->select(['subindustry'])->from('vtiger_subindustry')->orderBy('sortorderid')->column()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$columnNames = self::getColumnNames();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @return bool|array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
usort($columnNames, function ($a, $b) use ($editFields) {
- Exclude checks
Class name "Settings_Companies_Module_Model" is not in camel caps format Open
Open
class Settings_Companies_Module_Model extends Settings_Vtiger_Module_Model
- Exclude checks