YetiForceCompany/YetiForceCRM

View on GitHub
modules/Settings/MailSmtp/models/Module.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

Missing class import via use statement (line '39', column '15').
Open

        return (new \App\Db\Query())->select(['id', 'name'])->from('s_#__mail_smtp')->all(\App\Db::getInstance('admin'));

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

Avoid using static access to class '\App\Db' in method 'getSmtpNames'.
Open

        return (new \App\Db\Query())->select(['id', 'name'])->from('s_#__mail_smtp')->all(\App\Db::getInstance('admin'));

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 \App\Db\Query::select
Open

        return (new \App\Db\Query())->select(['id', 'name'])->from('s_#__mail_smtp')->all(\App\Db::getInstance('admin'));

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

class Settings_MailSmtp_Module_Model extends Settings_Vtiger_Module_Model

The class Settings_MailSmtp_Module_Model is not named in CamelCase.
Open

class Settings_MailSmtp_Module_Model extends Settings_Vtiger_Module_Model
{
    public $baseTable = 's_#__mail_smtp';
    public $baseIndex = 'id';
    public $listFields = ['name' => 'LBL_NAME', 'host' => 'LBL_HOST', 'port' => 'LBL_PORT', 'username' => 'LBL_USERNAME', 'from_email' => 'LBL_FROM_EMAIL', 'default' => 'LBL_DEFAULT'];

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

     * Function to get the url for create view of the module.

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

    public $baseTable = 's_#__mail_smtp';

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

     * Function to get the url for default view of the module.

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 static function getSmtpNames()

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

    public function getDefaultUrl()

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

        return 'index.php?module=MailSmtp&parent=Settings&view=List';

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

        return 'index.php?module=MailSmtp&parent=Settings&view=Edit';

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 $listFields = ['name' => 'LBL_NAME', 'host' => 'LBL_HOST', 'port' => 'LBL_PORT', 'username' => 'LBL_USERNAME', 'from_email' => 'LBL_FROM_EMAIL', 'default' => 'LBL_DEFAULT'];

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

     * @return string URL

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

        return (new \App\Db\Query())->select(['id', 'name'])->from('s_#__mail_smtp')->all(\App\Db::getInstance('admin'));

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 $baseIndex = 'id';

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

    public $name = 'MailSmtp';

Line exceeds 120 characters; contains 121 characters
Open

        return (new \App\Db\Query())->select(['id', 'name'])->from('s_#__mail_smtp')->all(\App\Db::getInstance('admin'));

Line exceeds 120 characters; contains 184 characters
Open

    public $listFields = ['name' => 'LBL_NAME', 'host' => 'LBL_HOST', 'port' => 'LBL_PORT', 'username' => 'LBL_USERNAME', 'from_email' => 'LBL_FROM_EMAIL', 'default' => 'LBL_DEFAULT'];

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

    public function getCreateRecordUrl()

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

     * @return string URL

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

     */

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

class Settings_MailSmtp_Module_Model extends Settings_Vtiger_Module_Model

There are no issues that match your filters.

Category
Status