YetiForceCompany/YetiForceCRM

View on GitHub
app/Encryptions/Module.php

Summary

Maintainability
B
5 hrs
Test Coverage
F
14%

Function recalculatePasswords has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    public static function recalculatePasswords(string $method, string $password, string $vector, int $target)
    {
        $dbAdmin = \App\Db::getInstance('admin');
        $decryptInstance = static::getInstance($target);
        if (!$decryptInstance->getTarget() || ($decryptInstance->get('method') === $method && $decryptInstance->get('vector') === $vector && $decryptInstance->get('pass') === $password)) {
Severity: Minor
Found in app/Encryptions/Module.php - About 2 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Method recalculatePasswords has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function recalculatePasswords(string $method, string $password, string $vector, int $target)
    {
        $dbAdmin = \App\Db::getInstance('admin');
        $decryptInstance = static::getInstance($target);
        if (!$decryptInstance->getTarget() || ($decryptInstance->get('method') === $method && $decryptInstance->get('vector') === $vector && $decryptInstance->get('pass') === $password)) {
Severity: Major
Found in app/Encryptions/Module.php - About 2 hrs to fix

    The method recalculatePasswords() has an NPath complexity of 365. The configured NPath complexity threshold is 200.
    Open

        public static function recalculatePasswords(string $method, string $password, string $vector, int $target)
        {
            $dbAdmin = \App\Db::getInstance('admin');
            $decryptInstance = static::getInstance($target);
            if (!$decryptInstance->getTarget() || ($decryptInstance->get('method') === $method && $decryptInstance->get('vector') === $vector && $decryptInstance->get('pass') === $password)) {
    Severity: Minor
    Found in app/Encryptions/Module.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 recalculatePasswords() has a Cyclomatic Complexity of 16. The configured cyclomatic complexity threshold is 10.
    Open

        public static function recalculatePasswords(string $method, string $password, string $vector, int $target)
        {
            $dbAdmin = \App\Db::getInstance('admin');
            $decryptInstance = static::getInstance($target);
            if (!$decryptInstance->getTarget() || ($decryptInstance->get('method') === $method && $decryptInstance->get('vector') === $vector && $decryptInstance->get('pass') === $password)) {
    Severity: Minor
    Found in app/Encryptions/Module.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 22 to the 15 allowed.
    Open

        public static function recalculatePasswords(string $method, string $password, string $vector, int $target)
    Severity: Critical
    Found in app/Encryptions/Module.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

    The class Module has a coupling between objects value of 14. Consider to reduce the number of dependencies under 13.
    Open

    class Module extends \App\Encryption
    {
        /** {@inheritdoc} */
        public static function getInstance(int $target = \App\Encryption::TARGET_SETTINGS)
        {
    Severity: Minor
    Found in app/Encryptions/Module.php by phpmd

    CouplingBetweenObjects

    Since: 1.1.0

    A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

    Example

    class Foo {
        /**
         * @var \foo\bar\X
         */
        private $x = null;
    
        /**
         * @var \foo\bar\Y
         */
        private $y = null;
    
        /**
         * @var \foo\bar\Z
         */
        private $z = null;
    
        public function setFoo(\Foo $foo) {}
        public function setBar(\Bar $bar) {}
        public function setBaz(\Baz $baz) {}
    
        /**
         * @return \SplObjectStorage
         * @throws \OutOfRangeException
         * @throws \InvalidArgumentException
         * @throws \ErrorException
         */
        public function process(\Iterator $it) {}
    
        // ...
    }

    Source https://phpmd.org/rules/design.html#couplingbetweenobjects

    Missing class import via use statement (line '86', column '17').
    Open

                            throw new \App\Exceptions\AppException('ERR_IMPOSSIBLE_ENCRYPT');
    Severity: Minor
    Found in app/Encryptions/Module.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 isActive has a boolean flag argument $testMode, which is a certain sign of a Single Responsibility Principle violation.
    Open

        public function isActive(bool $testMode = false)
    Severity: Minor
    Found in app/Encryptions/Module.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 '95', column '10').
    Open

                    (new \App\BatchMethod(['method' => __CLASS__ . '::recalculatePasswords', 'params' => [$method,  $password,  $vector,  $target, microtime()]]))->save();
    Severity: Minor
    Found in app/Encryptions/Module.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 '133', column '26').
    Open

            $queryGenerator = (new \App\QueryGenerator($moduleName))->setFields($fields);
    Severity: Minor
    Found in app/Encryptions/Module.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 '137', column '45').
    Open

                $queryGenerator->addNativeCondition((new \yii\db\Expression('0 > 1')));
    Severity: Minor
    Found in app/Encryptions/Module.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 '25', column '15').
    Open

            $row = (new \App\Db\Query())->from(static::TABLE_NAME)->where(['target' => $target])->one(\App\Db::getInstance('admin'));
    Severity: Minor
    Found in app/Encryptions/Module.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 '23', column '14').
    Open

                throw new \App\Exceptions\IllegalValue('ERR_NOT_ALLOWED_VALUE||target', 406);
    Severity: Minor
    Found in app/Encryptions/Module.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 '81', column '18').
    Open

                                throw new \App\Exceptions\AppException('ERR_IMPOSSIBLE_DECRYPT');
    Severity: Minor
    Found in app/Encryptions/Module.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 '97', column '10').
    Open

                    (new \App\ConfigFile('module', \App\Module::getModuleName($target)))
    Severity: Minor
    Found in app/Encryptions/Module.php by phpmd

    MissingImport

    Since: 2.7.0

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

    Example

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

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

    Avoid using static access to class '\App\Module' in method 'isActive'.
    Open

            $method = \App\Config::module(\App\Module::getModuleName($this->getTarget()), 'encryptionMethod');
    Severity: Minor
    Found in app/Encryptions/Module.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 recalculatePasswords uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

                } else {
                    (new \App\ConfigFile('module', \App\Module::getModuleName($target)))
                        ->set('encryptionMethod', $method)
                        ->set('encryptionPass', $password)
                        ->create();
    Severity: Minor
    Found in app/Encryptions/Module.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\Config' in method 'isActive'.
    Open

            $method = \App\Config::module(\App\Module::getModuleName($this->getTarget()), 'encryptionMethod');
    Severity: Minor
    Found in app/Encryptions/Module.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 'recalculatePasswords'.
    Open

            $dbAdmin = \App\Db::getInstance('admin');
    Severity: Minor
    Found in app/Encryptions/Module.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 'recalculatePasswords'.
    Open

                $moduleName = \App\Module::getModuleName($target);
    Severity: Minor
    Found in app/Encryptions/Module.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 'getInstance'.
    Open

            $row = (new \App\Db\Query())->from(static::TABLE_NAME)->where(['target' => $target])->one(\App\Db::getInstance('admin'));
    Severity: Minor
    Found in app/Encryptions/Module.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 'recalculatePasswords'.
    Open

                    (new \App\ConfigFile('module', \App\Module::getModuleName($target)))
    Severity: Minor
    Found in app/Encryptions/Module.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 'recalculatePasswords'.
    Open

                \App\Cache::clear();
    Severity: Minor
    Found in app/Encryptions/Module.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

            $instance->set('pass', \App\Config::module(\App\Module::getModuleName($target), 'encryptionPass'));
    Severity: Minor
    Found in app/Encryptions/Module.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\Config' in method 'getInstance'.
    Open

            $instance->set('pass', \App\Config::module(\App\Module::getModuleName($target), 'encryptionPass'));
    Severity: Minor
    Found in app/Encryptions/Module.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\Pauser' in method 'recalculatePasswords'.
    Open

                $pauser = \App\Pauser::getInstance("Encryption-{$moduleName}");
    Severity: Minor
    Found in app/Encryptions/Module.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 'recalculatePasswords'.
    Open

            $db = \App\Db::getInstance();
    Severity: Minor
    Found in app/Encryptions/Module.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 'getQueryGenerator'.
    Open

            $moduleName = \App\Module::getModuleName($this->getTarget());
    Severity: Minor
    Found in app/Encryptions/Module.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 "method" 10 times.
    Open

                $instance->set('method', $row['method']);
    Severity: Critical
    Found in app/Encryptions/Module.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 "vector" 3 times.
    Open

                $instance->set('vector', $row['pass']);
    Severity: Critical
    Found in app/Encryptions/Module.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 "target" 6 times.
    Open

            $row = (new \App\Db\Query())->from(static::TABLE_NAME)->where(['target' => $target])->one(\App\Db::getInstance('admin'));
    Severity: Critical
    Found in app/Encryptions/Module.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.

    Reference to constant TARGET_SETTINGS from undeclared class \App\Encryption (Did you mean class \Tests\App\Encryption)
    Open

        public static function getInstance(int $target = \App\Encryption::TARGET_SETTINGS)
    Severity: Critical
    Found in app/Encryptions/Module.php by phan

    Call to undeclared method \App\Encryptions\Module::getTarget
    Open

            $method = \App\Config::module(\App\Module::getModuleName($this->getTarget()), 'encryptionMethod');
    Severity: Critical
    Found in app/Encryptions/Module.php by phan

    Call to undeclared method \App\Encryptions\Module::get
    Open

                || !\in_array($this->get('method'), static::getMethods())
    Severity: Critical
    Found in app/Encryptions/Module.php by phan

    Reference to undeclared constant \App\Encryptions\Module::TABLE_NAME
    Open

            $row = (new \App\Db\Query())->from(static::TABLE_NAME)->where(['target' => $target])->one(\App\Db::getInstance('admin'));
    Severity: Minor
    Found in app/Encryptions/Module.php by phan

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

            $row = (new \App\Db\Query())->from(static::TABLE_NAME)->where(['target' => $target])->one(\App\Db::getInstance('admin'));
    Severity: Critical
    Found in app/Encryptions/Module.php by phan

    Call to undeclared method \App\Encryptions\Module::set
    Open

            $instance->set('pass', \App\Config::module(\App\Module::getModuleName($target), 'encryptionPass'));
    Severity: Critical
    Found in app/Encryptions/Module.php by phan

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

            $transactionAdmin = $dbAdmin->beginTransaction();
    Severity: Critical
    Found in app/Encryptions/Module.php by phan

    Call to method createQuery from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
    Open

                if ($decryptInstance->getQueryGenerator((int) $pauser->getValue())->createQuery()->exists()) {
    Severity: Critical
    Found in app/Encryptions/Module.php by phan

    Return type of getQueryGenerator() is undeclared type \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
    Open

        public function getQueryGenerator(int $lastId = null): \App\QueryGenerator
    Severity: Minor
    Found in app/Encryptions/Module.php by phan

    Call to undeclared method \App\Encryptions\Module::get
    Open

            if (!$decryptInstance->getTarget() || ($decryptInstance->get('method') === $method && $decryptInstance->get('vector') === $vector && $decryptInstance->get('pass') === $password)) {
    Severity: Critical
    Found in app/Encryptions/Module.php by phan

    Reference to undeclared constant \App\Encryptions\Module::STATUS_ACTIVE
    Open

                        'status' => self::STATUS_ACTIVE,
    Severity: Minor
    Found in app/Encryptions/Module.php by phan

    Doc-block of $lastId in getQueryGenerator is phpdoc param type int which is not a permitted replacement of the nullable param type ?int declared in the signature ('?T' should be documented as 'T|null' or '?T')
    Open

         * @param int $lastId
    Severity: Minor
    Found in app/Encryptions/Module.php by phan

    Call to undeclared method \App\Encryptions\Module::getTarget
    Open

            $moduleName = \App\Module::getModuleName($this->getTarget());
    Severity: Critical
    Found in app/Encryptions/Module.php by phan

    Call to undeclared method \App\Encryptions\Module::isEmpty
    Open

                || $this->isEmpty('method')
    Severity: Critical
    Found in app/Encryptions/Module.php by phan

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

            $transactionBase = $db->beginTransaction();
    Severity: Critical
    Found in app/Encryptions/Module.php by phan

    Call to undeclared method \App\Encryptions\Module::set
    Open

                $instance->set('target', (int) $row['target']);
    Severity: Critical
    Found in app/Encryptions/Module.php by phan

    Reference to undeclared constant \App\Encryptions\Module::STATUS_ACTIVE
    Open

                $dbAdmin->createCommand()->update(self::TABLE_NAME, ['status' => self::STATUS_ACTIVE], ['target' => $target])->execute();
    Severity: Minor
    Found in app/Encryptions/Module.php by phan

    Reference to undeclared constant \App\Encryptions\Module::TABLE_NAME
    Open

                $dbAdmin->createCommand()->update(self::TABLE_NAME, ['status' => self::STATUS_ACTIVE], ['target' => $target])->execute();
    Severity: Minor
    Found in app/Encryptions/Module.php by phan

    Static call to undeclared method \App\Encryptions\Module::getMethods
    Open

                || !\in_array($this->get('method'), static::getMethods())
    Severity: Critical
    Found in app/Encryptions/Module.php by phan

    Class extends undeclared class \App\Encryption (Did you mean class \Tests\App\Encryption)
    Open

    class Module extends \App\Encryption
    Severity: Critical
    Found in app/Encryptions/Module.php by phan

    Call to undeclared method \App\Encryptions\Module::set
    Open

                $instance->set('method', $row['method']);
    Severity: Critical
    Found in app/Encryptions/Module.php by phan

    Reference to undeclared constant \App\Encryptions\Module::TABLE_NAME
    Open

                    $dbAdmin->createCommand()->update(self::TABLE_NAME, [
    Severity: Minor
    Found in app/Encryptions/Module.php by phan

    Call to undeclared method \App\Encryptions\Module::set
    Open

                $instance->set('vector', $row['pass']);
    Severity: Critical
    Found in app/Encryptions/Module.php by phan

    Call to undeclared method \App\Encryptions\Module::decrypt
    Open

                            $value = $decryptInstance->decrypt($value);
    Severity: Critical
    Found in app/Encryptions/Module.php by phan

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

                    $dbAdmin->createCommand()->update(self::TABLE_NAME, [
    Severity: Critical
    Found in app/Encryptions/Module.php by phan

    Call to method __construct from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
    Open

            $queryGenerator = (new \App\QueryGenerator($moduleName))->setFields($fields);
    Severity: Critical
    Found in app/Encryptions/Module.php by phan

    Call to undeclared method \App\Encryptions\Module::getTarget
    Open

            if (!$decryptInstance->getTarget() || ($decryptInstance->get('method') === $method && $decryptInstance->get('vector') === $vector && $decryptInstance->get('pass') === $password)) {
    Severity: Critical
    Found in app/Encryptions/Module.php by phan

    Call to undeclared method \App\Encryptions\Module::set
    Open

            $encryptInstance = (new static())
    Severity: Critical
    Found in app/Encryptions/Module.php by phan

    Call to method createQuery from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
    Open

                $dataReader = $queryGenerator->createQuery()->createCommand()->query();
    Severity: Critical
    Found in app/Encryptions/Module.php by phan

    Call to method getColumnName from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
    Open

                        $db->createCommand()->update($fieldModel->getTableName(), [$fieldModel->getColumnName() => $value], [$queryGenerator->getColumnName('id') => $recordId])->execute();
    Severity: Critical
    Found in app/Encryptions/Module.php by phan

    Call to method setFields from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
    Open

            $queryGenerator = (new \App\QueryGenerator($moduleName))->setFields($fields);
    Severity: Critical
    Found in app/Encryptions/Module.php by phan

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

                $dbAdmin->createCommand()->update(self::TABLE_NAME, ['status' => self::STATUS_ACTIVE], ['target' => $target])->execute();
    Severity: Critical
    Found in app/Encryptions/Module.php by phan

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

                        $db->createCommand()->update($fieldModel->getTableName(), [$fieldModel->getColumnName() => $value], [$queryGenerator->getColumnName('id') => $recordId])->execute();
    Severity: Critical
    Found in app/Encryptions/Module.php by phan

    Call to method __construct from undeclared class \yii\db\Expression
    Open

                $queryGenerator->addNativeCondition((new \yii\db\Expression('0 > 1')));
    Severity: Critical
    Found in app/Encryptions/Module.php by phan

    Reference to undeclared constant \App\Encryptions\Module::TARGET_SETTINGS
    Open

            if ($target === static::TARGET_SETTINGS) {
    Severity: Minor
    Found in app/Encryptions/Module.php by phan

    Call to undeclared method \App\Encryptions\Module::isEmpty
    Open

                            if (!$decryptInstance->isEmpty('method') && !$decryptInstance->isActive()) {
    Severity: Critical
    Found in app/Encryptions/Module.php by phan

    Call to undeclared method \App\Encryptions\Module::get
    Open

                || ($this->get('method') !== $method && !$testMode)
    Severity: Critical
    Found in app/Encryptions/Module.php by phan

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

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

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

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

            if ($target === static::TARGET_SETTINGS) {
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

                $instance->set('target', (int) $row['target']);
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

            $instance->set('pass', \App\Config::module(\App\Module::getModuleName($target), 'encryptionPass'));
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

         * @param string $method
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

        /** {@inheritdoc} */
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

                $instance->set('vector', $row['pass']);
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

        public static function recalculatePasswords(string $method, string $password, string $vector, int $target)
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

    Line exceeds 120 characters; contains 133 characters
    Open

                $dbAdmin->createCommand()->update(self::TABLE_NAME, ['status' => self::STATUS_ACTIVE], ['target' => $target])->execute();
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

                ->set('method', $method)
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

            $transactionAdmin = $dbAdmin->beginTransaction();
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

                $queryGenerator = $decryptInstance->getQueryGenerator($lastId);
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

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

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

                        if (empty($value) && '' !== $valueRaw && $method) {
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

                $queryGenerator->addNativeCondition((new \yii\db\Expression('0 > 1')));
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

            $queryGenerator->setLimit($limit);
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

            $row = (new \App\Db\Query())->from(static::TABLE_NAME)->where(['target' => $target])->one(\App\Db::getInstance('admin'));
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

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

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

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

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

            try {
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

                $lastId = (int) $pauser->getValue();
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

                $dataReader->close();
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

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

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

        public function getQueryGenerator(int $lastId = null): \App\QueryGenerator
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

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

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

                $pauser = \App\Pauser::getInstance("Encryption-{$moduleName}");
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

                            if (!$decryptInstance->isEmpty('method') && !$decryptInstance->isActive()) {
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

                                throw new \App\Exceptions\AppException('ERR_IMPOSSIBLE_DECRYPT');
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

                    (new \App\BatchMethod(['method' => __CLASS__ . '::recalculatePasswords', 'params' => [$method,  $password,  $vector,  $target, microtime()]]))->save();
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

                throw $e;
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

         * Gets query.
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

            $fields[] = 'id';
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

            $queryGenerator->setOrder('id', \App\Db::ASC);
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

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

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

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

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

                            throw new \App\Exceptions\AppException('ERR_IMPOSSIBLE_ENCRYPT');
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

                if ($decryptInstance->getQueryGenerator((int) $pauser->getValue())->createQuery()->exists()) {
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

                    (new \App\ConfigFile('module', \App\Module::getModuleName($target)))
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

                        ->set('encryptionPass', $password)
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

         * @param int $lastId
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

            $queryGenerator->addNativeCondition(['>', $queryGenerator->getColumnName('id'), $lastId]);
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

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

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

            return $instance;
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

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

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

         * Function to change password for encryption.
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

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

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

         * @param int    $target
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

                        'pass' => $vector,
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

        public static function getInstance(int $target = \App\Encryption::TARGET_SETTINGS)
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

                throw new \App\Exceptions\IllegalValue('ERR_NOT_ALLOWED_VALUE||target', 406);
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

    Line exceeds 120 characters; contains 129 characters
    Open

            $row = (new \App\Db\Query())->from(static::TABLE_NAME)->where(['target' => $target])->one(\App\Db::getInstance('admin'));
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

            $encryptInstance = (new static())
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

            $db = \App\Db::getInstance();
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

                    $recordId = $row['id'];
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

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

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

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

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

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

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

         * @return bool
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

            $decryptInstance = static::getInstance($target);
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

                ->set('target', $target);
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

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

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

                    $pauser->setValue((string) $recordId);
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

    Line exceeds 120 characters; contains 167 characters
    Open

                    (new \App\BatchMethod(['method' => __CLASS__ . '::recalculatePasswords', 'params' => [$method,  $password,  $vector,  $target, microtime()]]))->save();
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

                        ->create();
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

                    ], ['target' => $target])->execute();
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

                    $pauser->destroy();
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

                $transactionBase->rollBack();
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

         * @return \App\QueryGenerator
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

         * @param bool $testMode
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

            return !(
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

            if ($row) {
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

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

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

         * @param string $password
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

                ->set('pass', $password)
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

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

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

                        'status' => self::STATUS_ACTIVE,
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

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

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

            $moduleName = \App\Module::getModuleName($this->getTarget());
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

            $queryGenerator = (new \App\QueryGenerator($moduleName))->setFields($fields);
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

            $queryGenerator->permissions = false;
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

            return $queryGenerator;
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

                || !\in_array($this->get('method'), static::getMethods())
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

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

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

                $instance->set('method', $row['method']);
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

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

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

            if (!$decryptInstance->getTarget() || ($decryptInstance->get('method') === $method && $decryptInstance->get('vector') === $vector && $decryptInstance->get('pass') === $password)) {
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

                    $dbAdmin->createCommand()->update(self::TABLE_NAME, [
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

                $transactionAdmin->rollBack();
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

         * Checks if encrypt or decrypt is possible.
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

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

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

            );
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

            $instance = new static();
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

            $dbAdmin = \App\Db::getInstance('admin');
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

                $dataReader = $queryGenerator->createQuery()->createCommand()->query();
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

                        $db->createCommand()->update($fieldModel->getTableName(), [$fieldModel->getColumnName() => $value], [$queryGenerator->getColumnName('id') => $recordId])->execute();
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

    Line exceeds 120 characters; contains 184 characters
    Open

                        $db->createCommand()->update($fieldModel->getTableName(), [$fieldModel->getColumnName() => $value], [$queryGenerator->getColumnName('id') => $recordId])->execute();
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

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

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

                $transactionBase->commit();
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

                ->set('vector', $vector)
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

                $moduleName = \App\Module::getModuleName($target);
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

                        if (!empty($value)) {
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

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

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

                $transactionAdmin->commit();
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

            $limit = 50000;
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

        public function isActive(bool $testMode = false)
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

                if (!$dataReader->count()) {
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

                while ($row = $dataReader->read()) {
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

                        $value = $encryptInstance->encrypt($value, true);
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

                \App\Cache::clear();
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

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

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

            $transactionBase = $db->beginTransaction();
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

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

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

                        ->set('encryptionMethod', $method)
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

            } catch (\Throwable $e) {
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

            $pwdFields = \Vtiger_Module_Model::getInstance($moduleName)->getFieldsByUiType(99);
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

            $queryGenerator->setStateCondition('All');
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

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

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

            $method = \App\Config::module(\App\Module::getModuleName($this->getTarget()), 'encryptionMethod');
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

                $dbAdmin->createCommand()->update(self::TABLE_NAME, ['status' => self::STATUS_ACTIVE], ['target' => $target])->execute();
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

                    $pauser->destroy();
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

                        $value = $valueRaw = $row[$fieldModel->getName()] ?? '';
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

            $fields = array_keys($pwdFields);
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

                || $this->isEmpty('method')
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

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

    Line exceeds 120 characters; contains 188 characters
    Open

            if (!$decryptInstance->getTarget() || ($decryptInstance->get('method') === $method && $decryptInstance->get('vector') === $vector && $decryptInstance->get('pass') === $password)) {
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

                return;
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

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

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

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

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

            if (!$pwdFields) {
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

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

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

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

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

                || ($this->get('method') !== $method && !$testMode)
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

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

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

         * @param string $vector
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

                $pwdFields = \Vtiger_Module_Model::getInstance($moduleName)->getFieldsByUiType(99);
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

                    foreach ($pwdFields as $fieldModel) {
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

                            $value = $decryptInstance->decrypt($value);
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

                        'method' => $method,
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

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

                !\function_exists('openssl_encrypt')
    Severity: Minor
    Found in app/Encryptions/Module.php by phpcodesniffer

    There are no issues that match your filters.

    Category
    Status