YetiForceCompany/YetiForceCRM

View on GitHub
modules/Vtiger/models/MassEditRecordStructure.php

Summary

Maintainability
A
1 hr
Test Coverage
F
0%

Function getStructure has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function getStructure()
    {
        if (!empty($this->structuredValues)) {
            return $this->structuredValues;
        }
Severity: Minor
Found in modules/Vtiger/models/MassEditRecordStructure.php - About 1 hr to fix

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

     *  @returns boolean true or false

Each class must be in a namespace of at least one level (a top-level vendor name)
Open

class Vtiger_MassEditRecordStructure_Model extends Vtiger_EditRecordStructure_Model

The class Vtiger_MassEditRecordStructure_Model is not named in CamelCase.
Open

class Vtiger_MassEditRecordStructure_Model extends Vtiger_EditRecordStructure_Model
{
    /** {@inheritdoc} */
    public function getStructure()
    {

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

     *

Spaces must be used for alignment; tabs are not allowed
Open

     *     @params Field Model

Spaces must be used for alignment; tabs are not allowed
Open

        if ('image' == $fieldModel->getFieldDataType()) {

Spaces must be used for alignment; tabs are not allowed
Open

     * @param mixed $fieldModel

Spaces must be used for alignment; tabs are not allowed
Open

     *  @returns boolean true or false

Spaces must be used for alignment; tabs are not allowed
Open

        return true;

Spaces must be used for alignment; tabs are not allowed
Open

     */

Spaces must be used for alignment; tabs are not allowed
Open

        }

Spaces must be used for alignment; tabs are not allowed
Open

    }

Spaces must be used for alignment; tabs are not allowed
Open

    public function isFieldRestricted($fieldModel)

Spaces must be used for alignment; tabs are not allowed
Open

            return false;

Spaces must be used for alignment; tabs are not allowed
Open

    {

Spaces must be used to indent lines; tabs are not allowed
Open

                    $values[$blockLabel][$fieldName] = $fieldModel;

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

        $values = [];

Spaces must be used to indent lines; tabs are not allowed
Open

            foreach ($blockModel->getFields() as $fieldName => $fieldModel) {

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

    /** {@inheritdoc} */

Spaces must be used to indent lines; tabs are not allowed
Open

            return $this->structuredValues;

Spaces must be used to indent lines; tabs are not allowed
Open

            }

Spaces must be used to indent lines; tabs are not allowed
Open

    public function getStructure()

Spaces must be used to indent lines; tabs are not allowed
Open

                }

Spaces must be used to indent lines; tabs are not allowed
Open

        $moduleModel = $this->getModule();

Spaces must be used to indent lines; tabs are not allowed
Open

    {

Spaces must be used to indent lines; tabs are not allowed
Open

        }

Spaces must be used to indent lines; tabs are not allowed
Open

        foreach ($blockModelList as $blockLabel => $blockModel) {

Spaces must be used to indent lines; tabs are not allowed
Open

        $blockModelList = $moduleModel->getBlocks();

Spaces must be used to indent lines; tabs are not allowed
Open

        $recordExists = !empty($recordModel);

Spaces must be used to indent lines; tabs are not allowed
Open

                        $fieldModel->set('fieldvalue', $recordModel->get($fieldName));

Spaces must be used to indent lines; tabs are not allowed
Open

                    }

Spaces must be used to indent lines; tabs are not allowed
Open

        return $values;

Spaces must be used to indent lines; tabs are not allowed
Open

                    if ($recordExists) {

Spaces must be used to indent lines; tabs are not allowed
Open

                if ($fieldModel->isEditable() && $fieldModel->isMassEditable() && $fieldModel->isViewable() && $this->isFieldRestricted($fieldModel)) {

Line exceeds 120 characters; contains 151 characters
Open

                if ($fieldModel->isEditable() && $fieldModel->isMassEditable() && $fieldModel->isViewable() && $this->isFieldRestricted($fieldModel)) {

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->structuredValues = $values;

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

     *     @params Field Model

Spaces must be used to indent lines; tabs are not allowed
Open

        }

Spaces must be used to indent lines; tabs are not allowed
Open

        if (!empty($this->structuredValues)) {

Spaces must be used to indent lines; tabs are not allowed
Open

        $recordModel = $this->getRecord();

Spaces must be used to indent lines; tabs are not allowed
Open

     * Function that return Field Restricted are not.

Class name "Vtiger_MassEditRecordStructure_Model" is not in camel caps format
Open

class Vtiger_MassEditRecordStructure_Model extends Vtiger_EditRecordStructure_Model

There are no issues that match your filters.

Category
Status