YetiForceCompany/YetiForceCRM

View on GitHub
modules/Calendar/views/QuickEditAjax.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

Missing class import via use statement (line '23', column '14').
Open

            throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);

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

Avoid using static access to class '\App\Json' in method 'process'.
Open

        $viewer->assign('LIST_FILTER_FIELDS', \App\Json::encode(\App\ModuleHierarchy::getFieldsForListFilter($moduleName)));

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 '\App\Json' in method 'process'.
Open

        $viewer->assign('MAPPING_RELATED_FIELD', \App\Json::encode(\App\ModuleHierarchy::getRelationFieldByHierarchy($moduleName)));

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 '\App\ModuleHierarchy' in method 'process'.
Open

        $viewer->assign('MAPPING_RELATED_FIELD', \App\Json::encode(\App\ModuleHierarchy::getRelationFieldByHierarchy($moduleName)));

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_RecordStructure_Model' in method 'process'.
Open

        $recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceFromRecordModel($this->record, Vtiger_RecordStructure_Model::RECORD_STRUCTURE_MODE_QUICKCREATE);

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_Record_Model' in method 'checkPermission'.
Open

        $this->record = Vtiger_Record_Model::getInstanceById($request->getInteger('record'));

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 '\App\ModuleHierarchy' in method 'process'.
Open

        $viewer->assign('LIST_FILTER_FIELDS', \App\Json::encode(\App\ModuleHierarchy::getFieldsForListFilter($moduleName)));

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

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('RECORD_STRUCTURE_MODEL', $recordStructureInstance);
Severity: Critical
Found in modules/Calendar/views/QuickEditAjax.php by phan

Call to undeclared method \Calendar_QuickCreateAjax_View::getId
Open

        $viewer->assign('RECORD_ID', $this->record->getId());
Severity: Critical
Found in modules/Calendar/views/QuickEditAjax.php by phan

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('MODULE', $moduleName);
Severity: Critical
Found in modules/Calendar/views/QuickEditAjax.php by phan

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('RECORD_ID', $this->record->getId());
Severity: Critical
Found in modules/Calendar/views/QuickEditAjax.php by phan

Assigning \Vtiger_Record_Model to property but \Calendar_QuickEditAjax_View->record is \Calendar_QuickCreateAjax_View
Open

        $this->record = Vtiger_Record_Model::getInstanceById($request->getInteger('record'));

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('QUICKCREATE_LINKS', Vtiger_QuickCreateView_Model::getInstance($moduleName)->getLinks([]));
Severity: Critical
Found in modules/Calendar/views/QuickEditAjax.php by phan

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('MAPPING_RELATED_FIELD', \App\Json::encode(\App\ModuleHierarchy::getRelationFieldByHierarchy($moduleName)));
Severity: Critical
Found in modules/Calendar/views/QuickEditAjax.php by phan

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('LIST_FILTER_FIELDS', \App\Json::encode(\App\ModuleHierarchy::getFieldsForListFilter($moduleName)));
Severity: Critical
Found in modules/Calendar/views/QuickEditAjax.php by phan

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('SCRIPTS', $this->getFooterScripts($request));
Severity: Critical
Found in modules/Calendar/views/QuickEditAjax.php by phan

Call to undeclared method \Calendar_QuickCreateAjax_View::getName
Open

        return $this->record->getName();
Severity: Critical
Found in modules/Calendar/views/QuickEditAjax.php by phan

Argument 1 (recordModel) is \App\Controller\Base|\App\Controller\ClearProcess|\App\Controller\ExposeMethod|\App\Controller\View\Base|\App\Controller\View\Page|\Calendar_QuickCreateAjax_View|\Vtiger_IndexAjax_View|\Vtiger_Index_View|\Vtiger_QuickCreateAjax_View but \Vtiger_RecordStructure_Model::getInstanceFromRecordModel() takes \Vtiger_Record_Model defined at /code/modules/Vtiger/models/RecordStructure.php:118
Open

        $recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceFromRecordModel($this->record, Vtiger_RecordStructure_Model::RECORD_STRUCTURE_MODE_QUICKCREATE);

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('VIEW', $request->getByType('view'));
Severity: Critical
Found in modules/Calendar/views/QuickEditAjax.php by phan

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('RECORD_STRUCTURE', $recordStructure);
Severity: Critical
Found in modules/Calendar/views/QuickEditAjax.php by phan

Call to undeclared method \Calendar_QuickCreateAjax_View::isEditable
Open

        if (!$this->record->isEditable()) {
Severity: Critical
Found in modules/Calendar/views/QuickEditAjax.php by phan

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('RECORD', $this->record);
Severity: Critical
Found in modules/Calendar/views/QuickEditAjax.php by phan

Avoid excessively long variable names like $recordStructureInstance. Keep variable name length under 20.
Open

        $recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceFromRecordModel($this->record, Vtiger_RecordStructure_Model::RECORD_STRUCTURE_MODE_QUICKCREATE);

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

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

class Calendar_QuickEditAjax_View extends Calendar_QuickCreateAjax_View

The class Calendar_QuickEditAjax_View is not named in CamelCase.
Open

class Calendar_QuickEditAjax_View extends Calendar_QuickCreateAjax_View
{
    /** {@inheritdoc} */
    public function checkPermission(App\Request $request)
    {

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

    public function getPageTitle(App\Request $request)

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

        $viewer->assign('SCRIPTS', $this->getFooterScripts($request));

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

            throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);

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

    }

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

        $moduleName = $request->getModule();

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

        $recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceFromRecordModel($this->record, Vtiger_RecordStructure_Model::RECORD_STRUCTURE_MODE_QUICKCREATE);

Line exceeds 120 characters; contains 172 characters
Open

        $recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceFromRecordModel($this->record, Vtiger_RecordStructure_Model::RECORD_STRUCTURE_MODE_QUICKCREATE);

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

        $viewer->assign('QUICKCREATE_LINKS', Vtiger_QuickCreateView_Model::getInstance($moduleName)->getLinks([]));

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

        $viewer->assign('MODULE', $moduleName);

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

        $viewer->assign('MAPPING_RELATED_FIELD', \App\Json::encode(\App\ModuleHierarchy::getRelationFieldByHierarchy($moduleName)));

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

        $viewer->assign('RECORD_STRUCTURE_MODEL', $recordStructureInstance);

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

    {

Line exceeds 120 characters; contains 124 characters
Open

        $viewer->assign('LIST_FILTER_FIELDS', \App\Json::encode(\App\ModuleHierarchy::getFieldsForListFilter($moduleName)));

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

        return $this->record->getName();

Line exceeds 120 characters; contains 132 characters
Open

        $viewer->assign('MAPPING_RELATED_FIELD', \App\Json::encode(\App\ModuleHierarchy::getRelationFieldByHierarchy($moduleName)));

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

        if (!$this->record->isEditable()) {

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 process(App\Request $request)

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

        $viewer = $this->getViewer($request);

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

        $recordStructure = $recordStructureInstance->getStructure();

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

        $viewer->assign('LIST_FILTER_FIELDS', \App\Json::encode(\App\ModuleHierarchy::getFieldsForListFilter($moduleName)));

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

        $viewer->assign('RECORD_STRUCTURE', $recordStructure);

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

    {

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

        $viewer->assign('VIEW', $request->getByType('view'));

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

    public function checkPermission(App\Request $request)

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

        $this->record = Vtiger_Record_Model::getInstanceById($request->getInteger('record'));

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

        $viewer->assign('RECORD', $this->record);

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

        $viewer->assign('RECORD_ID', $this->record->getId());

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

    }

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

class Calendar_QuickEditAjax_View extends Calendar_QuickCreateAjax_View

There are no issues that match your filters.

Category
Status