YetiForceCompany/YetiForceCRM

View on GitHub
modules/Settings/Wapro/views/Edit.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

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

            throw new \App\Exceptions\NoPermittedForAdmin('LBL_PERMISSION_DENIED');
Severity: Minor
Found in modules/Settings/Wapro/views/Edit.php by phpmd

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\YetiForce\Register' in method 'checkPermission'.
Open

        if (!\App\YetiForce\Register::getProduct('YetiForceWaproERP')) {
Severity: Minor
Found in modules/Settings/Wapro/views/Edit.php by phpmd

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

The method process uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $recordModel = Settings_Wapro_Record_Model::getCleanInstance();
        }
Severity: Minor
Found in modules/Settings/Wapro/views/Edit.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

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

            $recordModel = Settings_Wapro_Record_Model::getInstanceById($record);
Severity: Minor
Found in modules/Settings/Wapro/views/Edit.php by phpmd

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

            $recordModel = Settings_Wapro_Record_Model::getCleanInstance();
Severity: Minor
Found in modules/Settings/Wapro/views/Edit.php by phpmd

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 method getProduct from undeclared class \App\YetiForce\Register
Open

        if (!\App\YetiForce\Register::getProduct('YetiForceWaproERP')) {
Severity: Critical
Found in modules/Settings/Wapro/views/Edit.php by phan

Call to undeclared method \Settings_Wapro_Edit_View::getViewer
Open

        $viewer = $this->getViewer($request);
Severity: Critical
Found in modules/Settings/Wapro/views/Edit.php by phan

Reference to undeclared property \Settings_Wapro_Edit_View->successBtnIcon
Open

        $viewer->assign('BTN_SUCCESS_ICON', $this->successBtnIcon);
Severity: Minor
Found in modules/Settings/Wapro/views/Edit.php by phan

Reference to undeclared property \Settings_Wapro_Edit_View->dangerBtn
Open

        $viewer->assign('BTN_DANGER', $this->dangerBtn);
Severity: Minor
Found in modules/Settings/Wapro/views/Edit.php by phan

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

class Settings_Wapro_Edit_View extends \App\Controller\ModalSettings

The class Settings_Wapro_Edit_View is not named in CamelCase.
Open

class Settings_Wapro_Edit_View extends \App\Controller\ModalSettings
{
    /** {@inheritdoc} */
    public $showFooter = false;

Severity: Minor
Found in modules/Settings/Wapro/views/Edit.php by phpmd

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

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

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

        $viewer->assign('BTN_DANGER', $this->dangerBtn);

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

            $recordModel = Settings_Wapro_Record_Model::getInstanceById($record);

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

        $viewer->view('Edit/Modal.tpl', $request->getModule(false));

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

        $viewer = $this->getViewer($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

        }

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

        $viewer->assign('BTN_SUCCESS_ICON', $this->successBtnIcon);

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

    public $showFooter = false;

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

    {

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

        } else {

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

        parent::checkPermission($request);

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

        $record = !$request->isEmpty('record') ? $request->getInteger('record') : '';

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

        if ($record) {

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

            throw new \App\Exceptions\NoPermittedForAdmin('LBL_PERMISSION_DENIED');

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->assign('RECORD_MODEL', $recordModel);

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

    public $successBtn = 'LBL_SAVE_AND_VERIFY';

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

        if (!\App\YetiForce\Register::getProduct('YetiForceWaproERP')) {

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

            $recordModel = Settings_Wapro_Record_Model::getCleanInstance();

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

        $viewer->assign('MODULE_NAME', $request->getModule());

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

        $viewer->assign('BTN_SUCCESS', $this->successBtn);

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

    }

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

class Settings_Wapro_Edit_View extends \App\Controller\ModalSettings

There are no issues that match your filters.

Category
Status