YetiForceCompany/YetiForceCRM

View on GitHub
modules/Settings/Roles/actions/Delete.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

Avoid using static access to class 'Settings_Vtiger_Module_Model' in method 'process'.
Open

        $moduleModel = Settings_Vtiger_Module_Model::getInstance($qualifiedModuleName);

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

        $transferToRole = Settings_Roles_Record_Model::getInstanceById($transferRecordId);

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

        $recordModel = Settings_Roles_Record_Model::getInstanceById($recordId);

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 \Settings_Vtiger_Module_Model::getDefaultUrl
Open

        $redirectUrl = $moduleModel->getDefaultUrl();
Severity: Critical
Found in modules/Settings/Roles/actions/Delete.php by phan

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

class Settings_Roles_Delete_Action extends Settings_Vtiger_Basic_Action

The class Settings_Roles_Delete_Action is not named in CamelCase.
Open

class Settings_Roles_Delete_Action extends Settings_Vtiger_Basic_Action
{
    public function process(App\Request $request)
    {
        $qualifiedModuleName = $request->getModule(false);

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

        $redirectUrl = $moduleModel->getDefaultUrl();

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

    }

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

        $qualifiedModuleName = $request->getModule(false);

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

        $transferRecordId = $request->getByType('transfer_record', 'Alnum');

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

        }

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

        header("location: $redirectUrl");

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

            $recordModel->delete($transferToRole);

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

        $recordModel = Settings_Roles_Record_Model::getInstanceById($recordId);

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

    public function process(App\Request $request)

Line exceeds 120 characters; contains 176 characters
Open

        if ($recordModel && $transferToRole && $recordId != $transferRecordId && false === strpos($transferToRole->get('parentrole') . '::', $recordModel->get('parentrole'))) {

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

        $moduleModel = Settings_Vtiger_Module_Model::getInstance($qualifiedModuleName);

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

        if ($recordModel && $transferToRole && $recordId != $transferRecordId && false === strpos($transferToRole->get('parentrole') . '::', $recordModel->get('parentrole'))) {

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

        $transferToRole = Settings_Roles_Record_Model::getInstanceById($transferRecordId);

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

        $recordId = $request->getByType('record', 'Alnum');

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

class Settings_Roles_Delete_Action extends Settings_Vtiger_Basic_Action

There are no issues that match your filters.

Category
Status