YetiForceCompany/YetiForceCRM

View on GitHub
modules/Vtiger/views/ChangeRelationData.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

Missing class import via use statement (line '26', 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 '\Vtiger_RelationListView_Model' in method 'process'.
Open

        $relationView = \Vtiger_RelationListView_Model::getInstance($parentRecord, $moduleName, $relationId, $cvId);

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\Language' in method 'getPageTitle'.
Open

        return \App\Language::translate('LBL_CHANGE_RELATION_DATA', $request->getModule());

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

        $parentRecord = \Vtiger_Record_Model::getInstanceById($parentRecordId);

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

        $recordModel = 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

Class extends undeclared class \App\Controller\Modal
Open

class Vtiger_ChangeRelationData_View extends \App\Controller\Modal

Call to undeclared method \App\Relation\RelationAbstraction::getFields
Open

        foreach ($relationModel->getFields(true) as $fieldModel) {

Call to undeclared method \Vtiger_ChangeRelationData_View::getViewer
Open

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

Call to undeclared method \App\Relation\RelationAbstraction::getRelationData
Open

        $data = $relationModel->getRelationData($parentRecordId, $recordId);

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

class Vtiger_ChangeRelationData_View extends \App\Controller\Modal

The class Vtiger_ChangeRelationData_View is not named in CamelCase.
Open

class Vtiger_ChangeRelationData_View extends \App\Controller\Modal
{
    /** {@inheritdoc} */
    public $modalSize = '';

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

     */

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

        $parentRecordId = $request->getInteger('fromRecord');

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

        if (!$recordModel->isEditable() || !Vtiger_Record_Model::getInstanceById($request->getInteger('fromRecord'))->isEditable()) {

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

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

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

        $viewer->view('Modals/ChangeRelationData.tpl', $moduleName);

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

     * @param \App\Request $request

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

    {

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

        $recordId = $request->getInteger('record');

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

        $fieldModels = [];

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

            $fieldModels[$fieldModel->getName()] = $fieldModel;

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

        return \App\Language::translate('LBL_CHANGE_RELATION_DATA', $request->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

    public $modalSize = '';

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

    /** {@inheritdoc} */

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

     * Process.

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

        $viewer->assign('FIELDS', $fieldModels);

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

        $relationId = $request->getInteger('relationId');

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

        }

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

            $fieldModel->set('fieldvalue', $data[$fieldModel->getName()] ?? '');

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

        $viewer->assign('RELATION_ID', $relationId);

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

    public function process(App\Request $request)

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

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

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

        $parentRecord = \Vtiger_Record_Model::getInstanceById($parentRecordId);

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

    public function getPageTitle(App\Request $request)

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

    /**

Line exceeds 120 characters; contains 133 characters
Open

        if (!$recordModel->isEditable() || !Vtiger_Record_Model::getInstanceById($request->getInteger('fromRecord'))->isEditable()) {

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

        $relationModel = $relationView->getRelationModel()->getTypeRelationModel();

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

        $viewer->assign('RECORD', $recordId);

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

    }

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

        $cvId = $request->isEmpty('cvId', true) ? 0 : $request->getByType('cvId', 'Alnum');

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

        $viewer->assign('FROM_RECORD', $parentRecord->getId());

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

        $relationView = \Vtiger_RelationListView_Model::getInstance($parentRecord, $moduleName, $relationId, $cvId);

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

        foreach ($relationModel->getFields(true) as $fieldModel) {

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

        $data = $relationModel->getRelationData($parentRecordId, $recordId);

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

class Vtiger_ChangeRelationData_View extends \App\Controller\Modal

There are no issues that match your filters.

Category
Status