YetiForceCompany/YetiForceCRM

View on GitHub
modules/Settings/InterestsConflict/actions/Save.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

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

        $response = new Vtiger_Response();

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 '41', column '21').
Open

        $configFile = new \App\ConfigFile('component', 'InterestsConflict');

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 '50', column '19').
Open

        $response = new Vtiger_Response();

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 '73', column '21').
Open

        $configFile = new \App\ConfigFile('component', 'InterestsConflict');

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 assigning values to variables in if clauses and the like (line '38', column '8').
Open

    public function config(App\Request $request): void
    {
        $confirmationTimeInterval = $request->getInteger('confirmationTimeInterval');
        if (($list = $request->getByType('confirmationTimeIntervalList', 'Standard')) && '-' !== $list) {
            $confirmationTimeInterval .= ' ' . $list;

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

Avoid using static access to class '\App\Purifier' in method 'modules'.
Open

                $data[\App\Purifier::purifyByType($jsonKey, 'Alnum')] = \App\Purifier::purifyByType($jsonValue, 'AlnumExtended');

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\Json' in method 'modules'.
Open

            foreach (\App\Json::decode($module) as $jsonKey => $jsonValue) {

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\Purifier' in method 'modules'.
Open

                $data[\App\Purifier::purifyByType($jsonKey, 'Alnum')] = \App\Purifier::purifyByType($jsonValue, 'AlnumExtended');

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

Define a constant instead of duplicating this literal "modules" 3 times.
Open

        $this->exposeMethod('modules');

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

function run() {
  prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
  execute('action1');
  release('action1');
}

Compliant Solution

ACTION_1 = 'action1';

function run() {
  prepare(ACTION_1);
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

Avoid excessively long variable names like $confirmationTimeInterval. Keep variable name length under 20.
Open

        $confirmationTimeInterval = $request->getInteger('confirmationTimeInterval');

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

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

class Settings_InterestsConflict_Save_Action extends \App\Controller\Action

The class Settings_InterestsConflict_Save_Action is not named in CamelCase.
Open

class Settings_InterestsConflict_Save_Action extends \App\Controller\Action
{
    use \App\Controller\ExposeMethod, \App\Controller\Traits\SettingsPermission;

    /** {@inheritdoc} */

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->exposeMethod('config');

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

        parent::__construct();

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

     * Save config data.

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

     * @param App\Request $request

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

    public function __construct()

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

            $data = [

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

        $configFile = new \App\ConfigFile('component', 'InterestsConflict');

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

        foreach ($request->getArray('modules') as $key => $module) {

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

                'key' => $key

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

                $data[\App\Purifier::purifyByType($jsonKey, 'Alnum')] = \App\Purifier::purifyByType($jsonValue, 'AlnumExtended');

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

            }

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

            $config[$data['related']][] = $data;

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

        $configFile->create();

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

        $response = new Vtiger_Response();

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

        $this->exposeMethod('modules');

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

        $configFile->set('sendMailAccessRequest', $request->getBoolean('sendMailAccessRequest'));

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

        $configFile->set('unlockUsersAccess', $request->getArray('unlockUsersAccess', 'Integer'));

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

        $configFile->create();

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

     * @return void

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

     *

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

            $confirmationTimeInterval .= ' ' . $list;

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

    use \App\Controller\ExposeMethod, \App\Controller\Traits\SettingsPermission;

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

     * Save modules configuration.

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

        $configFile->set('sendMailAccessResponse', $request->getBoolean('sendMailAccessResponse'));

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

     */

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

    public function config(App\Request $request): void

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

        $confirmationTimeInterval = $request->getInteger('confirmationTimeInterval');

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

        $configFile = new \App\ConfigFile('component', 'InterestsConflict');

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

        $configFile->set('confirmationTimeInterval', $confirmationTimeInterval);

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

        $configFile->set('confirmUsersAccess', $request->getArray('confirmUsersAccess', 'Integer'));

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

    {

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

        $configFile->set('notificationsEmails', $request->getByType('notificationsEmails', 'Text'));

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

     * @param App\Request $request

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

        $configFile->set('modules', $config);

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

    }

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

        $response->emit();

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

        if (($list = $request->getByType('confirmationTimeIntervalList', 'Standard')) && '-' !== $list) {

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

            foreach (\App\Json::decode($module) as $jsonKey => $jsonValue) {

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

        }

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

        $response->emit();

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

     * @return void

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

        $configFile->set('isActive', $request->getBoolean('isActive'));

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

    public function modules(App\Request $request): void

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

    {

Line exceeds 120 characters; contains 129 characters
Open

                $data[\App\Purifier::purifyByType($jsonKey, 'Alnum')] = \App\Purifier::purifyByType($jsonValue, 'AlnumExtended');

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

        $response = new Vtiger_Response();

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

        $config = [];

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

class Settings_InterestsConflict_Save_Action extends \App\Controller\Action

There are no issues that match your filters.

Category
Status