YetiForceCompany/YetiForceCRM

View on GitHub
app/Anonymization.php

Summary

Maintainability
A
1 hr
Test Coverage
B
80%

Function anonymize has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function anonymize(): self
    {
        if (empty($this->data)) {
            return $this;
        }
Severity: Minor
Found in app/Anonymization.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

The method anonymize() has an NPath complexity of 240. The configured NPath complexity threshold is 200.
Open

    public function anonymize(): self
    {
        if (empty($this->data)) {
            return $this;
        }
Severity: Minor
Found in app/Anonymization.php by phpmd

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

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

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

    public function anonymize(): self
    {
        if (empty($this->data)) {
            return $this;
        }
Severity: Minor
Found in app/Anonymization.php by phpmd

CyclomaticComplexity

Since: 0.1

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

Example

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

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

Refactor this function to reduce its Cognitive Complexity from 16 to the 15 allowed.
Open

    public function anonymize(): self
Severity: Critical
Found in app/Anonymization.php by sonar-php

Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

See

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

            $fields = (new \App\Db\Query())->select(['vtiger_field.fieldname'])->from('s_#__fields_anonymization')
Severity: Minor
Found in app/Anonymization.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Avoid assigning values to variables in if clauses and the like (line '139', column '38').
Open

    public function anonymize(): self
    {
        if (empty($this->data)) {
            return $this;
        }
Severity: Minor
Found in app/Anonymization.php by phpmd

IfStatementAssignment

Since: 2.7.0

Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

Example

class Foo
{
    public function bar($flag)
    {
        if ($foo = 'bar') { // possible typo
            // ...
        }
        if ($baz = 0) { // always false
            // ...
        }
    }
}

Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

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

        } else {
            $fields = (new \App\Db\Query())->select(['vtiger_field.fieldname'])->from('s_#__fields_anonymization')
                ->innerJoin('vtiger_field', 'vtiger_field.fieldid = s_#__fields_anonymization.field_id')
                ->where(['tabid' => $moduleId])
                ->column();
Severity: Minor
Found in app/Anonymization.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 'getFields'.
Open

            Cache::save('getFieldsFromRelation', $moduleId, $fields, Cache::LONG);
Severity: Minor
Found in app/Anonymization.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 'anonymize'.
Open

            if (!empty($this->moduleName) && ($fields = self::getFields(Module::getModuleId($this->moduleName)))) {
Severity: Minor
Found in app/Anonymization.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 'getFields'.
Open

            $fields = Cache::get('getFieldsFromRelation', $moduleId);
Severity: Minor
Found in app/Anonymization.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 'getFields'.
Open

        if (Cache::has('getFieldsFromRelation', $moduleId)) {
Severity: Minor
Found in app/Anonymization.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 "getFieldsFromRelation" 3 times.
Open

        if (Cache::has('getFieldsFromRelation', $moduleId)) {
Severity: Critical
Found in app/Anonymization.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.

Rename "$fields" which has the same name as the field declared at line 70.
Open

            if (!empty($this->moduleName) && ($fields = self::getFields(Module::getModuleId($this->moduleName)))) {
Severity: Major
Found in app/Anonymization.php by sonar-php

Shadowing fields with a local variable is a bad practice that reduces code readability: it makes it confusing to know whether the field or the variable is being used.

Noncompliant Code Example

class Foo {
  public $myField;

  public function doSomething() {
    $myField = 0;
    ...
  }
}

See

Rename "$value" which has the same name as the field declared at line 62.
Open

                $value = $this->value;
Severity: Major
Found in app/Anonymization.php by sonar-php

Shadowing fields with a local variable is a bad practice that reduces code readability: it makes it confusing to know whether the field or the variable is being used.

Noncompliant Code Example

class Foo {
  public $myField;

  public function doSomething() {
    $myField = 0;
    ...
  }
}

See

Doc-block of anonymize contains declared return type void which is incompatible with the return type \App\Anonymization declared in the signature
Open

     * @return void
Severity: Minor
Found in app/Anonymization.php by phan

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

            $fields = (new \App\Db\Query())->select(['vtiger_field.fieldname'])->from('s_#__fields_anonymization')
Severity: Critical
Found in app/Anonymization.php by phan

Assigning string to property but \App\Anonymization->value is bool
Open

    public $value = '****';
Severity: Minor
Found in app/Anonymization.php by phan

Doc-block of getData contains declared return type \App\Anonymization which is incompatible with the return type array declared in the signature
Open

     * @return self
Severity: Minor
Found in app/Anonymization.php by phan

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

            Cache::save('getFieldsFromRelation', $moduleId, $fields, Cache::LONG);
Severity: Minor
Found in app/Anonymization.php by phan

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

            $fields = Cache::get('getFieldsFromRelation', $moduleId);
Severity: Minor
Found in app/Anonymization.php by phan

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

        if (Cache::has('getFieldsFromRelation', $moduleId)) {
Severity: Minor
Found in app/Anonymization.php by phan

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

     * Gets Anonymization types.
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    public $detectModuleName = true;
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     * @return array
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    public static function getTypes(): array
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     * @var array Word map for anonymization.
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    public const LOGS = 0;
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    /**
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     *
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     */
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     * @var string[] Keys to ananimation
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    /** @var int Anonymization of change history entries on the displayed data layer. */
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     */
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    {
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     */
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     * @var bool Detect module name if not there
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     */
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    /**
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    protected $fields;
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

        ];
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    protected $data;
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    /**
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     */
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     */
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    public const MODTRACKER_DISPLAY = 1;
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    }
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    /**
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    public const MODTRACKER_DB = 2;
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

            self::LOGS => 'LBL_ANONYMIZATION_LOGS',
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

            self::MODTRACKER_DISPLAY => 'LBL_ANONYMIZATION_MODTRACKER_DISPLAY',
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    protected $map;
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    /**
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     */
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    /**
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     * @var array Data array
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    /**
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     * @var string Module name
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    /** @var int Anonymization logs */
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

            self::MODTRACKER_DB => 'LBL_ANONYMIZATION_MODTRACKER_DB',
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

        return [
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    /**
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    ];
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     * @var bool Value for anonymised data
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    /** @var int Anonymization of change history entries on the database layer. */
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     */
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

        'password' => ['pass', 'password', 'oldPassword', 'retype_password', 'db_password'],
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     * @var string Map name
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    public $value = '****';
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    const MAPS = [
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    protected $moduleName;
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    /**
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

Line exceeds 120 characters; contains 135 characters
Open

        $mapFields = 'all' === $this->map ? self::MAPS : (isset(self::MAPS[$this->map]) ? [$this->map => self::MAPS[$this->map]] : []);
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

        return $data;
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     * Get list of fields for anonymized.
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    {
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

                ->where(['tabid' => $moduleId])
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

        return $fields;
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    {
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

        $this->map = $map;
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    {
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    }
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    {
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

        if (empty($this->data)) {
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

        $mapFields = 'all' === $this->map ? self::MAPS : (isset(self::MAPS[$this->map]) ? [$this->map => self::MAPS[$this->map]] : []);
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

        }
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     * Anonymize by fields.
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     *
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    private function anonymizeByFields(array $data): array
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

            if (\in_array($key, $this->fields, true)) {
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     * @return string[]
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

            $fields = (new \App\Db\Query())->select(['vtiger_field.fieldname'])->from('s_#__fields_anonymization')
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     * @param string $moduleName
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     * @return self
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    {
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

                $this->data = $this->anonymizeByFields($this->data);
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

        foreach ($data as $key => &$value) {
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    }
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     *
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    public function getData(): array
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    /**
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     */
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     */
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

        return $this->data;
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

        }
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    }
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     * @return array
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     * Set module name.
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     * Data anonymization.
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    }
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     *
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     * @return void
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     * @param string $map
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    public function __construct(string $map = 'all')
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    }
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

        return $this;
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

        return $this;
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     * @return void
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

                $this->detectModuleName();
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

            }
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    private function detectModuleName(): void
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

        if (!empty($this->data['module'])) {
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    /**
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    /**
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

        }
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

                $this->fields = $fields;
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

                $this->data = $this->anonymizeByFields($this->data);
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     *
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

                $value = $this->value;
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

                $value = $this->anonymizeByFields($value);
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

            Cache::save('getFieldsFromRelation', $moduleId, $fields, Cache::LONG);
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     */
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    public function setModuleName(string $moduleName): self
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

        $this->moduleName = $moduleName;
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    public function setData(array $data): self
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    /**
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     * Detect module name.
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    {
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     */
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    /**
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     * Anonymization constructor.
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

            return $this;
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

            if (!empty($this->moduleName) && ($fields = self::getFields(Module::getModuleId($this->moduleName)))) {
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

                $this->fields = $fields;
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     */
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

                ->innerJoin('vtiger_field', 'vtiger_field.fieldid = s_#__fields_anonymization.field_id')
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     * @return self
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    /**
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     * @return self
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    public function anonymize(): self
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    {
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

            } elseif (\is_array($value)) {
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     *
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     *
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     *
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    }
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    {
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    /**
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     * Get data.
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     *
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

        }
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     *
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

        if (Cache::has('getFieldsFromRelation', $moduleId)) {
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

        } else {
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     */
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

        $this->data = $data;
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    }
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    }
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

            foreach ($mapFields as $fields) {
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

        if (('all' === $this->map || 'fields' === $this->map) && (!empty($this->moduleName) || $this->detectModuleName)) {
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

Line exceeds 120 characters; contains 122 characters
Open

        if (('all' === $this->map || 'fields' === $this->map) && (!empty($this->moduleName) || $this->detectModuleName)) {
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

        }
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

            $fields = Cache::get('getFieldsFromRelation', $moduleId);
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

                ->column();
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     * Set data.
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     *
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     *
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     *
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     */
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

        if ($mapFields) {
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

            }
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

            }
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

            $this->moduleName = $this->data['module'];
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

        }
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

    public static function getFields(int $moduleId): array
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     * @param array $data
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

            if (empty($this->moduleName)) {
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

        return $this;
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     */
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     * @param array $data
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

            }
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

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

     * @param int $moduleId Module id
Severity: Minor
Found in app/Anonymization.php by phpcodesniffer

There are no issues that match your filters.

Category
Status