YetiForceCompany/YetiForceCRM

View on GitHub
modules/OSSMailScanner/crons/Action.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

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

        $recordModel = Vtiger_Record_Model::getCleanInstance('OSSMailScanner');

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

Reference to undeclared property \Users_Record_Model->user_name (Did you mean $user_name)
Open

            $user_name = Users_Record_Model::getCurrentUserModel()->user_name;

Call to undeclared method \Vtiger_Record_Model::executeCron
Open

        $recordModel->executeCron(PHP_SAPI . ' - ' . $user_name);
Severity: Critical
Found in modules/OSSMailScanner/crons/Action.php by phan

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

class OSSMailScanner_Action_Cron extends \App\CronHandler

The class OSSMailScanner_Action_Cron is not named in CamelCase.
Open

class OSSMailScanner_Action_Cron extends \App\CronHandler
{
    /** {@inheritdoc} */
    public function process()
    {

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 (PHP_SAPI == 'cgi-fcgi') {

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()

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

    {

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

        $recordModel = Vtiger_Record_Model::getCleanInstance('OSSMailScanner');

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

        $user_name = '';

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

            $user_name = Users_Record_Model::getCurrentUserModel()->user_name;

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

        $recordModel->executeCron(PHP_SAPI . ' - ' . $user_name);

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

class OSSMailScanner_Action_Cron extends \App\CronHandler

The variable $user_name is not named in camelCase.
Open

    public function process()
    {
        $recordModel = Vtiger_Record_Model::getCleanInstance('OSSMailScanner');
        $user_name = '';
        if (PHP_SAPI == 'cgi-fcgi') {

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $user_name is not named in camelCase.
Open

    public function process()
    {
        $recordModel = Vtiger_Record_Model::getCleanInstance('OSSMailScanner');
        $user_name = '';
        if (PHP_SAPI == 'cgi-fcgi') {

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $user_name is not named in camelCase.
Open

    public function process()
    {
        $recordModel = Vtiger_Record_Model::getCleanInstance('OSSMailScanner');
        $user_name = '';
        if (PHP_SAPI == 'cgi-fcgi') {

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

There are no issues that match your filters.

Category
Status