src/Notifier/Engine/GamaSmsIr.php

Summary

Maintainability
A
0 mins
Test Coverage

Remove this hard-coded password.
Open

    const ENGINE_PARAMETER_PASSWORD = 'notifier.engine.GamaSmsIr.password';
Severity: Blocker
Found in src/Notifier/Engine/GamaSmsIr.php by sonar-php

Because it is easy to extract strings from a compiled application, credentials should never be hard-coded. Do so, and they're almost guaranteed to end up in the hands of an attacker. This is particularly true for applications that are distributed.

Credentials should be stored outside of the code in a strongly-protected encrypted configuration file or database.

Noncompliant Code Example

$uname = "steve";
$password = "blue";
connect($uname, $password);

Compliant Solution

$uname = getEncryptedUser();
$password = getEncryptedPass();
connect($uname, $password);

See

Missing class import via use statement (line '76', column '23').
Open

        $client = new GuzzleHttp\Client();
Severity: Minor
Found in src/Notifier/Engine/GamaSmsIr.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 '95', column '23').
Open

            throw new Notifier_Exception_NotificationSend('Receiver is not determined to send notification SMS.');
Severity: Minor
Found in src/Notifier/Engine/GamaSmsIr.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 '82', column '23').
Open

            throw new \Pluf\Exception($response->getBody()->getContents());
Severity: Minor
Found in src/Notifier/Engine/GamaSmsIr.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

Avoid using static access to class 'Tenant_Service' in method 'initParameters'.
Open

        $username = Tenant_Service::setting(self::ENGINE_PARAMETER_USERNAME);
Severity: Minor
Found in src/Notifier/Engine/GamaSmsIr.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 'Tenant_Service' in method 'initParameters'.
Open

        $from = Tenant_Service::setting(self::ENGINE_PARAMETER_FROM);
Severity: Minor
Found in src/Notifier/Engine/GamaSmsIr.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 'Tenant_Service' in method 'initParameters'.
Open

        $template = Tenant_Service::setting(self::ENGINE_PARAMETER_TEMPLATE);
Severity: Minor
Found in src/Notifier/Engine/GamaSmsIr.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 'Tenant_Service' in method 'initParameters'.
Open

        $password = Tenant_Service::setting(self::ENGINE_PARAMETER_PASSWORD);
Severity: Minor
Found in src/Notifier/Engine/GamaSmsIr.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

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

class Notifier_Engine_GamaSmsIr extends Notifier_Engine

The class Notifier_Engine_GamaSmsIr is not named in CamelCase.
Open

class Notifier_Engine_GamaSmsIr extends Notifier_Engine
{
    const ENGINE_PARAMETER_USERNAME = 'notifier.engine.GamaSmsIr.username';
    const ENGINE_PARAMETER_PASSWORD = 'notifier.engine.GamaSmsIr.password';
    const ENGINE_PARAMETER_FROM = 'notifier.engine.GamaSmsIr.from';
Severity: Minor
Found in src/Notifier/Engine/GamaSmsIr.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

Line exceeds 120 characters; contains 138 characters
Open

        return 'This notifier sends SMS to notify an entity. This notifier uses the gamasms.ir (gamapayamak.com) panel to send messages.';

Whitespace found at end of line
Open

     * The string [code] in the template will be replaced with the notification code. 

Opening brace should be on a new line
Open

    private function initParameters($data){

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

class Notifier_Engine_GamaSmsIr extends Notifier_Engine

Whitespace found at end of line
Open

 *        

There are no issues that match your filters.

Category
Status