YetiForceCompany/YetiForceCRM

View on GitHub
modules/Vtiger/models/Action.php

Summary

Maintainability
A
2 hrs
Test Coverage
D
62%

Function getInstance has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getInstance($value, $force = false)
    {
        if (!self::$cachedInstances || $force) {
            self::$cachedInstances = self::getAll();
        }
Severity: Minor
Found in modules/Vtiger/models/Action.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 getAll has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getAll($configurable = false)
    {
        if (\App\Cache::has('Actions', 'all')) {
            $rows = \App\Cache::get('Actions', 'all');
        } else {
Severity: Minor
Found in modules/Vtiger/models/Action.php - About 55 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

Reduce the number of returns of this function 4, down to the maximum allowed 3.
Open

    public function isModuleEnabled($module)
Severity: Major
Found in modules/Vtiger/models/Action.php by sonar-php

Having too many return statements in a function increases the function's essential complexity because the flow of execution is broken each time a return statement is encountered. This makes it harder to read and understand the logic of the function.

Noncompliant Code Example

With the default threshold of 3:

function myFunction(){ // Noncompliant as there are 4 return statements
  if (condition1) {
    return true;
  } else {
    if (condition2) {
      return false;
    } else {
      return true;
    }
  }
  return false;
}

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

    public static function getAll($configurable = false)
Severity: Minor
Found in modules/Vtiger/models/Action.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

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

    public static function getInstance($value, $force = false)
Severity: Minor
Found in modules/Vtiger/models/Action.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 '86', column '17').
Open

        $query = (new App\Db\Query())->select(['profileid'])->from('vtiger_profile2standardpermissions')->where(['tabid' => $tabId, 'operation' => $this->getId()]);
Severity: Minor
Found in modules/Vtiger/models/Action.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 '154', column '17').
Open

        $query = (new App\Db\Query())->from('vtiger_actionmapping');
Severity: Minor
Found in modules/Vtiger/models/Action.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 getAllBasic has a boolean flag argument $configurable, which is a certain sign of a Single Responsibility Principle violation.
Open

    public static function getAllBasic($configurable = false)
Severity: Minor
Found in modules/Vtiger/models/Action.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 '179', column '17').
Open

            $rows = (new \App\Db\Query())->from('vtiger_actionmapping')->all();
Severity: Minor
Found in modules/Vtiger/models/Action.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 getAllUtility has a boolean flag argument $configurable, which is a certain sign of a Single Responsibility Principle violation.
Open

    public static function getAllUtility($configurable = false)
Severity: Minor
Found in modules/Vtiger/models/Action.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 '229', column '17').
Open

        $query = (new App\Db\Query())->from('vtiger_actionmapping')
Severity: Minor
Found in modules/Vtiger/models/Action.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 '205', column '17').
Open

        $query = (new App\Db\Query())->from('vtiger_actionmapping')
Severity: Minor
Found in modules/Vtiger/models/Action.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\Cache' in method 'getAll'.
Open

        if (\App\Cache::has('Actions', 'all')) {
Severity: Minor
Found in modules/Vtiger/models/Action.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\Utils' in method 'getInstance'.
Open

            $actionid = vtlib\Utils::isNumber($value) ? $value : false;
Severity: Minor
Found in modules/Vtiger/models/Action.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 getInstanceWithIdOrName uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $query->where(['actionname' => $value]);
        }
Severity: Minor
Found in modules/Vtiger/models/Action.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 'vtlib\Utils' in method 'getInstanceWithIdOrName'.
Open

        if (vtlib\Utils::isNumber($value)) {
Severity: Minor
Found in modules/Vtiger/models/Action.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\Cache' in method 'getAll'.
Open

            $rows = \App\Cache::get('Actions', 'all');
Severity: Minor
Found in modules/Vtiger/models/Action.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 getAll uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $rows = (new \App\Db\Query())->from('vtiger_actionmapping')->all();
            \App\Cache::save('Actions', 'all', $rows);
        }
Severity: Minor
Found in modules/Vtiger/models/Action.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\Cache' in method 'getAll'.
Open

            \App\Cache::save('Actions', 'all', $rows);
Severity: Minor
Found in modules/Vtiger/models/Action.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 "NOT IN" 3 times.
Open

            $query->andWhere(['NOT IN', 'actionname', self::$nonConfigurableActions]);
Severity: Critical
Found in modules/Vtiger/models/Action.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 "actionid" 5 times.
Open

        return $this->get('actionid');
Severity: Critical
Found in modules/Vtiger/models/Action.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_actionmapping" 4 times.
Open

        $query = (new App\Db\Query())->from('vtiger_actionmapping');
Severity: Critical
Found in modules/Vtiger/models/Action.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 "actionname" 7 times.
Open

        return $this->get('actionname');
Severity: Critical
Found in modules/Vtiger/models/Action.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 "Actions" 3 times.
Open

        if (\App\Cache::has('Actions', 'all')) {
Severity: Critical
Found in modules/Vtiger/models/Action.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\Query::from
Open

        $query = (new App\Db\Query())->from('vtiger_actionmapping');
Severity: Critical
Found in modules/Vtiger/models/Action.php by phan

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

        $query = (new App\Db\Query())->from('vtiger_actionmapping')
Severity: Critical
Found in modules/Vtiger/models/Action.php by phan

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

            $rows = (new \App\Db\Query())->from('vtiger_actionmapping')->all();
Severity: Critical
Found in modules/Vtiger/models/Action.php by phan

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

        $query = (new App\Db\Query())->from('vtiger_actionmapping')
Severity: Critical
Found in modules/Vtiger/models/Action.php by phan

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

        $query = (new App\Db\Query())->select(['profileid'])->from('vtiger_profile2standardpermissions')->where(['tabid' => $tabId, 'operation' => $this->getId()]);
Severity: Critical
Found in modules/Vtiger/models/Action.php by phan

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

    public static $nonConfigurableActions = ['Save', 'index', 'SavePriceBook', 'SaveVendor',
        'DetailViewAjax', 'PriceBookEditView', 'QuickCreate', 'VendorEditView',
        'DeletePriceBook', 'DeleteVendor', 'Popup', 'PriceBookDetailView',
        'VendorDetailView'];
Severity: Minor
Found in modules/Vtiger/models/Action.php by phpmd

LongVariable

Since: 0.2

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

Example

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

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

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

class Vtiger_Action_Model extends \App\Base

The class Vtiger_Action_Model is not named in CamelCase.
Open

class Vtiger_Action_Model extends \App\Base
{
    /**
     * Standard actions.
     *
Severity: Minor
Found in modules/Vtiger/models/Action.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

        'DetailViewAjax', 'PriceBookEditView', 'QuickCreate', 'VendorEditView',

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

    public static $standardActions = [0 => 'Save', 1 => 'EditView', 2 => 'Delete', 3 => 'index', 4 => 'DetailView', 7 => 'CreateView'];

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

        'DeletePriceBook', 'DeleteVendor', 'Popup', 'PriceBookDetailView',

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

     *

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

     * Non configurable actions.

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

    public static $nonConfigurableActions = ['Save', 'index', 'SavePriceBook', 'SaveVendor',

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

     *

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

        'VendorDetailView'];

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

     * @var array

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

     */

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

    /**

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

     * Utility actions.

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

    public static $utilityActions = [5 => 'Import', 6 => 'Export', 9 => 'ConvertLead'];

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

    /**

Line exceeds 120 characters; contains 135 characters
Open

    public static $standardActions = [0 => 'Save', 1 => 'EditView', 2 => 'Delete', 3 => 'index', 4 => 'DetailView', 7 => 'CreateView'];

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

     * @var array

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

     * Standard actions.

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

     * @var array

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

    {

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

        return false;

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

            return false;

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 instance by id or name.

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

    public function isUtilityTool()

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

            $className = 'Vtiger_Utility_Model';

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

     * Return instance.

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

     *

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

    public static function getInstanceWithIdOrName($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

        if ($row) {

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

     * @return Vtiger_Action_Model[]

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 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

    }

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

            return true;

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

        return $actionModel->setData($row);

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

     * @param int|string $value

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

    public static function getAll($configurable = false)

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

     * @return string

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

        return $this->get('actionname');

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

        if (\in_array($this->getName(), self::$standardActions)) {

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

     */

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

    protected static $cachedInstances = null;

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

    public static function getInstance($value, $force = false)

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 ($instance->get('actionid') == $actionid) {

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

     * @return bool

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

        $tabId = $module->getId();

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

     * @var array

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

        }

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

            foreach (self::$cachedInstances as $instance) {

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

     * @param Vtiger_Module_Model $module

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

        if ($configurable) {

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 false;

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

    /**

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

     * Cached instances.

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

        $query = (new App\Db\Query())->from('vtiger_actionmapping');

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

            $query->where(['actionname' => $value]);

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

        return null;

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

                    unset($rows[$key]);

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

            $actionModels[$row['actionname']] = self::getInstanceFromRow($row);

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

     * Function to get all instances models of basic action.

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

            return true;

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

    }

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

     * @param bool $force

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

            $actionid = vtlib\Utils::isNumber($value) ? $value : false;

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

        return $actionModels;

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

     * Return action name.

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 isModuleEnabled($module)

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

    /**

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

     *

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

     * @param array $row

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

    public static function getInstanceFromRow($row)

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

        if (!\in_array($actionName, self::$standardActions)) {

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

            }

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

        }

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

     * @param bool $configurable

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 $this->get('actionid');

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

     * Check if is a utility tool.

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

     * @return Vtiger_Action_Model

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

        $className = 'Vtiger_Action_Model';

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

        $actionModel = new $className();

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 $instance;

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

        return null;

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

            foreach ($rows as $key => &$row) {

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

        foreach ($rows as &$row) {

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

     * @return int

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 Vtiger_Action_Model|null

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

        if (self::$cachedInstances) {

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

            $rows = (new \App\Db\Query())->from('vtiger_actionmapping')->all();

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

        $actionModels = [];

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

    }

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

            ->where(['actionid' => array_keys(self::$standardActions)]);

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

        $actionModels = [];

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

        while ($row = $dataReader->read()) {

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

        }

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

     * Create instance from record row.

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

            self::$cachedInstances = self::getAll();

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 Vtiger_Action_Model|null

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

        if (vtlib\Utils::isNumber($value)) {

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

        if (\App\Cache::has('Actions', 'all')) {

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 bool

Line exceeds 120 characters; contains 164 characters
Open

        $query = (new App\Db\Query())->select(['profileid'])->from('vtiger_profile2standardpermissions')->where(['tabid' => $tabId, 'operation' => $this->getId()]);

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

    }

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

     * Check if module is enabled.

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

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

            if (false === $actionid && isset(self::$cachedInstances[$value])) {

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

     * @param int  $value

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

                return self::$cachedInstances[$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

        }

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

                if (\in_array($row['actionname'], self::$nonConfigurableActions)) {

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

        $row = $query->one();

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 all instances.

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

        $dataReader->close();

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

     *

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

        while ($row = $dataReader->read()) {

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 (!self::$cachedInstances || $force) {

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

    /**

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

     */

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

            $query->where(['actionid' => $value])->limit(1);

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

        }

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

        } else {

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

     * @param bool $configurable

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

    public static function getAllUtility($configurable = false)

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

        $dataReader = $query->createCommand()->query();

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

        }

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

            $actionModels[] = self::getInstanceFromRow($row);

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

        return $actionModels;

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 (!$module->isEntityModule()) {

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

        }

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

        $actionName = $row['actionname'];

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

            return self::getInstanceFromRow($row);

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

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

        }

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

        $dataReader = $query->createCommand()->query();

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

        $query = (new App\Db\Query())->from('vtiger_actionmapping')

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

        if ($configurable) {

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

     * Return action id.

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

    public function getId()

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

        $query = (new App\Db\Query())->select(['profileid'])->from('vtiger_profile2standardpermissions')->where(['tabid' => $tabId, 'operation' => $this->getId()]);

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

            $rows = \App\Cache::get('Actions', 'all');

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

            \App\Cache::save('Actions', 'all', $rows);

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

     * @param bool $configurable

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

            $actionModels[] = self::getInstanceFromRow($row);

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

        $query = (new App\Db\Query())->from('vtiger_actionmapping')

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

     */

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

    public static function getAllBasic($configurable = false)

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

     */

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

            $query->andWhere(['NOT IN', 'actionname', self::$nonConfigurableActions]);

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

     * @return self[]

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

            $query->andWhere(['NOT IN', 'actionname', self::$nonConfigurableActions]);

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

        $dataReader->close();

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

        return $actionModels;

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

        $actionModels = [];

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

     * Function to get all instances models of utility action.

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

            ->where(['NOT IN', 'actionid', array_keys(self::$standardActions)]);

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 self[]

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

class Vtiger_Action_Model extends \App\Base

There are no issues that match your filters.

Category
Status