YetiForceCompany/YetiForceCRM

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

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

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

    public static function getServers(bool $onlyActive = true): array

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

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

        $query = (new \App\Db\Query())->from('w_#__servers');

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 '38', column '17').
Open

        $query = (new \App\Db\Query())->from('w_#__servers')->andWhere(['status' => 1]);

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 'getServers'.
Open

        return $query->createCommand(\App\Db::getInstance('webservice'))->queryAllByGroup(1);

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\Db' in method 'getActiveServers'.
Open

        return $query->createCommand(\App\Db::getInstance('webservice'))->queryAllByGroup(1);

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::from
Open

        $query = (new \App\Db\Query())->from('w_#__servers')->andWhere(['status' => 1]);

Call to undeclared method \App\Db\Query::from
Open

        $query = (new \App\Db\Query())->from('w_#__servers');

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

class Settings_WebserviceApps_Module_Model extends Settings_Vtiger_Module_Model

The class Settings_WebserviceApps_Module_Model is not named in CamelCase.
Open

class Settings_WebserviceApps_Module_Model extends Settings_Vtiger_Module_Model
{
    /**
     * Get all servers.
     *

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

    /**

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

            $query->where(['status' => 1]);

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 getServers(bool $onlyActive = true): array

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

        $query = (new \App\Db\Query())->from('w_#__servers');

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

        return $query->createCommand(\App\Db::getInstance('webservice'))->queryAllByGroup(1);

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

        return $query->createCommand(\App\Db::getInstance('webservice'))->queryAllByGroup(1);

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

     */

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

     * @param string $type

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

     * @return array

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

     * @param bool $onlyActive

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

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

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

     * Get active servers.

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

    {

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

        $query = (new \App\Db\Query())->from('w_#__servers')->andWhere(['status' => 1]);

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

     * Get all servers.

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

    public static function getActiveServers(string $type = ''): array

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 array

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

            $query->andWhere(['type' => $type]);

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

        }

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

class Settings_WebserviceApps_Module_Model extends Settings_Vtiger_Module_Model

There are no issues that match your filters.

Category
Status