YetiForceCompany/YetiForceCRM

View on GitHub
modules/Settings/PublicHoliday/views/Configuration.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

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

        $moduleModel = Settings_PublicHoliday_Module_Model::getInstance();

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\Fields\Date' in method 'list'.
Open

        $viewer->assign('DATE', $date ? implode(',', App\Fields\Date::formatRangeToDisplay($date)) : '');

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 assigning values to variables in if clauses and the like (line '27', column '7').
Open

    public function process(App\Request $request)
    {
        if ($mode = $request->getMode()) {
            $this->invokeExposedMethod($mode, $request);
            return;

IfStatementAssignment

Since: 2.7.0

Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

Example

class Foo
{
    public function bar($flag)
    {
        if ($foo = 'bar') { // possible typo
            // ...
        }
        if ($baz = 0) { // always false
            // ...
        }
    }
}

Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

Avoid using static access to class 'Settings_PublicHoliday_Module_Model' in method 'list'.
Open

        $moduleModel = Settings_PublicHoliday_Module_Model::getInstance();

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('DATE', $date ? implode(',', App\Fields\Date::formatRangeToDisplay($date)) : '');

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('HOLIDAYS', $moduleModel->getHolidaysByRange([]));

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('YEAR', date('Y'));

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('DATE', '');

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('HOLIDAYS', $moduleModel->getHolidaysByRange($date));

Avoid excessively long class names like Settings_PublicHoliday_Configuration_View. Keep class name length under 40.
Open

class Settings_PublicHoliday_Configuration_View extends Settings_Vtiger_Index_View
{
    /**
     * Constructor.
     */

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_PublicHoliday_Configuration_View extends Settings_Vtiger_Index_View

The class Settings_PublicHoliday_Configuration_View is not named in CamelCase.
Open

class Settings_PublicHoliday_Configuration_View extends Settings_Vtiger_Index_View
{
    /**
     * Constructor.
     */

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

    /** {@inheritdoc} */

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->view('Configuration.tpl', $request->getModule(false));

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

    public function __construct()

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

            return;

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

        $viewer->assign('HOLIDAYS', $moduleModel->getHolidaysByRange([]));

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()}.{$view}",

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 getHeaderCss(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 list(App\Request $request): void

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

        if ($mode = $request->getMode()) {

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

        $viewer->assign('DATE', '');

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 = $this->getViewer($request);

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

     * Constructor.

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

        $viewer->view('ConfigurationItems.tpl', $request->getModule(false));

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

        parent::__construct();

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

        $viewer->assign('YEAR', date('Y'));

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

     * Returns view for holiday item list by date filtering.

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

    {

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->exposeMethod('list');

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

        $moduleModel = Settings_PublicHoliday_Module_Model::getInstance();

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

        $date = !$request->isEmpty('date', true) ? $request->getDateRange('date') : [];

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

        $viewer = $this->getViewer($request);

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

        $viewer->assign('DATE', $date ? implode(',', App\Fields\Date::formatRangeToDisplay($date)) : '');

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

        $moduleModel = Settings_PublicHoliday_Module_Model::getInstance();

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->invokeExposedMethod($mode, $request);

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

        $viewer->assign('HOLIDAYS', $moduleModel->getHolidaysByRange($date));

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

        return array_merge(parent::getHeaderCss($request), $this->checkAndConvertCssStyles([

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

     * Process.

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

        $view = $request->get('view', App\Purifier::STANDARD);

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

class Settings_PublicHoliday_Configuration_View extends Settings_Vtiger_Index_View

There are no issues that match your filters.

Category
Status