modules/Vtiger/models/MassEditRecordStructure.php
Function getStructure
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
public function getStructure()
{
if (!empty($this->structuredValues)) {
return $this->structuredValues;
}
- 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
Saw misspelled annotation @returns.
Did you mean @return?
Open
Open
* @returns boolean true or false
- Exclude checks
Each class must be in a namespace of at least one level (a top-level vendor name) Open
Open
class Vtiger_MassEditRecordStructure_Model extends Vtiger_EditRecordStructure_Model
- Exclude checks
The class Vtiger_MassEditRecordStructure_Model is not named in CamelCase. Open
Open
class Vtiger_MassEditRecordStructure_Model extends Vtiger_EditRecordStructure_Model
{
/** {@inheritdoc} */
public function getStructure()
{
- 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
Open
*
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* @params Field Model
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
if ('image' == $fieldModel->getFieldDataType()) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* @param mixed $fieldModel
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* @returns boolean true or false
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
return true;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
public function isFieldRestricted($fieldModel)
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
return false;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$values[$blockLabel][$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
$values = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
foreach ($blockModel->getFields() as $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
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return $this->structuredValues;
- 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 getStructure()
- 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
$moduleModel = $this->getModule();
- 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
foreach ($blockModelList as $blockLabel => $blockModel) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$blockModelList = $moduleModel->getBlocks();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$recordExists = !empty($recordModel);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$fieldModel->set('fieldvalue', $recordModel->get($fieldName));
- 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 $values;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
if ($recordExists) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
if ($fieldModel->isEditable() && $fieldModel->isMassEditable() && $fieldModel->isViewable() && $this->isFieldRestricted($fieldModel)) {
- Exclude checks
Line exceeds 120 characters; contains 151 characters Open
Open
if ($fieldModel->isEditable() && $fieldModel->isMassEditable() && $fieldModel->isViewable() && $this->isFieldRestricted($fieldModel)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$this->structuredValues = $values;
- 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
* @params Field Model
- 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 (!empty($this->structuredValues)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$recordModel = $this->getRecord();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* Function that return Field Restricted are not.
- Exclude checks
Class name "Vtiger_MassEditRecordStructure_Model" is not in camel caps format Open
Open
class Vtiger_MassEditRecordStructure_Model extends Vtiger_EditRecordStructure_Model
- Exclude checks