YetiForceCompany/YetiForceCRM

View on GitHub
modules/OSSMailView/views/Widget.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();
        $srecord = $request->getInteger('srecord');
        $smodule = $request->getByType('smodule');
Severity: Minor
Found in modules/OSSMailView/views/Widget.php - About 1 hr to fix

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

                throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);
    Severity: Minor
    Found in modules/OSSMailView/views/Widget.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

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

                throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406);
    Severity: Minor
    Found in modules/OSSMailView/views/Widget.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

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

                throw new \App\Exceptions\AppException("ERR_RELATION_NOT_FOUND||$smodule||$moduleName", 400);
    Severity: Minor
    Found in modules/OSSMailView/views/Widget.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

    The method preProcess has a boolean flag argument $display, which is a certain sign of a Single Responsibility Principle violation.
    Open

        public function preProcess(App\Request $request, $display = true)
    Severity: Minor
    Found in modules/OSSMailView/views/Widget.php by phpmd

    BooleanArgumentFlag

    Since: 1.4.0

    A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

    Example

    class Foo {
        public function bar($flag = true) {
        }
    }

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

    Avoid using static access to class '\App\Privilege' in method 'checkPermission'.
    Open

            if (!\App\Privilege::isPermitted($request->getByType('smodule'), 'DetailView', $request->getInteger('srecord'))) {
    Severity: Minor
    Found in modules/OSSMailView/views/Widget.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 'OSSMail_Module_Model' in method 'process'.
    Open

            $config = OSSMail_Module_Model::getComposeParameters();
    Severity: Minor
    Found in modules/OSSMailView/views/Widget.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\Relation' in method 'process'.
    Open

            $relation = \App\Relation::getRelationId($smodule, $moduleName);
    Severity: Minor
    Found in modules/OSSMailView/views/Widget.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

    Argument 1 (mixed) is string but \Users_Privileges_Model::hasModulePermission() takes int defined at /code/modules/Users/models/Privileges.php:101
    Open

            if (!Users_Privileges_Model::getCurrentUserPrivilegesModel()->hasModulePermission($request->getModule())) {
    Severity: Minor
    Found in modules/OSSMailView/views/Widget.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('SMODULENAME', $smodule);
    Severity: Critical
    Found in modules/OSSMailView/views/Widget.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('RECORD', $record);
    Severity: Critical
    Found in modules/OSSMailView/views/Widget.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('MODULENAME', $moduleName);
    Severity: Critical
    Found in modules/OSSMailView/views/Widget.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('SRECORD', $srecord);
    Severity: Critical
    Found in modules/OSSMailView/views/Widget.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('RECOLDLIST', $recordModel->{$mode}($srecord, $smodule, $config, $type, $mailFilter));
    Severity: Critical
    Found in modules/OSSMailView/views/Widget.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('POPUP', $config['popup']);
    Severity: Critical
    Found in modules/OSSMailView/views/Widget.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('RELATION_MODEL', $relationModel);
    Severity: Critical
    Found in modules/OSSMailView/views/Widget.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('TYPE', $type);
    Severity: Critical
    Found in modules/OSSMailView/views/Widget.php by phan

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

    class OSSMailView_Widget_View extends Vtiger_Edit_View

    The class OSSMailView_Widget_View is not named in CamelCase.
    Open

    class OSSMailView_Widget_View extends Vtiger_Edit_View
    {
        /** {@inheritdoc} */
        public function checkPermission(App\Request $request)
        {
    Severity: Minor
    Found in modules/OSSMailView/views/Widget.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

            if (!\App\Privilege::isPermitted($request->getByType('smodule'), 'DetailView', $request->getInteger('srecord'))) {

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

                throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);

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

        {

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

                $config['widget_limit'] = $request->getInteger('limit');

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

            $viewer->assign('TYPE', $type);

    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

        public function preProcess(App\Request $request, $display = true)

    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

            $mode = $request->getMode();

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

            $record = $request->getInteger('record');

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

            $recordModel = Vtiger_Record_Model::getCleanInstance($moduleName)->setId($srecord);

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

            $viewer->assign('RELATION_MODEL', $relationModel);

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

            $viewer->assign('SMODULENAME', $smodule);

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

            $viewer->assign('POPUP', $config['popup']);

    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

            $smodule = $request->getByType('smodule');

    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('SRECORD', $srecord);

    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

            $viewer->view('widgets.tpl', 'OSSMailView');

    Line exceeds 120 characters; contains 122 characters
    Open

            if (!\App\Privilege::isPermitted($request->getByType('smodule'), 'DetailView', $request->getInteger('srecord'))) {

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

            $srecord = $request->getInteger('srecord');

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

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

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

        }

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

            $relationModel = \Vtiger_Relation_Model::getInstanceById($relation)->set('parentRecord', $recordModel);

    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 (!$relation) {

    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 (!Users_Privileges_Model::getCurrentUserPrivilegesModel()->hasModulePermission($request->getModule())) {

    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

            $config = OSSMail_Module_Model::getComposeParameters();

    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 process(App\Request $request)

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

            if ($request->has('limit')) {

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

            $relation = \App\Relation::getRelationId($smodule, $moduleName);

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

                throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406);

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

            $viewer->assign('RECOLDLIST', $recordModel->{$mode}($srecord, $smodule, $config, $type, $mailFilter));

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

            $viewer->assign('MODULENAME', $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

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

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

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

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

                throw new \App\Exceptions\AppException("ERR_RELATION_NOT_FOUND||$smodule||$moduleName", 400);

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

    class OSSMailView_Widget_View extends Vtiger_Edit_View

    There are no issues that match your filters.

    Category
    Status