YetiForceCompany/YetiForceCRM

View on GitHub
app/Controller/ModalSettings.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

Avoid using static access to class '\App\Language' in method 'getPageTitle'.
Open

            $pageTitle = \App\Language::translate($this->pageTitle, $moduleName);
Severity: Minor
Found in app/Controller/ModalSettings.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 '\App\Language' in method 'getPageTitle'.
Open

            $pageTitle = \App\Language::translate($request->getModule(), $moduleName);
Severity: Minor
Found in app/Controller/ModalSettings.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 getPageTitle uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $pageTitle = \App\Language::translate($request->getModule(), $moduleName);
        }
Severity: Minor
Found in app/Controller/ModalSettings.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

Class extends undeclared class \App\Controller\Modal
Open

abstract class ModalSettings extends Modal
Severity: Critical
Found in app/Controller/ModalSettings.php by phan

Call to undeclared method \App\Controller\ModalSettings::checkAndConvertCssStyles
Open

        return $this->checkAndConvertCssStyles([
Severity: Critical
Found in app/Controller/ModalSettings.php by phan

Reference to undeclared property \App\Controller\ModalSettings->pageTitle
Open

        if (isset($this->pageTitle)) {
Severity: Minor
Found in app/Controller/ModalSettings.php by phan

Call to undeclared method \App\Controller\ModalSettings::checkAndConvertJsScripts
Open

        return $this->checkAndConvertJsScripts([
Severity: Critical
Found in app/Controller/ModalSettings.php by phan

Reference to undeclared property \App\Controller\ModalSettings->pageTitle
Open

            $pageTitle = \App\Language::translate($this->pageTitle, $moduleName);
Severity: Minor
Found in app/Controller/ModalSettings.php by phan

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

     * Get modal scripts files that need to loaded in the modal.

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

        $viewName = $request->getByType('view', 2);

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

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

     * @param \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

     *

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

            "modules.Settings.{$request->getModule()}.resources.$viewName",

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

     * Get modal css files that need to loaded in the modal.

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

        return $this->checkAndConvertCssStyles([

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

        }

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

            "modules.Settings.Vtiger.resources.$viewName",

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

     */

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

     */

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

            "modules.Settings.Vtiger.$viewName",

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

        return $this->checkAndConvertJsScripts([

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

    }

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

    use Traits\SettingsPermission;

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

     * @return \Vtiger_CssScript_Model[]

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

        $viewName = $request->getByType('view', 2);

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 getPageTitle(\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 (isset($this->pageTitle)) {

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

        return $pageTitle;

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

    public function getModalScripts(\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

    public function getModalCss(\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

            $pageTitle = \App\Language::translate($request->getModule(), $moduleName);

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

     * @return \Vtiger_JsScript_Model[]

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

     *

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

            "modules.Settings.{$request->getModule()}.$viewName",

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

            $pageTitle = \App\Language::translate($this->pageTitle, $moduleName);

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

    /**

There are no issues that match your filters.

Category
Status