YetiForceCompany/YetiForceCRM

View on GitHub
modules/SMSNotifier/models/Record.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

Avoid using static access to class '\App\Integrations\SMSProvider' in method 'send'.
Open

        if ($this->isEditable() && ($provider = \App\Integrations\SMSProvider::getDefaultProvider())) {
Severity: Minor
Found in modules/SMSNotifier/models/Record.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 assigning values to variables in if clauses and the like (line '23', column '31').
Open

    public function send(): bool
    {
        $result = false;
        if ($this->isEditable() && ($provider = \App\Integrations\SMSProvider::getDefaultProvider())) {
            $result = $provider->sendByRecord($this);
Severity: Minor
Found in modules/SMSNotifier/models/Record.php by phpmd

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

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

class SMSNotifier_Record_Model extends Vtiger_Record_Model

The class SMSNotifier_Record_Model is not named in CamelCase.
Open

class SMSNotifier_Record_Model extends Vtiger_Record_Model
{
    /**
     * Send sms.
     *
Severity: Minor
Found in modules/SMSNotifier/models/Record.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

            $this->save();

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 $result;

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

    }

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

            $result = $provider->sendByRecord($this);

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

     * Send sms.

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

     * @return bool

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 send(): bool

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 ($this->isEditable() && ($provider = \App\Integrations\SMSProvider::getDefaultProvider())) {

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

            $this->set('smsnotifier_status', $result ? 'PLL_SENT' : 'PLL_FAILED');

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

    /**

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

        $result = false;

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

class SMSNotifier_Record_Model extends Vtiger_Record_Model

There are no issues that match your filters.

Category
Status