modules/KnowledgeBase/models/RecordPopover.php
Avoid unused local variables such as '$fieldLabel'. Open
Open
foreach ($this->recordModel->getEntity()->list_fields_name as $fieldLabel => $fieldName) {
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
Reference to undeclared property \CRMEntity->list_fields_name
Open
Open
foreach ($this->recordModel->getEntity()->list_fields_name as $fieldLabel => $fieldName) {
- Exclude checks
Each class must be in a namespace of at least one level (a top-level vendor name) Open
Open
class KnowledgeBase_RecordPopover_Model extends Vtiger_RecordPopover_Model
- Exclude checks
The class KnowledgeBase_RecordPopover_Model is not named in CamelCase. Open
Open
class KnowledgeBase_RecordPopover_Model extends Vtiger_RecordPopover_Model
{
/** {@inheritdoc} */
public function getFields(): array
{
- 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 to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$summaryFields = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
foreach ($this->recordModel->getEntity()->list_fields_name as $fieldLabel => $fieldName) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
if ($fieldModel && !$this->recordModel->isEmpty($fieldName) && $fieldModel->isViewableInDetailView()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return $summaryFields;
- 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
$summaryFields[$fieldName] = $fieldModel;
- 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
$fields = $this->recordModel->getModule()->getFields();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function getFields(): 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
$fieldModel = $fields[$fieldName] ?? '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/** {@inheritdoc} */
- Exclude checks
Class name "KnowledgeBase_RecordPopover_Model" is not in camel caps format Open
Open
class KnowledgeBase_RecordPopover_Model extends Vtiger_RecordPopover_Model
- Exclude checks