YetiForceCompany/YetiForceCRM

View on GitHub
vtlib/Vtiger/Access.php

Summary

Maintainability
A
1 hr
Test Coverage
B
80%

Function updateTool has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public static function updateTool(ModuleBasic $moduleInstance, $toolAction, $flag, $profileid = false)
    {
        $actionId = \App\Module::getActionId($toolAction);
        if ($actionId) {
            $permission = (true === $flag) ? '0' : '1';
Severity: Minor
Found in vtlib/Vtiger/Access.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

Function setDefaultSharing has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function setDefaultSharing(ModuleBasic $moduleInstance, $permissionText = 'Public_ReadWriteDelete')
    {
        $permissionText = strtolower($permissionText);

        if ('public_readonly' === $permissionText) {
Severity: Minor
Found in vtlib/Vtiger/Access.php - About 35 mins 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

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

                $isExists = (new \App\Db\Query())->from('vtiger_profile2utility')
Severity: Minor
Found in vtlib/Vtiger/Access.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

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

    public static function allowSharing(ModuleBasic $moduleInstance, $enable = true)
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpmd

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

        $query = (new \App\Db\Query())->select(['share_action_id'])->from('vtiger_org_share_action_mapping')
Severity: Minor
Found in vtlib/Vtiger/Access.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

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

    public static function updateTool(ModuleBasic $moduleInstance, $toolAction, $flag, $profileid = false)
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpmd

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 '99', column '18').
Open

        $ruleId = (new \App\Db\Query())->select(['ruleid'])->from('vtiger_def_org_share')->where(['tabid' => $moduleInstance->id])->scalar();
Severity: Minor
Found in vtlib/Vtiger/Access.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 '\App\UserPrivilegesFile' in method 'syncSharingAccess'.
Open

        \App\UserPrivilegesFile::recalculateAll();
Severity: Minor
Found in vtlib/Vtiger/Access.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\Log' in method 'deleteTools'.
Open

        \App\Log::trace('Deleting tools ... DONE', __METHOD__);
Severity: Minor
Found in vtlib/Vtiger/Access.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\Log' in method 'updateTool'.
Open

            \App\Log::trace(($flag ? 'Enabling' : 'Disabling') . " $toolAction for Profile [", __METHOD__);
Severity: Minor
Found in vtlib/Vtiger/Access.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\Log' in method 'deleteSharing'.
Open

        \App\Log::trace('Deleting sharing access ... DONE', __METHOD__);
Severity: Minor
Found in vtlib/Vtiger/Access.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\Module' in method 'updateTool'.
Open

        $actionId = \App\Module::getActionId($toolAction);
Severity: Minor
Found in vtlib/Vtiger/Access.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\Log' in method 'syncSharingAccess'.
Open

        \App\Log::trace('DONE', __METHOD__);
Severity: Minor
Found in vtlib/Vtiger/Access.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\Db' in method 'updateTool'.
Open

            $db = \App\Db::getInstance();
Severity: Minor
Found in vtlib/Vtiger/Access.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 updateTool uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                } else {
                    $db->createCommand()->insert('vtiger_profile2utility', ['profileid' => $useProfileId, 'tabid' => $moduleInstance->id, 'activityid' => $actionId, 'permission' => $permission])->execute();
                }
Severity: Minor
Found in vtlib/Vtiger/Access.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 '\App\Log' in method 'syncSharingAccess'.
Open

        \App\Log::trace('Recalculating sharing rules ... ', __METHOD__);
Severity: Minor
Found in vtlib/Vtiger/Access.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\Log' in method 'allowSharing'.
Open

        \App\Log::trace(($enable ? 'Enabled' : 'Disabled') . ' sharing access control ... DONE', __METHOD__);
Severity: Minor
Found in vtlib/Vtiger/Access.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\Log' in method 'initSharing'.
Open

        \App\Log::trace('Setting up sharing access options ... DONE', __METHOD__);
Severity: Minor
Found in vtlib/Vtiger/Access.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\Log' in method 'updateTool'.
Open

            \App\Log::trace('] ... DONE', __METHOD__);
Severity: Minor
Found in vtlib/Vtiger/Access.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 setDefaultSharing uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            \App\Db::getInstance()->createCommand()->insert('vtiger_def_org_share', ['tabid' => $moduleInstance->id, 'permission' => $permission, 'editstatus' => $editstatus])->execute();
        }
Severity: Minor
Found in vtlib/Vtiger/Access.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

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

            } else {
                $profileids = Profile::getAllIds();
            }
Severity: Minor
Found in vtlib/Vtiger/Access.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

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

        } else {
            $permission = 2;
        } // public_readwritedelete is default
Severity: Minor
Found in vtlib/Vtiger/Access.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 '\App\Log' in method 'updateTool'.
Open

                \App\Log::trace("$useProfileId,", __METHOD__);
Severity: Minor
Found in vtlib/Vtiger/Access.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 'vtlib\Profile' in method 'updateTool'.
Open

                $profileids = Profile::getAllIds();
Severity: Minor
Found in vtlib/Vtiger/Access.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 "vtiger_def_org_share" 3 times.
Open

        $ruleId = (new \App\Db\Query())->select(['ruleid'])->from('vtiger_def_org_share')->where(['tabid' => $moduleInstance->id])->scalar();
Severity: Critical
Found in vtlib/Vtiger/Access.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.

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

                $isExists = (new \App\Db\Query())->from('vtiger_profile2utility')
Severity: Critical
Found in vtlib/Vtiger/Access.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.

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

                    ->where(['profileid' => $useProfileId, 'tabid' => $moduleInstance->id, 'activityid' => $actionId])
Severity: Critical
Found in vtlib/Vtiger/Access.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.

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

                    ->where(['profileid' => $useProfileId, 'tabid' => $moduleInstance->id, 'activityid' => $actionId])
Severity: Critical
Found in vtlib/Vtiger/Access.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.

Define a constant instead of duplicating this literal "tabid" 9 times.
Open

        \App\Db::getInstance()->createCommand()->update('vtiger_tab', ['ownedby' => $ownedBy], ['tabid' => $moduleInstance->id])->execute();
Severity: Critical
Found in vtlib/Vtiger/Access.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.

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

            \App\Db::getInstance()->createCommand()->update('vtiger_def_org_share', ['permission' => $permission], ['ruleid' => $ruleId])->execute();
Severity: Critical
Found in vtlib/Vtiger/Access.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.

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

        \App\Db::getInstance()->createCommand()->delete('vtiger_org_share_action2tab', ['tabid' => $moduleInstance->id])->execute();
Severity: Critical
Found in vtlib/Vtiger/Access.php by phan

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

        $ruleId = (new \App\Db\Query())->select(['ruleid'])->from('vtiger_def_org_share')->where(['tabid' => $moduleInstance->id])->scalar();
Severity: Critical
Found in vtlib/Vtiger/Access.php by phan

Call to method trace from undeclared class \App\Log
Open

        \App\Log::trace('Setting up sharing access options ... DONE', __METHOD__);
Severity: Critical
Found in vtlib/Vtiger/Access.php by phan

Saw possibly unextractable annotation for a fragment of comment '* @param bool true to enable tool, false to disable': after bool, did not see an element name (will guess based on comment order)
Open

     * @param bool true to enable tool, false to disable
Severity: Info
Found in vtlib/Vtiger/Access.php by phan

Saw possibly unextractable annotation for a fragment of comment '* @param int (optional) profile id to use, false applies to all profile': after int, did not see an element name (will guess based on comment order)
Open

     * @param int (optional) profile id to use, false applies to all profile
Severity: Info
Found in vtlib/Vtiger/Access.php by phan

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

        $query = (new \App\Db\Query())->select(['share_action_id'])->from('vtiger_org_share_action_mapping')
Severity: Critical
Found in vtlib/Vtiger/Access.php by phan

Saw possibly unextractable annotation for a fragment of comment '* @param string Tool (action name) like Import, Export': after string, did not see an element name (will guess based on comment order)
Open

     * @param string Tool (action name) like Import, Export
Severity: Info
Found in vtlib/Vtiger/Access.php by phan

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

        \App\Db::getInstance()->createCommand()->update('vtiger_tab', ['ownedby' => $ownedBy], ['tabid' => $moduleInstance->id])->execute();
Severity: Critical
Found in vtlib/Vtiger/Access.php by phan

Call to method trace from undeclared class \App\Log
Open

            \App\Log::trace('] ... DONE', __METHOD__);
Severity: Critical
Found in vtlib/Vtiger/Access.php by phan

Saw possibly unextractable annotation for a fragment of comment '* @param bool true to enable sharing access, false disable sharing access': after bool, did not see an element name (will guess based on comment order)
Open

     * @param bool true to enable sharing access, false disable sharing access
Severity: Info
Found in vtlib/Vtiger/Access.php by phan

Call to method trace from undeclared class \App\Log
Open

        \App\Log::trace('Recalculating sharing rules ... ', __METHOD__);
Severity: Critical
Found in vtlib/Vtiger/Access.php by phan

Call to method trace from undeclared class \App\Log
Open

        \App\Log::trace(($enable ? 'Enabled' : 'Disabled') . ' sharing access control ... DONE', __METHOD__);
Severity: Critical
Found in vtlib/Vtiger/Access.php by phan

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

            \App\Db::getInstance()->createCommand()->insert('vtiger_def_org_share', ['tabid' => $moduleInstance->id, 'permission' => $permission, 'editstatus' => $editstatus])->execute();
Severity: Critical
Found in vtlib/Vtiger/Access.php by phan

Call to method trace from undeclared class \App\Log
Open

            \App\Log::trace(($flag ? 'Enabling' : 'Disabling') . " $toolAction for Profile [", __METHOD__);
Severity: Critical
Found in vtlib/Vtiger/Access.php by phan

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

        \App\Db::getInstance()->createCommand()
Severity: Critical
Found in vtlib/Vtiger/Access.php by phan

Saw possibly unextractable annotation for a fragment of comment '* @param string Permission text should be one of ['Public_ReadWriteDelete', 'Public_ReadOnly', 'Public_ReadWrite', 'Private']': after string, did not see an element name (will guess based on comment order)
Open

     * @param string Permission text should be one of ['Public_ReadWriteDelete', 'Public_ReadOnly', 'Public_ReadWrite', 'Private']
Severity: Info
Found in vtlib/Vtiger/Access.php by phan

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

                    $db->createCommand()->update('vtiger_profile2utility', ['permission' => $permission], ['profileid' => $useProfileId, 'tabid' => $moduleInstance->id, 'activityid' => $actionId])->execute();
Severity: Critical
Found in vtlib/Vtiger/Access.php by phan

Call to method trace from undeclared class \App\Log
Open

                \App\Log::trace("$useProfileId,", __METHOD__);
Severity: Critical
Found in vtlib/Vtiger/Access.php by phan

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

        \App\Db::getInstance()->createCommand()->delete('vtiger_profile2utility', ['tabid' => $moduleInstance->id])->execute();
Severity: Critical
Found in vtlib/Vtiger/Access.php by phan

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

                    $db->createCommand()->insert('vtiger_profile2utility', ['profileid' => $useProfileId, 'tabid' => $moduleInstance->id, 'activityid' => $actionId, 'permission' => $permission])->execute();
Severity: Critical
Found in vtlib/Vtiger/Access.php by phan

Call to method trace from undeclared class \App\Log
Open

        \App\Log::trace('Deleting sharing access ... DONE', __METHOD__);
Severity: Critical
Found in vtlib/Vtiger/Access.php by phan

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

            \App\Db::getInstance()->createCommand()->update('vtiger_def_org_share', ['permission' => $permission], ['ruleid' => $ruleId])->execute();
Severity: Critical
Found in vtlib/Vtiger/Access.php by phan

Call to method trace from undeclared class \App\Log
Open

        \App\Log::trace('Deleting tools ... DONE', __METHOD__);
Severity: Critical
Found in vtlib/Vtiger/Access.php by phan

Call to method trace from undeclared class \App\Log
Open

        \App\Log::trace('DONE', __METHOD__);
Severity: Critical
Found in vtlib/Vtiger/Access.php by phan

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

                $isExists = (new \App\Db\Query())->from('vtiger_profile2utility')
Severity: Critical
Found in vtlib/Vtiger/Access.php by phan

This branch's code block is the same as the block for the branch on line 89.
Open

        } else {
            $permission = 2;
        } // public_readwritedelete is default
Severity: Major
Found in vtlib/Vtiger/Access.php by sonar-php

Having two cases in a switch statement or two branches in an if chain with the same implementation is at best duplicate code, and at worst a coding error. If the same logic is truly needed for both instances, then in an if chain they should be combined, or for a switch, one should fall through to the other.

Noncompliant Code Example

switch ($i) {
  case 1:
    doSomething();
    break;
  case 2:
    doSomethingDifferent();
    break;
  case 3:  // Noncompliant; duplicates case 1's implementation
    doSomething();
    break;
  default:
    doTheRest();
}

if ($a >= 0 && $a < 10) {
  doTheThing();
else if ($a >= 10 && $a < 20) {
  doTheOtherThing();
}
else if ($a >= 20 && $a < 50) {
  doTheThing();  // Noncompliant; duplicates first condition
}
else {
  doTheRest();
}

if ($b == 0) {
  doOneMoreThing();
}
else {
  doOneMoreThing(); // Noncompliant; duplicates then-branch
}

var b = a ? 12 > 4 : 4;  // Noncompliant; always results in the same value

Compliant Solution

switch ($i) {
  case 1:
  case 3:
    doSomething();
    break;
  case 2:
    doSomethingDifferent();
    break;
  default:
    doTheRest();
}

if (($a >= 0 && $a < 10) || ($a >= 20 && $a < 50)) {
  doTheThing();
else if ($a >= 10 && $a < 20) {
  doTheOtherThing();
}
else {
  doTheRest();
}

doOneMoreThing();

b = 4;

or

switch ($i) {
  case 1:
    doSomething();
    break;
  case 2:
    doSomethingDifferent();
    break;
  case 3:
    doThirdThing();
    break;
  default:
    doTheRest();
}

if ($a >= 0 && $a < 10) {
  doTheThing();
else if ($a >= 10 && $a < 20) {
  doTheOtherThing();
}
else if ($a >= 20 && $a < 50) {
  doTheThirdThing();
}
else {
  doTheRest();
}

if ($b == 0) {
  doOneMoreThing();
}
else {
  doTheRest();
}

int b = a ? 12 > 4 : 8;

Exceptions

Blocks in an if chain that contain a single line of code are ignored, as are blocks in a switch statement that contain a single line of code with or without a following break.

Avoid variables with short names like $db. Configured minimum length is 3.
Open

            $db = \App\Db::getInstance();
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpmd

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

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

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

        \App\Log::trace('Recalculating sharing rules ... ', __METHOD__);
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

        \App\UserPrivilegesFile::recalculateAll();
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

    /**
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

     * Recalculate sharing access rules.
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

     */
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

     * Enable or Disable sharing access control to module.
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

    /**
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

        $ownedBy = $enable ? 0 : 1;
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

        \App\Log::trace(($enable ? 'Enabled' : 'Disabled') . ' sharing access control ... DONE', __METHOD__);
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

     *
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

        $ruleId = (new \App\Db\Query())->select(['ruleid'])->from('vtiger_def_org_share')->where(['tabid' => $moduleInstance->id])->scalar();
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

     */
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

    {
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

                if ($isExists) {
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

    {
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

            ->execute();
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

    }
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

Line exceeds 120 characters; contains 132 characters
Open

        \App\Db::getInstance()->createCommand()->delete('vtiger_org_share_action2tab', ['tabid' => $moduleInstance->id])->execute();
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

     */
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

        } elseif ('public_readwritedelete' === $permissionText) {
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

Line exceeds 120 characters; contains 141 characters
Open

        $ruleId = (new \App\Db\Query())->select(['ruleid'])->from('vtiger_def_org_share')->where(['tabid' => $moduleInstance->id])->scalar();
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

    }
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

                } else {
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

     *
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

    {
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

    }
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

    {
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

    }
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

     *
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

     * @param mixed $enable
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

        $insertedData = [];
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

     * Delete sharing access setup for module.
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

        \App\Log::trace('Deleting sharing access ... DONE', __METHOD__);
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

    /**
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

     * @param ModuleBasic $moduleInstance
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

     * @param string Permission text should be one of ['Public_ReadWriteDelete', 'Public_ReadOnly', 'Public_ReadWrite', 'Private']
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

        if ($ruleId) {
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

        }
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

    public static function updateTool(ModuleBasic $moduleInstance, $toolAction, $flag, $profileid = false)
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

    public static function syncSharingAccess()
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

        \App\Log::trace('DONE', __METHOD__);
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

            ->where(['share_action_name' => ['Public: Read Only', 'Public: Read, Create/Edit', 'Public: Read, Create/Edit, Delete', 'Private']]);
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

        }
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

            $permission = 2;
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

        $editstatus = 0; // 0 or 1
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

     * @param mixed $toolAction
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

     * @param mixed $flag
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

            }
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

     * @param ModuleBasic $moduleInstance
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

            \App\Db::getInstance()->createCommand()->update('vtiger_def_org_share', ['permission' => $permission], ['ruleid' => $ruleId])->execute();
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

    /**
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

     * @param ModuleBasic $moduleInstance
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

        $actionId = \App\Module::getActionId($toolAction);
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

            \App\Log::trace(($flag ? 'Enabling' : 'Disabling') . " $toolAction for Profile [", __METHOD__);
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

    /**
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

    }
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

     * Set default sharing for a module.
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

            \App\Db::getInstance()->createCommand()->insert('vtiger_def_org_share', ['tabid' => $moduleInstance->id, 'permission' => $permission, 'editstatus' => $editstatus])->execute();
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

     * @param bool true to enable tool, false to disable
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

Line exceeds 120 characters; contains 208 characters
Open

                    $db->createCommand()->update('vtiger_profile2utility', ['permission' => $permission], ['profileid' => $useProfileId, 'tabid' => $moduleInstance->id, 'activityid' => $actionId])->execute();
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

            \App\Log::trace('] ... DONE', __METHOD__);
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

     * @param bool true to enable sharing access, false disable sharing access
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

     */
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

     *
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

        \App\Db::getInstance()->createCommand()
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

            ->batchInsert('vtiger_org_share_action2tab', ['share_action_id', 'tabid'], $insertedData)
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

     * @param ModuleBasic $moduleInstance
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

     */
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

        } elseif ('public_readwrite' === $permissionText) {
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

        } elseif ('private' === $permissionText) {
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

            $permission = 3;
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

     * Enable tool for module.
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

        if ($actionId) {
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

                $isExists = (new \App\Db\Query())->from('vtiger_profile2utility')
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

Line exceeds 120 characters; contains 206 characters
Open

                    $db->createCommand()->insert('vtiger_profile2utility', ['profileid' => $useProfileId, 'tabid' => $moduleInstance->id, 'activityid' => $actionId, 'permission' => $permission])->execute();
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

        }
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

        \App\Db::getInstance()->createCommand()->delete('vtiger_profile2utility', ['tabid' => $moduleInstance->id])->execute();
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

Line exceeds 120 characters; contains 127 characters
Open

        \App\Db::getInstance()->createCommand()->delete('vtiger_profile2utility', ['tabid' => $moduleInstance->id])->execute();
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

     */
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

    {
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

Line exceeds 120 characters; contains 145 characters
Open

            ->where(['share_action_name' => ['Public: Read Only', 'Public: Read, Create/Edit', 'Public: Read, Create/Edit, Delete', 'Private']]);
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

            $permission = 0;
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

Line exceeds 120 characters; contains 149 characters
Open

            \App\Db::getInstance()->createCommand()->update('vtiger_def_org_share', ['permission' => $permission], ['ruleid' => $ruleId])->execute();
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

        \App\Db::getInstance()->createCommand()->update('vtiger_tab', ['ownedby' => $ownedBy], ['tabid' => $moduleInstance->id])->execute();
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

        $query = (new \App\Db\Query())->select(['share_action_id'])->from('vtiger_org_share_action_mapping')
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

        \App\Log::trace('Setting up sharing access options ... DONE', __METHOD__);
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

    /**
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

        if ('public_readonly' === $permissionText) {
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

     * @param int (optional) profile id to use, false applies to all profile
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

            $permission = (true === $flag) ? '0' : '1';
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

                \App\Log::trace("$useProfileId,", __METHOD__);
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

    }
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

     */
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

        foreach ($actionIds as $id) {
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

    public static function deleteSharing(ModuleBasic $moduleInstance)
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

        } else {
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

        } else {
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

Line exceeds 120 characters; contains 187 characters
Open

            \App\Db::getInstance()->createCommand()->insert('vtiger_def_org_share', ['tabid' => $moduleInstance->id, 'permission' => $permission, 'editstatus' => $editstatus])->execute();
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

    public static function allowSharing(ModuleBasic $moduleInstance, $enable = true)
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

    public static function initSharing(ModuleBasic $moduleInstance)
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

            $insertedData[] = [$id, $moduleInstance->id];
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

        \App\Db::getInstance()->createCommand()->delete('vtiger_org_share_action2tab', ['tabid' => $moduleInstance->id])->execute();
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

     * @param mixed $permissionText
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

            } else {
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

            }
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

                    ->where(['profileid' => $useProfileId, 'tabid' => $moduleInstance->id, 'activityid' => $actionId])
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

                    $db->createCommand()->update('vtiger_profile2utility', ['permission' => $permission], ['profileid' => $useProfileId, 'tabid' => $moduleInstance->id, 'activityid' => $actionId])->execute();
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

        \App\Log::trace('Deleting tools ... DONE', __METHOD__);
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

    public static function setDefaultSharing(ModuleBasic $moduleInstance, $permissionText = 'Public_ReadWriteDelete')
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

     * @param string Tool (action name) like Import, Export
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

                $profileids = Profile::getAllIds();
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

                    $db->createCommand()->insert('vtiger_profile2utility', ['profileid' => $useProfileId, 'tabid' => $moduleInstance->id, 'activityid' => $actionId, 'permission' => $permission])->execute();
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

    {
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

        $permissionText = strtolower($permissionText);
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

     *
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

            $db = \App\Db::getInstance();
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

                    ->exists();
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

     * Delete tool (actions) of the module.
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

    {
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

    }
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

     *
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

            $permission = 2;
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

            if ($profileid) {
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

                }
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

     * @param ModuleBasic $moduleInstance
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

    public static function deleteTools(ModuleBasic $moduleInstance)
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

    /**
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

     * Initialize sharing access.
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

            $permission = 1;
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

        self::syncSharingAccess();
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

     * @param mixed $profileid
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

            $profileids = [];
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

            foreach ($profileids as &$useProfileId) {
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

     * @param ModuleBasic $moduleInstance
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

Line exceeds 120 characters; contains 140 characters
Open

        \App\Db::getInstance()->createCommand()->update('vtiger_tab', ['ownedby' => $ownedBy], ['tabid' => $moduleInstance->id])->execute();
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

        $actionIds = $query->column();
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

Line exceeds 120 characters; contains 130 characters
Open

     * @param string Permission text should be one of ['Public_ReadWriteDelete', 'Public_ReadOnly', 'Public_ReadWrite', 'Private']
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

        } // public_readwritedelete is default
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

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

                $profileids[] = $profileid;
Severity: Minor
Found in vtlib/Vtiger/Access.php by phpcodesniffer

There are no issues that match your filters.

Category
Status