YetiForceCompany/YetiForceCRM

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

Summary

Maintainability
A
1 hr
Test Coverage
F
0%

Method process has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function process(App\Request $request)
    {
        $moduleName = $request->getModule();
        $viewer = $this->getViewer($request);
        $qualifiedModuleName = $request->getModule(false);
Severity: Minor
Found in modules/Settings/LangManagement/views/Edit.php - About 1 hr to fix

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

            $viewer->assign('LANGS', App\Language::getAll());

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

            $moduleModel = Settings_LangManagement_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

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('MODULE', $moduleName);

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('CUSTOM_DATA', $moduleModel->loadCustomLanguageFile($lang, $mod));

    Call to undeclared method \Vtiger_Viewer::assign
    Open

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

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('SD', $showDifferences);

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('MODS', $mods);

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('DATA', $data);

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('SELECTED_LANGS', $lang);

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('SELECTED_MODE', $mod);

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('MODULE_MODEL', $moduleModel);

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('LANGS', App\Language::getAll());

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

    class Settings_LangManagement_Edit_View extends Settings_Vtiger_Index_View

    The class Settings_LangManagement_Edit_View is not named in CamelCase.
    Open

    class Settings_LangManagement_Edit_View extends Settings_Vtiger_Index_View
    {
        use App\Controller\ClearProcess;
    
        /**

    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

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

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

            unset($mods['mods']['HelpInfo']);

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

            $lang = $request->getByType('lang', 1);

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

            $showDifferences = $request->getInteger('sd');

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

            $viewer->assign('MODULE', $moduleName);

    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

            $viewer->assign('SD', $showDifferences);

    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

        {

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

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

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

                $lang = [];

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

            $viewer->assign('MODULE_MODEL', $moduleModel);

    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

            $mod = $request->getByType('mod', 1);

    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

            $moduleName = $request->getModule();

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

            if (empty($lang)) {

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

            $viewer->assign('DATA', $data);

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

            if (!empty($lang) && !empty($mod)) {

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

            $viewer->assign('SELECTED_LANGS', $lang);

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

            $viewer->assign('CUSTOM_DATA', $moduleModel->loadCustomLanguageFile($lang, $mod));

    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('LANGS', App\Language::getAll());

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

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

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

            $viewer->assign('MODS', $mods);

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

        use App\Controller\ClearProcess;

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

                $data = $moduleModel->loadLangTranslation($lang, $mod);

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

            $mods = $moduleModel->getModFromLang(reset($lang));

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

            }

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

            $data = null;

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

            $viewer->assign('SELECTED_MODE', $mod);

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

    class Settings_LangManagement_Edit_View extends Settings_Vtiger_Index_View

    There are no issues that match your filters.

    Category
    Status