YetiForceCompany/YetiForceCRM

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

Summary

Maintainability
A
3 hrs
Test Coverage
F
0%

Function process has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function process(App\Request $request)
    {
        $mode = $request->getMode();
        if (!empty($mode)) {
            $this->invokeExposedMethod($mode, $request);
Severity: Minor
Found in modules/Users/actions/SaveAjax.php - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method process has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function process(App\Request $request)
    {
        $mode = $request->getMode();
        if (!empty($mode)) {
            $this->invokeExposedMethod($mode, $request);
Severity: Minor
Found in modules/Users/actions/SaveAjax.php - About 1 hr to fix

    The method process() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
    Open

        public function process(App\Request $request)
        {
            $mode = $request->getMode();
            if (!empty($mode)) {
                $this->invokeExposedMethod($mode, $request);
    Severity: Minor
    Found in modules/Users/actions/SaveAjax.php by phpmd

    CyclomaticComplexity

    Since: 0.1

    Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

    Example

    // Cyclomatic Complexity = 11
    class Foo {
    1   public function example() {
    2       if ($a == $b) {
    3           if ($a1 == $b1) {
                    fiddle();
    4           } elseif ($a2 == $b2) {
                    fiddle();
                } else {
                    fiddle();
                }
    5       } elseif ($c == $d) {
    6           while ($c == $d) {
                    fiddle();
                }
    7        } elseif ($e == $f) {
    8           for ($n = 0; $n < $h; $n++) {
                    fiddle();
                }
            } else {
                switch ($z) {
    9               case 1:
                        fiddle();
                        break;
    10              case 2:
                        fiddle();
                        break;
    11              case 3:
                        fiddle();
                        break;
                    default:
                        fiddle();
                        break;
                }
            }
        }
    }

    Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

    Avoid using undefined variables such as '$user_info' which will lead to PHP notices.
    Open

                $newAccessKey = $user_info['accesskey'];
    Severity: Minor
    Found in modules/Users/actions/SaveAjax.php by phpmd

    UndefinedVariable

    Since: 2.8.0

    Detects when a variable is used that has not been defined before.

    Example

    class Foo
    {
        private function bar()
        {
            // $message is undefined
            echo $message;
        }
    }

    Source https://phpmd.org/rules/cleancode.html#undefinedvariable

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

            $response = new Vtiger_Response();
    Severity: Minor
    Found in modules/Users/actions/SaveAjax.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 '124', column '19').
    Open

            $response = new Vtiger_Response();
    Severity: Minor
    Found in modules/Users/actions/SaveAjax.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 '30', column '14').
    Open

                throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);
    Severity: Minor
    Found in modules/Users/actions/SaveAjax.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 '74', column '19').
    Open

            $response = new Vtiger_Response();
    Severity: Minor
    Found in modules/Users/actions/SaveAjax.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 '100', column '14').
    Open

                throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);
    Severity: Minor
    Found in modules/Users/actions/SaveAjax.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 assigning values to variables in if clauses and the like (line '85', column '37').
    Open

        public function getRecordModelFromRequest(App\Request $request)
        {
            parent::getRecordModelFromRequest($request);
            $fieldName = $request->get('field');
            if ('is_admin' === $fieldName && ($fieldModel = $this->record->getModule()->getFieldByName($fieldName))->isWritable()) {
    Severity: Minor
    Found in modules/Users/actions/SaveAjax.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

    Avoid using static access to class 'Users_Record_Model' in method 'changeAccessKey'.
    Open

                $recordModel = Users_Record_Model::getInstanceById($recordId, $moduleName);
    Severity: Minor
    Found in modules/Users/actions/SaveAjax.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 '62', column '19').
    Open

        public function process(App\Request $request)
        {
            $mode = $request->getMode();
            if (!empty($mode)) {
                $this->invokeExposedMethod($mode, $request);
    Severity: Minor
    Found in modules/Users/actions/SaveAjax.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

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

                    $displayValue = \App\Language::translate('LBL_SPACE', 'Users');
    Severity: Minor
    Found in modules/Users/actions/SaveAjax.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 'Users_Module_Model' in method 'restoreUser'.
    Open

            $userModuleModel = Users_Module_Model::getInstance($moduleName);
    Severity: Minor
    Found in modules/Users/actions/SaveAjax.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 '\App\Language' in method 'restoreUser'.
    Open

            $response->setResult(['message' => \App\Language::translate('LBL_USER_RESTORED_SUCCESSFULLY', $moduleName), 'listViewUrl' => $listViewUrl]);
    Severity: Minor
    Found in modules/Users/actions/SaveAjax.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

    The method changeAccessKey uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

                } else {
                    $response->setError(\App\Language::translate('LBL_FAILED_TO_UPDATE_ACCESS_KEY', $moduleName));
                }
    Severity: Minor
    Found in modules/Users/actions/SaveAjax.php by phpmd

    ElseExpression

    Since: 1.4.0

    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

    Example

    class Foo
    {
        public function bar($flag)
        {
            if ($flag) {
                // one branch
            } else {
                // another branch
            }
        }
    }

    Source https://phpmd.org/rules/cleancode.html#elseexpression

    Avoid using static access to class 'Users_Record_Model' in method 'restoreUser'.
    Open

            $recordModel = Users_Record_Model::getInstanceById($record, $moduleName);
    Severity: Minor
    Found in modules/Users/actions/SaveAjax.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 '\App\User' in method 'checkPermission'.
    Open

            $userModel = \App\User::getCurrentUserModel();
    Severity: Minor
    Found in modules/Users/actions/SaveAjax.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 '\App\Language' in method 'changeAccessKey'.
    Open

                    $response->setResult(['message' => \App\Language::translate('LBL_ACCESS_KEY_UPDATED_SUCCESSFULLY', $moduleName), 'accessKey' => $newAccessKey]);
    Severity: Minor
    Found in modules/Users/actions/SaveAjax.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 '\App\Purifier' in method 'process'.
    Open

                $fieldValue = $displayValue = \App\Purifier::encodeHtml($this->record->get($fieldName));
    Severity: Minor
    Found in modules/Users/actions/SaveAjax.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 '\App\Language' in method 'process'.
    Open

                    $displayValue = \App\Language::getLanguageLabel($fieldValue);
    Severity: Minor
    Found in modules/Users/actions/SaveAjax.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 '\App\Language' in method 'changeAccessKey'.
    Open

                    $response->setError(\App\Language::translate('LBL_FAILED_TO_UPDATE_ACCESS_KEY', $moduleName));
    Severity: Minor
    Found in modules/Users/actions/SaveAjax.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

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

            if (!$userModel->isAdmin() && (int) $userModel->getId() !== $request->getInteger('record')) {
    Severity: Critical
    Found in modules/Users/actions/SaveAjax.php by sonar-php

    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 unused local variables such as '$user_info'.
    Open

                $newAccessKey = $user_info['accesskey'];
    Severity: Minor
    Found in modules/Users/actions/SaveAjax.php by phpmd

    UnusedLocalVariable

    Since: 0.2

    Detects when a local variable is declared and/or assigned, but not used.

    Example

    class Foo {
        public function doSomething()
        {
            $i = 5; // Unused
        }
    }

    Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

    Call to method getCurrentUserModel from undeclared class \App\User (Did you mean class \Tests\App\User)
    Open

            $userModel = \App\User::getCurrentUserModel();
    Severity: Critical
    Found in modules/Users/actions/SaveAjax.php by phan

    Call to undeclared method \CRMEntity::createAccessKey
    Open

                $entity->createAccessKey();
    Severity: Critical
    Found in modules/Users/actions/SaveAjax.php by phan

    Variable $user_info is undeclared
    Open

                $newAccessKey = $user_info['accesskey'];
    Severity: Minor
    Found in modules/Users/actions/SaveAjax.php by phan

    Call to undeclared method \App\Db::createCommand
    Open

            App\Db::getInstance()->createCommand()->update('vtiger_users', ['deleted' => 0], ['id' => $record])->execute();
    Severity: Critical
    Found in modules/Users/actions/SaveAjax.php by phan

    Saw possibly unextractable annotation for a fragment of comment '* @param \App\Request Object': after \App\Request, did not see an element name (will guess based on comment order)
    Open

         * @param \App\Request Object
    Severity: Info
    Found in modules/Users/actions/SaveAjax.php by phan

    Call to method getCurrentUserModel from undeclared class \App\User (Did you mean class \Tests\App\User)
    Open

            if (!\App\User::getCurrentUserModel()->isAdmin()) {
    Severity: Critical
    Found in modules/Users/actions/SaveAjax.php by phan

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

    class Users_SaveAjax_Action extends Vtiger_SaveAjax_Action

    The class Users_SaveAjax_Action is not named in CamelCase.
    Open

    class Users_SaveAjax_Action extends Vtiger_SaveAjax_Action
    {
        use \App\Controller\ExposeMethod;
    
        /** {@inheritdoc} */
    Severity: Minor
    Found in modules/Users/actions/SaveAjax.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

                    $displayValue = $fieldModel->getDisplayValue($fieldValue, $this->record->getId());

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

                $result[$fieldName] = [

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

        }

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

            $recordModel->set('status', 'Active');

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

            try {

    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

                return;

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

            $fieldModelList = $this->record->getModule()->getFields();

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

                    continue;

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

                if ('currency' !== $fieldModel->getFieldDataType()) {

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

            }

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

                $fieldValue = $displayValue = \App\Purifier::encodeHtml($this->record->get($fieldName));

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

                if (false !== ($recordFieldValuePrev = $this->record->getPreviousValue($fieldName))) {

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

            $response->setResult($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

        {

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

                if ($newAccessKey != $oldAccessKey) {

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

                    $response->setError(\App\Language::translate('LBL_FAILED_TO_UPDATE_ACCESS_KEY', $moduleName));

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

            $result = [];

    Line exceeds 120 characters; contains 139 characters
    Open

                if (('currency_decimal_separator' === $fieldName || 'currency_grouping_separator' === $fieldName) && (' ' === $displayValue)) {

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

                    'display_value' => $displayValue,

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

                $fieldModel->getUITypeModel()->setValueFromRequest($request, $this->record, 'value');

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

         *

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

            $recordModel->save();

    Line exceeds 120 characters; contains 148 characters
    Open

            $response->setResult(['message' => \App\Language::translate('LBL_USER_RESTORED_SUCCESSFULLY', $moduleName), 'listViewUrl' => $listViewUrl]);

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

                $recordModel = Users_Record_Model::getInstanceById($recordId, $moduleName);

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

                } else {

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

                }

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

            } catch (Exception $ex) {

    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

            $result['_recordId'] = $this->record->getId();

    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(['message' => \App\Language::translate('LBL_USER_RESTORED_SUCCESSFULLY', $moduleName), 'listViewUrl' => $listViewUrl]);

    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

                $entity = $recordModel->getEntity();

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

                $newAccessKey = $user_info['accesskey'];

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

        {

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

                    $displayValue = \App\Language::getLanguageLabel($fieldValue);

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

         * @param \App\Request Object

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

                $entity->createAccessKey();

    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

            $result['_recordLabel'] = $this->record->getName();

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

            }

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

            $fieldName = $request->get('field');

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

        public function changeAccessKey(App\Request $request)

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

            $recordId = $request->getInteger('record');

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

                    $response->setResult(['message' => \App\Language::translate('LBL_ACCESS_KEY_UPDATED_SUCCESSFULLY', $moduleName), 'accessKey' => $newAccessKey]);

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

        {

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

                    $displayValue = \App\Language::translate('LBL_SPACE', 'Users');

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

                }

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

                $prevDisplayValue = false;

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

            $response->setEmitType(Vtiger_Response::$EMIT_JSON);

    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 getRecordModelFromRequest(App\Request $request)

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

            parent::getRecordModelFromRequest($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

                throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);

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

            $moduleName = $request->getModule();

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

            $this->exposeMethod('changeAccessKey');

    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

            if (!empty($mode)) {

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

            $this->saveRecord($request);

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

            return $this->record;

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

         * To restore a user.

    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

        /** {@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

        /** {@inheritdoc} */

    Line exceeds 120 characters; contains 128 characters
    Open

            if ('is_admin' === $fieldName && ($fieldModel = $this->record->getModule()->getFieldByName($fieldName))->isWritable()) {

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

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

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

                require "user_privileges/user_privileges_$recordId.php";

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

                throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);

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

        public function process(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

            $listViewUrl = $userModuleModel->getListViewUrl();

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

        {

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

                $oldAccessKey = $recordModel->get('accesskey');

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

        use \App\Controller\ExposeMethod;

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

            parent::checkPermission($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

            foreach ($fieldModelList as $fieldName => &$fieldModel) {

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

                    'prev_display_value' => $prevDisplayValue

    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 ('is_admin' === $fieldName && ($fieldModel = $this->record->getModule()->getFieldByName($fieldName))->isWritable()) {

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

            $this->exposeMethod('restoreUser');

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

            if (!$userModel->isAdmin() && (int) $userModel->getId() !== $request->getInteger('record')) {

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

            $mode = $request->getMode();

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

                $this->invokeExposedMethod($mode, $request);

    Line exceeds 120 characters; contains 127 characters
    Open

                    $prevDisplayValue = $fieldModel->getDisplayValue($recordFieldValuePrev, $this->record->getId(), $this->record);

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

                    'value' => $fieldValue,

    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 restoreUser(App\Request $request)

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

            if (!\App\User::getCurrentUserModel()->isAdmin()) {

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

            $recordModel = Users_Record_Model::getInstanceById($record, $moduleName);

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

            $userModuleModel = Users_Module_Model::getInstance($moduleName);

    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

        public function __construct()

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

        public function checkPermission(App\Request $request)

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

                if (!$fieldModel->isViewEnabled()) {

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

                if (('currency_decimal_separator' === $fieldName || 'currency_grouping_separator' === $fieldName) && (' ' === $displayValue)) {

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

                    $prevDisplayValue = $fieldModel->getDisplayValue($recordFieldValuePrev, $this->record->getId(), $this->record);

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

            App\Db::getInstance()->createCommand()->update('vtiger_users', ['deleted' => 0], ['id' => $record])->execute();

    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

            $userModel = \App\User::getCurrentUserModel();

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

                if ('language' === $fieldName) {

    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

            $moduleName = $request->getModule();

    Line exceeds 120 characters; contains 160 characters
    Open

                    $response->setResult(['message' => \App\Language::translate('LBL_ACCESS_KEY_UPDATED_SUCCESSFULLY', $moduleName), 'accessKey' => $newAccessKey]);

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

                $response->setError($ex->getMessage());

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

    class Users_SaveAjax_Action extends Vtiger_SaveAjax_Action

    The variable $user_info is not named in camelCase.
    Open

        public function changeAccessKey(App\Request $request)
        {
            $recordId = $request->getInteger('record');
            $moduleName = $request->getModule();
    
    
    Severity: Minor
    Found in modules/Users/actions/SaveAjax.php by phpmd

    CamelCaseVariableName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name variables.

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    There are no issues that match your filters.

    Category
    Status