YetiForceCompany/YetiForceCRM

View on GitHub
modules/Settings/Dependencies/views/LibraryLicense.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

Avoid unused parameters such as '$request'.
Open

    public function getSize(App\Request $request)

UnusedFormalParameter

Since: 0.2

Avoid passing parameters to methods or constructors and then not using those parameters.

Example

class Foo
{
    private function bar($howdy)
    {
        // $howdy is not used
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('QUALIFIED_MODULE', $qualifiedModuleName);

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('FILE_CONTENT', $fileContent);

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('FILE_EXIST', $result);

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 {
            $dir = ROOT_DIRECTORY . DIRECTORY_SEPARATOR . 'licenses' . DIRECTORY_SEPARATOR;
            $filePath = $dir . $request->getByType('license', 'Text') . '.txt';
            if (file_exists($filePath)) {
                $result = true;

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

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 {
                $result = false;
            }

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 excessively long class names like Settings_Dependencies_LibraryLicense_View. Keep class name length under 40.
Open

class Settings_Dependencies_LibraryLicense_View extends Settings_Vtiger_BasicModal_View
{
    /**
     * Function get modal size.
     *

LongClassName

Since: 2.9

Detects when classes or interfaces are declared with excessively long names.

Example

class ATooLongClassNameThatHintsAtADesignProblem {

}

interface ATooLongInterfaceNameThatHintsAtADesignProblem {

}

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

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

class Settings_Dependencies_LibraryLicense_View extends Settings_Vtiger_BasicModal_View

The class Settings_Dependencies_LibraryLicense_View is not named in CamelCase.
Open

class Settings_Dependencies_LibraryLicense_View extends Settings_Vtiger_BasicModal_View
{
    /**
     * Function get modal size.
     *

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

     * @return string

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

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

     * Process function.

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

            } else {

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

     *

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

            $filePath = $dir . $request->getByType('license', 'Text') . '.txt';

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

        $viewer->view('LibraryLicense.tpl', $qualifiedModuleName);

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 getSize(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

            if (file_exists($filePath)) {

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

     * @param \App\Request $request

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

        return 'modal-lg';

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

     *

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

        $fileContent = '';

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

        if ($request->isEmpty('license')) {

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

            $dir = ROOT_DIRECTORY . DIRECTORY_SEPARATOR . 'licenses' . DIRECTORY_SEPARATOR;

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

        }

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

        $this->preProcess($request);

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

    }

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

                $fileContent = file_get_contents($filePath);

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

     * Function get modal size.

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

                $result = false;

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

                $result = true;

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

        $this->postProcess($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

        $viewer->assign('FILE_CONTENT', $fileContent);

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

        $result = false;

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

        $viewer->assign('QUALIFIED_MODULE', $qualifiedModuleName);

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

        $viewer->assign('FILE_EXIST', $result);

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

class Settings_Dependencies_LibraryLicense_View extends Settings_Vtiger_BasicModal_View

There are no issues that match your filters.

Category
Status