YetiForceCompany/YetiForceCRM

View on GitHub
vtlib/Vtiger/Block.php

Summary

Maintainability
A
25 mins
Test Coverage
B
81%

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

    public static function getInstance($value, $module = false)
    {
        $tabId = is_numeric($module) ? $module : \App\Module::getModuleId($module);
        $cacheName = $value . '|' . $tabId;
        if (\App\Cache::has('BlockInstance', $cacheName)) {
Severity: Minor
Found in vtlib/Vtiger/Block.php - About 25 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

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

    public function delete($recursive = true)
Severity: Minor
Found in vtlib/Vtiger/Block.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 $module, which is a certain sign of a Single Responsibility Principle violation.
Open

    public static function getInstance($value, $module = false)
Severity: Minor
Found in vtlib/Vtiger/Block.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 '202', column '18').
Open

            $query = (new \App\Db\Query())->from(self::$baseTable);
Severity: Minor
Found in vtlib/Vtiger/Block.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 '231', column '19').
Open

            $blocks = (new \App\Db\Query())->from(self::$baseTable)
Severity: Minor
Found in vtlib/Vtiger/Block.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 '50', column '15').
Open

        return (new \App\Db\Query())->from(self::$baseTable)->where(['tabid' => $this->tabid])->max('sequence') + 1;
Severity: Minor
Found in vtlib/Vtiger/Block.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 deleteForModule has a boolean flag argument $recursive, which is a certain sign of a Single Responsibility Principle violation.
Open

    public static function deleteForModule(ModuleBasic $moduleInstance, $recursive = true)
Severity: Minor
Found in vtlib/Vtiger/Block.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

Avoid using static access to class '\App\Cache' in method 'getAllForModule'.
Open

            $blocks = \App\Cache::get('BlocksForModule', $moduleInstance->id);
Severity: Minor
Found in vtlib/Vtiger/Block.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 '__delete'.
Open

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

            } else {
                $query->where(['blocklabel' => $value, 'tabid' => $tabId]);
            }
Severity: Minor
Found in vtlib/Vtiger/Block.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\Db' in method 'deleteForModule'.
Open

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

        } else {
            if ($moduleInstance) {
                $this->tabid = $moduleInstance->getId();
                $this->module = $moduleInstance;
            }
Severity: Minor
Found in vtlib/Vtiger/Block.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 'getInstance'.
Open

            if (Utils::isNumber($value)) {
Severity: Minor
Found in vtlib/Vtiger/Block.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 'getInstance'.
Open

        $tabId = is_numeric($module) ? $module : \App\Module::getModuleId($module);
Severity: Minor
Found in vtlib/Vtiger/Block.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 'getInstance'.
Open

            $data = \App\Cache::get('BlockInstance', $cacheName);
Severity: Minor
Found in vtlib/Vtiger/Block.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\Field' in method 'delete'.
Open

            $fields = Field::getAllForBlock($this);
Severity: Minor
Found in vtlib/Vtiger/Block.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 '__create'.
Open

        \App\Log::trace("Creating Block $this->label ... DONE", __METHOD__);
Severity: Minor
Found in vtlib/Vtiger/Block.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 '__create'.
Open

        \App\Log::trace("Module language entry for $this->label ... CHECK", __METHOD__);
Severity: Minor
Found in vtlib/Vtiger/Block.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 'getInstance'.
Open

        if (\App\Cache::has('BlockInstance', $cacheName)) {
Severity: Minor
Found in vtlib/Vtiger/Block.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 getAllForModule uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $blocks = (new \App\Db\Query())->from(self::$baseTable)
                ->where(['tabid' => $moduleInstance->id])
                ->orderBy(['sequence' => SORT_ASC])
                ->all();
Severity: Minor
Found in vtlib/Vtiger/Block.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 'getAllForModule'.
Open

            \App\Cache::save('BlocksForModule', $moduleInstance->id, $blocks);
Severity: Minor
Found in vtlib/Vtiger/Block.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 '__create'.
Open

        $db = \App\Db::getInstance();
Severity: Minor
Found in vtlib/Vtiger/Block.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 '__delete'.
Open

        \App\Log::trace("Deleting Block $this->label ... ", __METHOD__);
Severity: Minor
Found in vtlib/Vtiger/Block.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 getInstance uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $query = (new \App\Db\Query())->from(self::$baseTable);
            if (Utils::isNumber($value)) {
                $query->where(['blockid' => $value]);
            } else {
Severity: Minor
Found in vtlib/Vtiger/Block.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\Field' in method 'deleteForModule'.
Open

            Field::deleteForModule($moduleInstance);
Severity: Minor
Found in vtlib/Vtiger/Block.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 'getInstance'.
Open

            \App\Cache::save('BlockInstance', $cacheName, $data);
Severity: Minor
Found in vtlib/Vtiger/Block.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 'getAllForModule'.
Open

        if (\App\Cache::has('BlocksForModule', $moduleInstance->id)) {
Severity: Minor
Found in vtlib/Vtiger/Block.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 'deleteForModule'.
Open

        \App\Log::trace('Deleting blocks for module ... DONE', __METHOD__);
Severity: Minor
Found in vtlib/Vtiger/Block.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 '__update'.
Open

        \App\Log::trace("Updating Block {$this->label} [tabId:{$this->tabid}] ... DONE", __METHOD__);
Severity: Minor
Found in vtlib/Vtiger/Block.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\Module' in method 'initialize'.
Open

        $this->module = Module::getInstance($this->tabid);
Severity: Minor
Found in vtlib/Vtiger/Block.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 "visible" 3 times.
Open

        $this->visible = $valuemap['visible'] ?? $this->visible ?? 0;
Severity: Critical
Found in vtlib/Vtiger/Block.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 "detail_view" 3 times.
Open

        $this->indetailview = $valuemap['detail_view'] ?? $this->indetailview ?? 0;
Severity: Critical
Found in vtlib/Vtiger/Block.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 "show_title" 3 times.
Open

        $this->showtitle = $valuemap['show_title'] ?? $this->showtitle ?? null;
Severity: Critical
Found in vtlib/Vtiger/Block.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" 7 times.
Open

        return (new \App\Db\Query())->from(self::$baseTable)->where(['tabid' => $this->tabid])->max('sequence') + 1;
Severity: Critical
Found in vtlib/Vtiger/Block.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 "iscustom" 3 times.
Open

        $this->iscustom = $valuemap['iscustom'] ?? $this->iscustom ?? null;
Severity: Critical
Found in vtlib/Vtiger/Block.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 "blockid" 4 times.
Open

        $this->id = $valuemap['blockid'] ?? $this->id ?? null;
Severity: Critical
Found in vtlib/Vtiger/Block.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 "display_status" 3 times.
Open

        $this->display_status = $valuemap['display_status'] ?? $this->display_status ?? null;
Severity: Critical
Found in vtlib/Vtiger/Block.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 "BlocksForModule" 3 times.
Open

        if (\App\Cache::has('BlocksForModule', $moduleInstance->id)) {
Severity: Critical
Found in vtlib/Vtiger/Block.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 "create_view" 3 times.
Open

        $this->increateview = $valuemap['create_view'] ?? $this->increateview ?? 0;
Severity: Critical
Found in vtlib/Vtiger/Block.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 "edit_view" 3 times.
Open

        $this->ineditview = $valuemap['edit_view'] ?? $this->ineditview ?? 0;
Severity: Critical
Found in vtlib/Vtiger/Block.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 "blocklabel" 4 times.
Open

        $this->label = $valuemap['blocklabel'] ?? $this->label ?? null;
Severity: Critical
Found in vtlib/Vtiger/Block.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 "sequence" 5 times.
Open

        return (new \App\Db\Query())->from(self::$baseTable)->where(['tabid' => $this->tabid])->max('sequence') + 1;
Severity: Critical
Found in vtlib/Vtiger/Block.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 "BlockInstance" 3 times.
Open

        if (\App\Cache::has('BlockInstance', $cacheName)) {
Severity: Critical
Found in vtlib/Vtiger/Block.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 method trace from undeclared class \App\Log
Open

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

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

            $query = (new \App\Db\Query())->from(self::$baseTable);
Severity: Critical
Found in vtlib/Vtiger/Block.php by phan

Saw possibly unextractable annotation for a fragment of comment '* @param int|string block id or block label': after int|string, did not see an element name (will guess based on comment order)
Open

     * @param int|string block id or block label
Severity: Info
Found in vtlib/Vtiger/Block.php by phan

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

        $db->createCommand()->delete(self::$baseTable, ['tabid' => $tabId])->execute();
Severity: Critical
Found in vtlib/Vtiger/Block.php by phan

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

        return (new \App\Db\Query())->from(self::$baseTable)->where(['tabid' => $this->tabid])->max('sequence') + 1;
Severity: Critical
Found in vtlib/Vtiger/Block.php by phan

Return type of addField() is undeclared type \vtlib\Reference
Open

    public function addField(FieldBasic $fieldInstance)
Severity: Minor
Found in vtlib/Vtiger/Block.php by phan

Argument 2 (key) is false but \App\Cache::has() takes string defined at /code/app/Cache.php:74
Open

        if (\App\Cache::has('BlocksForModule', $moduleInstance->id)) {
Severity: Minor
Found in vtlib/Vtiger/Block.php by phan

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

            $blocks = (new \App\Db\Query())->from(self::$baseTable)
Severity: Critical
Found in vtlib/Vtiger/Block.php by phan

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

        \App\Db::getInstance()
Severity: Critical
Found in vtlib/Vtiger/Block.php by phan

Saw possibly unextractable annotation for a fragment of comment '* @param Module Instance of the module to which this block is associated': after Module, did not see an element name (will guess based on comment order)
Open

     * @param Module Instance of the module to which this block is associated
Severity: Info
Found in vtlib/Vtiger/Block.php by phan

Returning type array<int>|array{}</int> but getAllForModule() is declared to return \vtlib\Block
Open

        return $instances;
Severity: Minor
Found in vtlib/Vtiger/Block.php by phan

Doc-block of $moduleInstance in save contains phpdoc param type mixed which is incompatible with the param type ?\vtlib\ModuleBasic declared in the signature
Open

     * @param mixed $moduleInstance
Severity: Minor
Found in vtlib/Vtiger/Block.php by phan

Call with 1 arg(s) to \vtlib\Field::delete() which only takes 0 arg(s) defined at /code/vtlib/Vtiger/FieldBasic.php:316
Open

                $fieldInstance->delete($recursive);
Severity: Info
Found in vtlib/Vtiger/Block.php by phan

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

        $db->createCommand()->insert(self::$baseTable, [
Severity: Critical
Found in vtlib/Vtiger/Block.php by phan

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

        \App\Db::getInstance()->createCommand()->delete(self::$baseTable, ['blockid' => $this->id])->execute();
Severity: Critical
Found in vtlib/Vtiger/Block.php by phan

Expected @param annotation for value to be before the @param annotation for module
Open

     * @param mixed $module Mixed id or name of the module
Severity: Info
Found in vtlib/Vtiger/Block.php by phan

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

        \App\Log::trace("Deleting Block $this->label ... ", __METHOD__);
Severity: Critical
Found in vtlib/Vtiger/Block.php by phan

Saw possibly unextractable annotation for a fragment of comment '* @param bool True to delete associated fields, False to avoid it': after bool, did not see an element name (will guess based on comment order)
Open

     * @param bool True to delete associated fields, False to avoid it
Severity: Info
Found in vtlib/Vtiger/Block.php by phan

Argument 2 (key) is false but \App\Cache::get() takes string defined at /code/app/Cache.php:61
Open

            $blocks = \App\Cache::get('BlocksForModule', $moduleInstance->id);
Severity: Minor
Found in vtlib/Vtiger/Block.php by phan

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

        \App\Log::trace("Updating Block {$this->label} [tabId:{$this->tabid}] ... DONE", __METHOD__);
Severity: Critical
Found in vtlib/Vtiger/Block.php by phan

Return type of getInstance() is undeclared type \self
Open

    public static function getInstance($value, $module = false)
Severity: Minor
Found in vtlib/Vtiger/Block.php by phan

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

        $db->createCommand()->delete('vtiger_module_dashboard_blocks', ['tabid' => $tabId])->execute();
Severity: Critical
Found in vtlib/Vtiger/Block.php by phan

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

        \App\Log::trace("Module language entry for $this->label ... CHECK", __METHOD__);
Severity: Critical
Found in vtlib/Vtiger/Block.php by phan

Argument 2 (key) is false but \App\Cache::save() takes string defined at /code/app/Cache.php:89
Open

            \App\Cache::save('BlocksForModule', $moduleInstance->id, $blocks);
Severity: Minor
Found in vtlib/Vtiger/Block.php by phan

Saw an @param annotation for module, but it was not found in the param list of function initialize(mixed $valuemap)
Open

     * @param mixed $module   Mixed id or name of the module
Severity: Info
Found in vtlib/Vtiger/Block.php by phan

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

     * @param bool true to delete associated fields, false otherwise
Severity: Info
Found in vtlib/Vtiger/Block.php by phan

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

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

Saw possibly unextractable annotation for a fragment of comment '* @param array Map of column name and value': after array, did not see an element name (will guess based on comment order)
Open

     * @param array Map of column name and value
Severity: Info
Found in vtlib/Vtiger/Block.php by phan

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

        \App\Log::trace("Creating Block $this->label ... DONE", __METHOD__);
Severity: Critical
Found in vtlib/Vtiger/Block.php by phan

Returning type \vtlib\Block but addField() is declared to return \vtlib\Reference
Open

        return $this;
Severity: Minor
Found in vtlib/Vtiger/Block.php by phan

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

        $db = \App\Db::getInstance();
Severity: Minor
Found in vtlib/Vtiger/Block.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

The property $display_status is not named in camelCase.
Open

class Block
{
    /** ID of this block instance */
    public $id;
    /** Tab id  */
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpmd

CamelCasePropertyName

Since: 0.2

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

Example

class ClassName {
    protected $property_name;
}

Source

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

    public $id;
Severity: Minor
Found in vtlib/Vtiger/Block.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

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

        $db = \App\Db::getInstance();
Severity: Minor
Found in vtlib/Vtiger/Block.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

     * @var string
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

    public $id;
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

    /** Tab id  */
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

    public static $baseTable = 'vtiger_blocks';
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

    /** ID of this block instance */
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

    public $label;
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

    public $indetailview = 0;
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

    public $iscustom = 0;
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

    public $sequence;
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

    public $visible = 0;
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

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

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

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

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

    public $icon;
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

    /** Label for this block instance */
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

    public $increateview = 0;
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

    public $display_status = 1;
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

    public $showtitle = 0;
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

    public $ineditview = 0;
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

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

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

                'visible' => $this->visible,
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

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

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

    public function __delete()
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

        return (new \App\Db\Query())->from(self::$baseTable)->where(['tabid' => $this->tabid])->max('sequence') + 1;
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

     * @param mixed $module   Mixed id or name of the module
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

        $this->iscustom = $valuemap['iscustom'] ?? $this->iscustom ?? null;
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

            ->createCommand()
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

            ], ['blockid' => $this->id])->execute();
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

        \App\Log::trace("Deleting Block $this->label ... ", __METHOD__);
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

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

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

    public function __getNextSequence()
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

        $this->id = $valuemap['blockid'] ?? $this->id ?? null;
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

            'tabid' => $this->tabid,
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

            'blocklabel' => $this->label,
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

            'visible' => $this->visible,
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

                'display_status' => $this->display_status,
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

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

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

            'edit_view' => $this->ineditview,
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

        return $this->id;
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

    public function __update()
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

        \App\Db::getInstance()
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

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

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

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

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

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

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

        $this->label = $valuemap['blocklabel'] ?? $this->label ?? null;
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

            ->update(self::$baseTable, [
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

     * Create vtiger CRM block.
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

    public function save(?ModuleBasic $moduleInstance = null)
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

            'create_view' => $this->increateview,
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

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

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

        \App\Log::trace("Creating Block $this->label ... DONE", __METHOD__);
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

     * @param bool True to delete associated fields, False to avoid it
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

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

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

     * Add field to this block.
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

                'show_title' => $this->showtitle,
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

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

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

     * @param array Map of column name and value
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

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

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

    public static function getInstance($value, $module = false)
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

    public function delete($recursive = true)
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

        if (!$this->sequence) {
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

            'sequence' => $this->sequence,
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

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

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

            foreach ($fields as $fieldInstance) {
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

                'create_view' => $this->increateview,
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

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

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

     * Get instance of block.
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

                'detail_view' => $this->indetailview,
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

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

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

            $this->__create();
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

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

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

        $tabId = is_numeric($module) ? $module : \App\Module::getModuleId($module);
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

        $this->id = $db->getLastInsertID(self::$baseTable . '_blockid_seq');
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

                'edit_view' => $this->ineditview,
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

                'iscustom' => $this->iscustom,
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

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

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

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

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

        \App\Db::getInstance()->createCommand()->delete(self::$baseTable, ['blockid' => $this->id])->execute();
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

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

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

     * Save this block instance.
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        if ($this->id) {
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

            $this->__update();
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

                $this->module = $moduleInstance;
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

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

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

     * @return Reference to this block instance
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

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

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

    public function addField(FieldBasic $fieldInstance)
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

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

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

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

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

            $data = \App\Cache::get('BlockInstance', $cacheName);
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

     * Get next sequence value to use for this block instance.
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

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

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

        $this->display_status = $valuemap['display_status'] ?? $this->display_status ?? null;
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

                $this->tabid = $moduleInstance->getId();
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

     * Delete block instance.
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

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

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

     * @return \self
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

    public $tabid;
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

    public $module;
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

     * Basic table name.
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

    public function __create()
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

            $this->display_status = 1;
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

            'detail_view' => $this->indetailview,
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

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

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

                'blocklabel' => $this->label,
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

    {
Severity: Minor
Found in vtlib/Vtiger/Block.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/Block.php by phpcodesniffer

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

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

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

            $fields = Field::getAllForBlock($this);
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

        $fieldInstance->save($this);
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

        return $this;
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

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

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

        if (\App\Cache::has('BlockInstance', $cacheName)) {
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

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

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

    public function initialize($valuemap)
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

        $this->indetailview = $valuemap['detail_view'] ?? $this->indetailview ?? 0;
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

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

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

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

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

     * @param Module Instance of the module to which this block is associated
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

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

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

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

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

     * Initialize this block instance.
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

        $this->sequence = $valuemap['sequence'] ?? $this->sequence ?? null;
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

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

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

            'display_status' => $this->display_status,
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

            'icon' => $this->icon,
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

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

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

        \App\Log::trace("Updating Block {$this->label} [tabId:{$this->tabid}] ... DONE", __METHOD__);
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

        $this->showtitle = $valuemap['show_title'] ?? $this->showtitle ?? null;
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

        $this->module = Module::getInstance($this->tabid);
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

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

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

            'show_title' => $this->showtitle,
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

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

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

                'icon' => $this->icon,
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

        $this->tabid = $valuemap['tabid'] ?? $this->tabid;
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

        $this->increateview = $valuemap['create_view'] ?? $this->increateview ?? 0;
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

     */
Severity: Minor
Found in vtlib/Vtiger/Block.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/Block.php by phpcodesniffer

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

                'sequence' => $this->sequence,
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

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

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

                $fieldInstance->delete($recursive);
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

        $this->__delete();
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

     * @param FieldBasic $fieldInstance
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

     * @return int
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

        $this->ineditview = $valuemap['edit_view'] ?? $this->ineditview ?? 0;
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

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

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

        if (0 != $this->display_status) {
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

        $db->createCommand()->insert(self::$baseTable, [
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

        \App\Log::trace("Module language entry for $this->label ... CHECK", __METHOD__);
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

     * Delete this instance.
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

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

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

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

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

     * @param int|string block id or block label
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

        $cacheName = $value . '|' . $tabId;
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

        $this->visible = $valuemap['visible'] ?? $this->visible ?? 0;
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

        $this->icon = $valuemap['icon'] ?? $this->icon ?? null;
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

            $this->sequence = $this->__getNextSequence();
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

            'iscustom' => $this->iscustom,
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

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

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

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

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

     * @param mixed $module Mixed id or name of the module
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

                $query->where(['blockid' => $value]);
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

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

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

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

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

        }
Severity: Minor
Found in vtlib/Vtiger/Block.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/Block.php by phpcodesniffer

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

            \App\Cache::save('BlockInstance', $cacheName, $data);
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

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

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

            $instances[] = $instance;
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

     * Delete all blocks associated with module.
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

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

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

            $instance->initialize($data);
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

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

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

     * Get all block instances associated with the module.
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

            $blocks = \App\Cache::get('BlocksForModule', $moduleInstance->id);
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

                ->orderBy(['sequence' => SORT_ASC])
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

        return $instances;
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

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

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

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

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

                ->where(['tabid' => $moduleInstance->id])
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

        $db->createCommand()->delete(self::$baseTable, ['tabid' => $tabId])->execute();
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

                $query->where(['blocklabel' => $value, 'tabid' => $tabId]);
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

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

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

    public static function deleteForModule(ModuleBasic $moduleInstance, $recursive = true)
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

            $query = (new \App\Db\Query())->from(self::$baseTable);
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

            $data = $query->one();
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

            \App\Cache::save('BlocksForModule', $moduleInstance->id, $blocks);
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

        foreach ($blocks as $row) {
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

            $instance = new self();
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

            $instance->initialize($row);
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

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

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

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

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

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

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

     * @return self
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

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

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

     * @param bool true to delete associated fields, false otherwise
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

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

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

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

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

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

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

        return $instance;
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

            Field::deleteForModule($moduleInstance);
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

        $db->createCommand()->delete('vtiger_module_dashboard_blocks', ['tabid' => $tabId])->execute();
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

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

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

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

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

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

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

        $tabId = $moduleInstance->getId();
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

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

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

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

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

            if (Utils::isNumber($value)) {
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

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

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

        $instance = false;
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

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

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

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

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

            $instance = new self();
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

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

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

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

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

        if (\App\Cache::has('BlocksForModule', $moduleInstance->id)) {
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

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

            $blocks = (new \App\Db\Query())->from(self::$baseTable)
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpcodesniffer

The method __getNextSequence is not named in camelCase.
Open

    public function __getNextSequence()
    {
        return (new \App\Db\Query())->from(self::$baseTable)->where(['tabid' => $this->tabid])->max('sequence') + 1;
    }
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpmd

CamelCaseMethodName

Since: 0.2

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

Example

class ClassName {
    public function get_name() {
    }
}

Source

The method __create is not named in camelCase.
Open

    public function __create()
    {
        $db = \App\Db::getInstance();
        if (!$this->sequence) {
            $this->sequence = $this->__getNextSequence();
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpmd

CamelCaseMethodName

Since: 0.2

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

Example

class ClassName {
    public function get_name() {
    }
}

Source

The method __update is not named in camelCase.
Open

    public function __update()
    {
        \App\Db::getInstance()
            ->createCommand()
            ->update(self::$baseTable, [
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpmd

CamelCaseMethodName

Since: 0.2

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

Example

class ClassName {
    public function get_name() {
    }
}

Source

The method __delete is not named in camelCase.
Open

    public function __delete()
    {
        \App\Log::trace("Deleting Block $this->label ... ", __METHOD__);
        \App\Db::getInstance()->createCommand()->delete(self::$baseTable, ['blockid' => $this->id])->execute();
        \App\Log::trace('DONE', __METHOD__);
Severity: Minor
Found in vtlib/Vtiger/Block.php by phpmd

CamelCaseMethodName

Since: 0.2

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

Example

class ClassName {
    public function get_name() {
    }
}

Source

There are no issues that match your filters.

Category
Status