YetiForceCompany/YetiForceCRM

View on GitHub
modules/Settings/Users/actions/SaveAjax.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

Missing class import via use statement (line '61', 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 '24', 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 '43', 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

Avoid using static access to class '\App\Language' in method 'updateConfig'.
Open

            'message' => \App\Language::translate('LBL_SAVE_CONFIG', $request->getModule(false)),

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 'Settings_Users_Module_Model' in method 'saveSwitchUsers'.
Open

        $moduleModel = Settings_Users_Module_Model::getInstance();

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\Language' in method 'saveLocks'.
Open

            'message' => \App\Language::translate('LBL_SAVE_CONFIG', $request->getModule(false)),

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 'Settings_Users_Module_Model' in method 'updateConfig'.
Open

        $recordModel = Settings_Users_Module_Model::getInstance();

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\Language' in method 'saveSwitchUsers'.
Open

            'message' => \App\Language::translate('LBL_SAVE_CONFIG', $request->getModule(false)),

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 "message" 3 times.
Open

            'message' => \App\Language::translate('LBL_SAVE_CONFIG', $request->getModule(false)),

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.

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

            'message' => \App\Language::translate('LBL_SAVE_CONFIG', $request->getModule(false)),

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.

Define a constant instead of duplicating this literal "param" 4 times.
Open

            'success' => $recordModel->setConfig($request->getMultiDimensionArray('param', [

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.

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

                'type' => 'Standard',

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.

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

            'user' => 'Alnum',

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.

Argument 1 (request) is array but \Settings_Users_SaveAjax_Action::saveLocks() takes \App\Request defined at /code/modules/Settings/Users/actions/SaveAjax.php:55
Open

        Settings_Users_Module_Model::getInstance()->saveLocks($request->getMultiDimensionArray('param', [[

Argument 1 (request) is array but \Settings_Users_SaveAjax_Action::saveSwitchUsers() takes \App\Request defined at /code/modules/Settings/Users/actions/SaveAjax.php:36
Open

        $moduleModel->saveSwitchUsers($request->getMultiDimensionArray('param', [[

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

class Settings_Users_SaveAjax_Action extends Settings_Vtiger_Save_Action

The class Settings_Users_SaveAjax_Action is not named in CamelCase.
Open

class Settings_Users_SaveAjax_Action extends Settings_Vtiger_Save_Action
{
    /** {@inheritdoc} */
    public function __construct()
    {

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

                'param' => 'Standard',

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

            'success' => $recordModel->setConfig($request->getMultiDimensionArray('param', [

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

                'type' => 'Standard',

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

        $moduleModel->saveSwitchUsers($request->getMultiDimensionArray('param', [[

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

    }

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

        $this->exposeMethod('saveLocks');

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

    }

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

        $response->setResult([

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

            'message' => \App\Language::translate('LBL_SAVE_CONFIG', $request->getModule(false)),

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

        Settings_Users_Module_Model::getInstance()->saveLocks($request->getMultiDimensionArray('param', [[

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

    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

    /**

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

     *

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

            'message' => \App\Language::translate('LBL_SAVE_CONFIG', $request->getModule(false)),

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

        $recordModel = Settings_Users_Module_Model::getInstance();

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

            'message' => \App\Language::translate('LBL_SAVE_CONFIG', $request->getModule(false)),

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

    public function saveSwitchUsers(App\Request $request)

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

            'user' => 'Alnum',

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

            'locks' => 'Standard'

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

        $this->exposeMethod('updateConfig');

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

    public function updateConfig(App\Request $request)

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

        $moduleModel = Settings_Users_Module_Model::getInstance();

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

    public function saveLocks(App\Request $request)

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

     * @param \App\Request $request

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

     */

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

        $this->exposeMethod('saveSwitchUsers');

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

                'val' => 'Text'

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->setResult([

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

            'access' => 'Alnum'

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

        $response->setResult([

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

    }

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

            'user' => 'Alnum',

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

        ]);

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

     * Action to save locks.

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

        ]]));

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

class Settings_Users_SaveAjax_Action extends Settings_Vtiger_Save_Action

There are no issues that match your filters.

Category
Status