YetiForceCompany/YetiForceCRM

View on GitHub
tests/Base/Z_ResetingRecordNumber.php

Summary

Maintainability
C
1 day
Test Coverage
A
100%

File Z_ResetingRecordNumber.php has 265 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Reseting record number test class.
 *
 * @package   Tests
Severity: Minor
Found in tests/Base/Z_ResetingRecordNumber.php - About 2 hrs to fix

    Method testLeadingZeros has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function testLeadingZeros(): void
        {
            for ($leadingZeros = 0; $leadingZeros < 7; ++$leadingZeros) {
                $actualNumber = 1;
                $prefix = '{{YYYY}}-{{MM}}-{{DD}}/';
    Severity: Minor
    Found in tests/Base/Z_ResetingRecordNumber.php - About 1 hr to fix

      Method testIncrementNumberMonth has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function testIncrementNumberMonth(): void
          {
              $actualNumber = 1;
              $prefix = '{{YYYY}}-{{MM}}-{{DD}}/';
              $postfix = '';
      Severity: Minor
      Found in tests/Base/Z_ResetingRecordNumber.php - About 1 hr to fix

        Method testIncrementNumberYear has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function testIncrementNumberYear(): void
            {
                $actualNumber = 1;
                $prefix = '{{YYYY}}-{{MM}}-{{DD}}/';
                $postfix = '';
        Severity: Minor
        Found in tests/Base/Z_ResetingRecordNumber.php - About 1 hr to fix

          Method testIncrementNumberDay has 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function testIncrementNumberDay()
              {
                  $parts = explode('-', RecordNumber::$dates[0]);
                  $actualNumber = 1;
                  $prefix = '{{YYYY}}-{{MM}}-{{DD}}/';
          Severity: Minor
          Found in tests/Base/Z_ResetingRecordNumber.php - About 1 hr to fix

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

                public function testLeadingZeros(): void
                {
                    for ($leadingZeros = 0; $leadingZeros < 7; ++$leadingZeros) {
                        $actualNumber = 1;
                        $prefix = '{{YYYY}}-{{MM}}-{{DD}}/';
            Severity: Minor
            Found in tests/Base/Z_ResetingRecordNumber.php - About 35 mins to fix

            Cognitive Complexity

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

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

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

            Further reading

            Avoid using undefined variables such as '$dates' which will lead to PHP notices.
            Open

                    RecordNumber::$dates[0] = date('Y-m-d');
            Severity: Minor
            Found in tests/Base/Z_ResetingRecordNumber.php by phpmd

            UndefinedVariable

            Since: 2.8.0

            Detects when a variable is used that has not been defined before.

            Example

            class Foo
            {
                private function bar()
                {
                    // $message is undefined
                    echo $message;
                }
            }

            Source https://phpmd.org/rules/cleancode.html#undefinedvariable

            Missing class import via use statement (line '208', column '23').
            Open

                    $originalRow = (new \App\Db\Query())->from('vtiger_modentity_num')->where(['tabid' => 95])->one();
            Severity: Minor
            Found in tests/Base/Z_ResetingRecordNumber.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 '258', column '23').
            Open

                    $originalRow = (new \App\Db\Query())->from('vtiger_modentity_num')->where(['tabid' => 95])->one();
            Severity: Minor
            Found in tests/Base/Z_ResetingRecordNumber.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 '159', column '23').
            Open

                    $originalRow = (new \App\Db\Query())->from('vtiger_modentity_num')->where(['tabid' => 95])->one();
            Severity: Minor
            Found in tests/Base/Z_ResetingRecordNumber.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 '309', column '24').
            Open

                        $originalRow = (new \App\Db\Query())->from('vtiger_modentity_num')->where(['tabid' => 95])->one();
            Severity: Minor
            Found in tests/Base/Z_ResetingRecordNumber.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 '101', column '23').
            Open

                    $originalRow = (new \App\Db\Query())->from('vtiger_modentity_num')->where(['tabid' => \App\Module::getModuleId('FInvoice')])->one();
            Severity: Minor
            Found in tests/Base/Z_ResetingRecordNumber.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 'Tests\Base\RecordNumber' in method 'testSequenceNumber'.
            Open

                        $this->assertSame($parts[0], RecordNumber::getSequenceNumber('Y'));
            Severity: Minor
            Found in tests/Base/Z_ResetingRecordNumber.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 'Tests\Base\RecordNumber' in method 'testIncrementNumberMonth'.
            Open

                    $instance = RecordNumber::getInstance('FInvoice');
            Severity: Minor
            Found in tests/Base/Z_ResetingRecordNumber.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 'Tests\Base\RecordNumber' in method 'testSequenceNumber'.
            Open

                        $this->assertSame($parts[0] . $parts[1], RecordNumber::getSequenceNumber('M'));
            Severity: Minor
            Found in tests/Base/Z_ResetingRecordNumber.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 'Tests\Base\RecordNumber' in method 'testIncrementNumberDay'.
            Open

                        $number = RecordNumber::getInstance('FInvoice');
            Severity: Minor
            Found in tests/Base/Z_ResetingRecordNumber.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 testLeadingZeros uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

                            } else {
                                $currentNumber = 1;
                                $currentDate = $sequence;
                            }
            Severity: Minor
            Found in tests/Base/Z_ResetingRecordNumber.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 'Tests\Base\RecordNumber' in method 'testSequenceNumber'.
            Open

                        $this->assertSame($parts[0] . $parts[1] . $parts[2], RecordNumber::getSequenceNumber('D'));
            Severity: Minor
            Found in tests/Base/Z_ResetingRecordNumber.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 'Tests\Base\RecordNumber' in method 'testParse'.
            Open

                    $instance = RecordNumber::getInstance('FInvoice');
            Severity: Minor
            Found in tests/Base/Z_ResetingRecordNumber.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 'Tests\Base\RecordNumber' in method 'testIncrementNumberMonth'.
            Open

                        $number = RecordNumber::getInstance('FInvoice');
            Severity: Minor
            Found in tests/Base/Z_ResetingRecordNumber.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 'testIncrementNumberStandard'.
            Open

                    $originalRow = (new \App\Db\Query())->from('vtiger_modentity_num')->where(['tabid' => \App\Module::getModuleId('FInvoice')])->one();
            Severity: Minor
            Found in tests/Base/Z_ResetingRecordNumber.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 'Tests\Base\RecordNumber' in method 'testIncrementNumberDay'.
            Open

                    $instance = RecordNumber::getInstance('FInvoice');
            Severity: Minor
            Found in tests/Base/Z_ResetingRecordNumber.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 'tearDownAfterClass'.
            Open

                    \App\Cache::clear();
            Severity: Minor
            Found in tests/Base/Z_ResetingRecordNumber.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 testIncrementNumberMonth uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

                        } else {
                            $currentNumber = 1;
                            $currentDate = $sequence;
                        }
            Severity: Minor
            Found in tests/Base/Z_ResetingRecordNumber.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 'Tests\Base\RecordNumber' in method 'testIncrementNumberYear'.
            Open

                        $number = RecordNumber::getInstance('FInvoice');
            Severity: Minor
            Found in tests/Base/Z_ResetingRecordNumber.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 'Tests\Base\RecordNumber' in method 'testLeadingZeros'.
            Open

                            $number = RecordNumber::getInstance('FInvoice');
            Severity: Minor
            Found in tests/Base/Z_ResetingRecordNumber.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 'Tests\Base\RecordNumber' in method 'testIncrementNumberYear'.
            Open

                    $instance = RecordNumber::getInstance('FInvoice');
            Severity: Minor
            Found in tests/Base/Z_ResetingRecordNumber.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 testIncrementNumberYear uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

                        } else {
                            $currentNumber = 1;
                            $currentDate = $sequence;
                        }
            Severity: Minor
            Found in tests/Base/Z_ResetingRecordNumber.php by phpmd

            ElseExpression

            Since: 1.4.0

            An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

            Example

            class Foo
            {
                public function bar($flag)
                {
                    if ($flag) {
                        // one branch
                    } else {
                        // another branch
                    }
                }
            }

            Source https://phpmd.org/rules/cleancode.html#elseexpression

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

                        } else {
                            $currentNumber = 1;
                            $currentDate = $sequence;
                        }
            Severity: Minor
            Found in tests/Base/Z_ResetingRecordNumber.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 'Tests\Base\RecordNumber' in method 'testIncrementNumberStandard'.
            Open

                        $number = RecordNumber::getInstance('FInvoice');
            Severity: Minor
            Found in tests/Base/Z_ResetingRecordNumber.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 'Tests\Base\RecordNumber' in method 'testDateMock'.
            Open

                        $this->assertSame($date, RecordNumber::date('Y-m-d'));
            Severity: Minor
            Found in tests/Base/Z_ResetingRecordNumber.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 'Tests\Base\RecordNumber' in method 'testLeadingZeros'.
            Open

                        $instance = RecordNumber::getInstance('FInvoice');
            Severity: Minor
            Found in tests/Base/Z_ResetingRecordNumber.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 "cur_sequence" 14 times.
            Open

                    $this->assertSame('', $originalRow['cur_sequence']);
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by sonar-php

            Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

            On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

            Noncompliant Code Example

            With the default threshold of 3:

            function run() {
              prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
              execute('action1');
              release('action1');
            }
            

            Compliant Solution

            ACTION_1 = 'action1';
            
            function run() {
              prepare(ACTION_1);
              execute(ACTION_1);
              release(ACTION_1);
            }
            

            Exceptions

            To prevent generating some false-positives, literals having less than 5 characters are excluded.

            Define a constant instead of duplicating this literal "vtiger_modentity_num" 5 times.
            Open

                    $originalRow = (new \App\Db\Query())->from('vtiger_modentity_num')->where(['tabid' => \App\Module::getModuleId('FInvoice')])->one();
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.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 "postfix" 14 times.
            Open

                    $this->assertSame('', $originalRow['postfix']);
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.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 "reset_sequence" 14 times.
            Open

                    $this->assertSame(null, $originalRow['reset_sequence']);
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.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 "{{YYYY}}-{{MM}}-{{DD}}/" 4 times.
            Open

                    $prefix = '{{YYYY}}-{{MM}}-{{DD}}/';
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.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 "leading_zeros" 12 times.
            Open

                    $instance->set('leading_zeros', 0);
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.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 "prefix" 18 times.
            Open

                    $instance = RecordNumber::getInstance('FInvoice')->set('prefix', 'F-I')->set('cur_id', 1);
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.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 "cur_id" 15 times.
            Open

                    $instance = RecordNumber::getInstance('FInvoice')->set('prefix', 'F-I')->set('cur_id', 1);
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.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 "FInvoice" 12 times.
            Open

                    $instance = RecordNumber::getInstance('FInvoice')->set('prefix', 'F-I')->set('cur_id', 1);
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by sonar-php

            Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

            On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

            Noncompliant Code Example

            With the default threshold of 3:

            function run() {
              prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
              execute('action1');
              release('action1');
            }
            

            Compliant Solution

            ACTION_1 = 'action1';
            
            function run() {
              prepare(ACTION_1);
              execute(ACTION_1);
              release(ACTION_1);
            }
            

            Exceptions

            To prevent generating some false-positives, literals having less than 5 characters are excluded.

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

                    $originalRow = (new \App\Db\Query())->from('vtiger_modentity_num')->where(['tabid' => \App\Module::getModuleId('FInvoice')])->one();
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.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.

            Avoid unused local variables such as '$date'.
            Open

                    foreach (RecordNumber::$dates as $index => $date) {
            Severity: Minor
            Found in tests/Base/Z_ResetingRecordNumber.php by phpmd

            UnusedLocalVariable

            Since: 0.2

            Detects when a local variable is declared and/or assigned, but not used.

            Example

            class Foo {
                public function doSomething()
                {
                    $i = 5; // Unused
                }
            }

            Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

            Avoid unused parameters such as '$time'.
            Open

                public static function date($format, $time = null)
            Severity: Minor
            Found in tests/Base/Z_ResetingRecordNumber.php by phpmd

            UnusedFormalParameter

            Since: 0.2

            Avoid passing parameters to methods or constructors and then not using those parameters.

            Example

            class Foo
            {
                private function bar($howdy)
                {
                    // $howdy is not used
                }
            }

            Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

            Avoid unused local variables such as '$index'.
            Open

                    foreach (RecordNumber::$dates as $index => $date) {
            Severity: Minor
            Found in tests/Base/Z_ResetingRecordNumber.php by phpmd

            UnusedLocalVariable

            Since: 0.2

            Detects when a local variable is declared and/or assigned, but not used.

            Example

            class Foo {
                public function doSomething()
                {
                    $i = 5; // Unused
                }
            }

            Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

            Static call to undeclared method \Tests\Base\RecordNumber::getInstance
            Open

                    $instance = RecordNumber::getInstance('FInvoice');
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                    $this->assertSame(0, $originalRow['leading_zeros']);
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                        $this->assertSame(0, $number->get('leading_zeros'));
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Static call to undeclared method \Tests\Base\RecordNumber::getInstance
            Open

                    $instance = RecordNumber::getInstance('FInvoice');
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Static call to undeclared method \Tests\Base\RecordNumber::getInstance
            Open

                        $instance = RecordNumber::getInstance('FInvoice');
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                        $this->assertSame($parts[0], RecordNumber::getSequenceNumber('Y'));
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                    $this->assertSame($curSequence, $originalRow['cur_sequence']);
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                        $this->assertSame($actualNumber, $originalRow['cur_id']);
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                        $this->assertSame($actualNumber, $number->get('cur_id'));
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                        $this->assertSame(null, $number->get('reset_sequence'));
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                    $this->assertSame(1, $result);
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                    $this->assertSame(0, $originalRow['leading_zeros']);
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                    $this->assertSame($postfix, $originalRow['postfix']);
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Static call to undeclared method \Tests\Base\RecordNumber::getInstance
            Open

                        $number = RecordNumber::getInstance('FInvoice');
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Static call to undeclared method \Tests\Base\RecordNumber::getInstance
            Open

                    $instance = RecordNumber::getInstance('FInvoice')->set('prefix', 'F-I')->set('cur_id', 1);
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

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

                    $originalRow = (new \App\Db\Query())->from('vtiger_modentity_num')->where(['tabid' => 95])->one();
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                    $this->assertSame($resetSequence, $originalRow['reset_sequence']);
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Static call to undeclared method \Tests\Base\RecordNumber::getInstance
            Open

                        $number = RecordNumber::getInstance('FInvoice');
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                        $this->assertSame($prefix, $number->get('prefix'));
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                        $this->assertSame($resetSequence, $number->get('reset_sequence'));
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                        $this->assertSame($postfix, $originalRow['postfix']);
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

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

                    $originalRow = (new \App\Db\Query())->from('vtiger_modentity_num')->where(['tabid' => \App\Module::getModuleId('FInvoice')])->one();
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                        $this->assertSame($parts[1] . '/1', $instance->parseNumber(1));
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                        $this->assertSame("$date/$currentNumber", $instance->getIncrementNumber());
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                    $this->assertSame(1, $result);
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                    $this->assertSame($curSequence, $originalRow['cur_sequence']);
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                            $this->assertSame($currentNumber + 1, $number->get('cur_id'));
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                    $this->assertSame('F-I', $originalRow['prefix']);
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Static call to undeclared method \Tests\Base\RecordNumber::getInstance
            Open

                    $instance = RecordNumber::getInstance('FInvoice');
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                    $this->assertSame($prefix, $originalRow['prefix']);
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                        $this->assertSame($resetSequence, $number->get('reset_sequence'));
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                    $this->assertSame($curSequence, $originalRow['cur_sequence']);
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                        $this->assertSame($sequence, $number->get('cur_sequence'));
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Static call to undeclared method \Tests\Base\RecordNumber::getSequenceNumber
            Open

                        $this->assertSame($parts[0] . $parts[1] . $parts[2], RecordNumber::getSequenceNumber('D'));
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                    $this->assertSame('', $originalRow['postfix']);
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                        $this->assertSame("F-I$actualNumber", $instance->getIncrementNumber());
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                        $this->assertSame('', $number->get('cur_sequence'));
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                        $this->assertSame($postfix, $number->get('postfix'));
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                    $this->assertSame($actualNumber, $originalRow['cur_id']);
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                        $this->assertSame($leadingZeros, $originalRow['leading_zeros']);
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                    $this->assertSame(1, $result);
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                    $this->assertSame($postfix, $originalRow['postfix']);
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                    $this->assertSame($postfix, $originalRow['postfix']);
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                        $this->assertSame($prefix, $number->get('prefix'));
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                        $this->assertSame($postfix, $number->get('postfix'));
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                            $this->assertSame($prefix, $number->get('prefix'));
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Class extends undeclared class \App\Fields\RecordNumber (Did you mean class \Tests\Base\RecordNumber)
            Open

            class RecordNumber extends \App\Fields\RecordNumber
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Static call to undeclared method \Tests\Base\RecordNumber::getSequenceNumber
            Open

                        $this->assertSame($parts[0], RecordNumber::getSequenceNumber('Y'));
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                        $this->assertSame($parts[2] . '/1', $instance->parseNumber(1));
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                    $this->assertSame(0, $originalRow['leading_zeros']);
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                    $this->assertSame($prefix, $originalRow['prefix']);
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                        $this->assertSame($currentNumber + 1, $number->get('cur_id'));
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                    $this->assertSame($resetSequence, $originalRow['reset_sequence']);
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                        $this->assertSame("$date/$currentNumber", $instance->getIncrementNumber());
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                        $this->assertSame(1, $result);
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

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

                        $originalRow = (new \App\Db\Query())->from('vtiger_modentity_num')->where(['tabid' => 95])->one();
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Argument 1 (input) is 1 but \str_pad() takes string
            Open

                            $currentNumber = \str_pad($currentNumber, $leadingZeros, '0', STR_PAD_LEFT);
            Severity: Minor
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                    $this->assertSame('', $originalRow['cur_sequence']);
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                        $this->assertSame($parts[0] . '/1', $instance->parseNumber(1));
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                        $this->assertSame($sequence, $number->get('cur_sequence'));
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                        $this->assertSame($postfix, $number->get('postfix'));
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                        $this->assertSame(0, $number->get('leading_zeros'));
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                        $this->assertSame($curSequence, $originalRow['cur_sequence']);
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                        $this->assertSame($parts[0] . $parts[1] . $parts[2], RecordNumber::getSequenceNumber('D'));
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                        $this->assertSame('F-I', $number->get('prefix'));
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

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

                    $originalRow = (new \App\Db\Query())->from('vtiger_modentity_num')->where(['tabid' => 95])->one();
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                    $this->assertSame($actualNumber, $originalRow['cur_id']);
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

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

                    $originalRow = (new \App\Db\Query())->from('vtiger_modentity_num')->where(['tabid' => 95])->one();
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                        $this->assertSame($resetSequence, $originalRow['reset_sequence']);
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Static call to undeclared method \Tests\Base\RecordNumber::getInstance
            Open

                            $number = RecordNumber::getInstance('FInvoice');
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to method rollBack from undeclared class \yii\db\Transaction
            Open

                    self::$transaction->rollBack();
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Property \Tests\Base\Z_ResetingRecordNumber::$transaction has undeclared type \yii\db\Transaction
            Open

                private static $transaction;
            Severity: Minor
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

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

                    self::$transaction = \App\Db::getInstance()->beginTransaction();
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                        $this->assertSame('', $number->get('postfix'));
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                    $this->assertSame($prefix, $originalRow['prefix']);
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                            $this->assertSame($postfix, $number->get('postfix'));
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                        $this->assertSame($date, RecordNumber::date('Y-m-d'));
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                        $this->assertSame($parts[0] . $parts[1], RecordNumber::getSequenceNumber('M'));
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Static call to undeclared method \Tests\Base\RecordNumber::getInstance
            Open

                        $number = RecordNumber::getInstance('FInvoice');
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Static call to undeclared method \Tests\Base\RecordNumber::getInstance
            Open

                    $instance = RecordNumber::getInstance('FInvoice');
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                    $this->assertSame($actualNumber, $originalRow['cur_id']);
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                    $this->assertSame($resetSequence, $originalRow['reset_sequence']);
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                        $this->assertSame($currentNumber + 1, $number->get('cur_id'));
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                        $this->assertSame($resetSequence, $number->get('reset_sequence'));
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                        $this->assertSame($prefix, $originalRow['prefix']);
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Static call to undeclared method \Tests\Base\RecordNumber::getSequenceNumber
            Open

                        $this->assertSame($parts[0] . $parts[1], RecordNumber::getSequenceNumber('M'));
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                        $this->assertSame("$date/$currentNumber", $instance->getIncrementNumber());
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                        $this->assertSame($currentNumber + 1, $number->get('cur_id'));
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                        $this->assertSame($sequence, $number->get('cur_sequence'));
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                        $this->assertSame($prefix, $number->get('prefix'));
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                            $this->assertSame($leadingZeros, $number->get('leading_zeros'));
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                            $this->assertSame($resetSequence, $number->get('reset_sequence'));
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                    $this->assertSame(null, $originalRow['reset_sequence']);
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Static call to undeclared method \Tests\Base\RecordNumber::getInstance
            Open

                        $number = RecordNumber::getInstance('FInvoice');
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                        $this->assertSame(0, $number->get('leading_zeros'));
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                            $this->assertSame("$date/$currentNumber", $instance->getIncrementNumber());
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
            Open

                            $this->assertSame($sequence, $number->get('cur_sequence'));
            Severity: Critical
            Found in tests/Base/Z_ResetingRecordNumber.php by phan

            The class Z_ResetingRecordNumber is not named in CamelCase.
            Open

            class Z_ResetingRecordNumber extends \Tests\Base
            {
                /**
                 * Database transaction pointer.
                 *
            Severity: Minor
            Found in tests/Base/Z_ResetingRecordNumber.php by phpmd

            CamelCaseClassName

            Since: 0.2

            It is considered best practice to use the CamelCase notation to name classes.

            Example

            class class_name {
            }

            Source

            Each class must be in a file by itself
            Open

            class Z_ResetingRecordNumber extends \Tests\Base

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

                public static $currentDateIndex = 0;

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

                 * @return false|string

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

                }

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

                        $instance->set('prefix', '{{YYYY}}/');

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

                 *

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

                }

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

                 * @var \yii\db\Transaction

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

                    $parts = explode('-', RecordNumber::$dates[0]);

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

                    $resetSequence = 'D';

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

                 * Test method "DateMock".

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

                    $this->assertSame($actualNumber, $originalRow['cur_id']);

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

                    $this->assertSame($postfix, $originalRow['postfix']);

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

                    }

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

                        $sequence = $parts[0] . $parts[1];

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

                 * Test method "IncrementNumberStandard".

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

                    }

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

                 */

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

                        $curSequence = '';

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

                public function testParse()

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

                    }

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

                public function testIncrementNumberDay()

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

                        $this->assertSame($sequence, $number->get('cur_sequence'));

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

                public function testIncrementNumberMonth(): void

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

                    $instance->set('cur_sequence', $curSequence);

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

                    $currentNumber = 1;

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

                    $currentDate = '';

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

                        }

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

                 */

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

                    $this->assertSame(1, $result);

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

                        $instance->set('cur_id', $actualNumber);

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

                /**

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

                 * Setting of tests.

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

                        RecordNumber::$currentDateIndex = $index;

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

                 */

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

                }

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

                        $this->assertSame("F-I$actualNumber", $instance->getIncrementNumber());

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

                        $this->assertSame('F-I', $number->get('prefix'));

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

                        $this->assertSame($parts[0] . '/1', $instance->parseNumber(1));

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

                        } else {

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

                 * Test method "IncrementNumberMonth".

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

                    $this->assertSame($actualNumber, $originalRow['cur_id']);

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

                        RecordNumber::$currentDateIndex = $index;

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

                            ++$currentNumber;

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

                /**

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

                    $this->assertSame($curSequence, $originalRow['cur_sequence']);

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

                        $parts = explode('-', $date);

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

                            $currentDate = $sequence;

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

                        }

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

                public function testLeadingZeros(): void

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

                    $this->assertSame(null, $originalRow['reset_sequence']);

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

                        $this->assertSame('', $number->get('cur_sequence'));

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

                        $this->assertSame($currentNumber + 1, $number->get('cur_id'));

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

                    }

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

                {

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

                        if ($sequence === $currentDate) {

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

                    $this->assertSame($resetSequence, $originalRow['reset_sequence']);

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

                    foreach (RecordNumber::$dates as $index => $date) {

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

                        if ($sequence === $currentDate) {

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

                        $this->assertSame($currentNumber + 1, $number->get('cur_id'));

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

                        $this->assertSame($postfix, $number->get('postfix'));

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

                        $instance->set('reset_sequence', $resetSequence);

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

                        $this->assertSame($leadingZeros, $originalRow['leading_zeros']);

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

                        $this->assertSame($actualNumber, $originalRow['cur_id']);

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

                            RecordNumber::$currentDateIndex = $index;

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

                 * @param string   $format

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

                 */

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

                    }

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

                    foreach (RecordNumber::$dates as $index => $date) {

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

                }

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

                        $parts = explode('-', $date);

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

                    $postfix = '';

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

                    $curSequence = ($parts[0] . $parts[1] . $parts[2]);

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

                    $this->assertSame(0, $originalRow['leading_zeros']);

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

                 */

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

                    $originalRow = (new \App\Db\Query())->from('vtiger_modentity_num')->where(['tabid' => 95])->one();

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

                    $result = $instance->save();

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

                    $originalRow = (new \App\Db\Query())->from('vtiger_modentity_num')->where(['tabid' => 95])->one();

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

                            ++$currentNumber;

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

                        $this->assertSame($resetSequence, $number->get('reset_sequence'));

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

                    }

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

                 * Test leading zeros in numbers generation.

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

                            $this->assertSame($prefix, $number->get('prefix'));

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

                    }

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

                 * Database transaction pointer.

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

                 * @var array of dates

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

                 */

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

                        RecordNumber::$currentDateIndex = $index;

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

                    }

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

                /**

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

                    foreach (RecordNumber::$dates as $index => $date) {

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

                    $actualNumber = 1;

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

                        $this->assertSame($parts[2] . '/1', $instance->parseNumber(1));

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

                    $prefix = '{{YYYY}}-{{MM}}-{{DD}}/';

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

                    $actualNumber = 1;

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

                    $instance->set('leading_zeros', 0);

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

                    $instance->set('reset_sequence', $resetSequence);

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

                    $result = $instance->save();

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

                    $currentNumber = 1;

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

                    $this->assertSame($resetSequence, $originalRow['reset_sequence']);

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

                        $this->assertSame($postfix, $number->get('postfix'));

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

                        $this->assertSame("$date/$currentNumber", $instance->getIncrementNumber());

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

                 * Test method "IncrementNumberYear".

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

                    $currentNumber = 1;

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

                {

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

                    $instance->set('leading_zeros', 0);

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

                        $number = RecordNumber::getInstance('FInvoice');

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

                    $currentDate = '';

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

                        $resetSequence = 'Y';

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

                            $currentNumber = 1;

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

                        }

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

                            if ($sequence === $currentDate) {

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

                    \App\Cache::clear();

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

                            } else {

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

                 */

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

                public static $dates = [

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

                        self::$currentDateIndex = 0;

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

                    return date($format, strtotime(self::$dates[self::$currentDateIndex]));

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

                public function testDateMock()

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

                {

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

                public function testSequenceNumber()

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

                {

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

                 */

            Line exceeds 120 characters; contains 140 characters
            Open

                    $originalRow = (new \App\Db\Query())->from('vtiger_modentity_num')->where(['tabid' => \App\Module::getModuleId('FInvoice')])->one();

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

                    $this->assertSame('', $originalRow['cur_sequence']);

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

                    $instance = RecordNumber::getInstance('FInvoice');

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

                        $instance->set('prefix', '{{MM}}/');

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

                 * Test method "IncrementNumberDay".

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

                 * Test record number resetting with new day.

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

                    $instance->set('prefix', $prefix);

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

                    $instance->set('reset_sequence', $resetSequence);

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

                    $instance->set('cur_sequence', $curSequence);

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

                        $sequence = str_replace('-', '', $date);

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

                            $currentDate = $sequence;

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

                 * Test record number resetting with new month.

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

                    $curSequence = '';

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

                            $currentNumber = 1;

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

                 * Test method "LeadingZeros"

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

                        $actualNumber = 1;

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

                        $currentNumber = 1;

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

                                ++$currentNumber;

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

                            $currentNumber = \str_pad($currentNumber, $leadingZeros, '0', STR_PAD_LEFT);

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

                 */

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

                    self::$transaction->rollBack();

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

                        $instance->set('leading_zeros', $leadingZeros);

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

                        $originalRow = (new \App\Db\Query())->from('vtiger_modentity_num')->where(['tabid' => 95])->one();

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

                        $currentDate = '';

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

                                $currentDate = $sequence;

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

                            $sequence = $parts[0];

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

                }

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

                        $instance->set('cur_sequence', $curSequence);

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

                        $this->assertSame($postfix, $originalRow['postfix']);

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

                        foreach (RecordNumber::$dates as $index => $date) {

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

                            $this->assertSame("$date/$currentNumber", $instance->getIncrementNumber());

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

                /**

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

                    '2015-01-01'

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

                /**

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

                public static function date($format, $time = null)

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

                {

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

                    RecordNumber::$dates[0] = date('Y-m-d');

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

                        $this->assertSame($parts[0] . $parts[1], RecordNumber::getSequenceNumber('M'));

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

                public function testIncrementNumberStandard()

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

                    $originalRow = (new \App\Db\Query())->from('vtiger_modentity_num')->where(['tabid' => \App\Module::getModuleId('FInvoice')])->one();

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

                    $this->assertSame('F-I', $originalRow['prefix']);

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

                        $this->assertSame($actualNumber, $number->get('cur_id'));

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

                        $this->assertSame(null, $number->get('reset_sequence'));

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

                        $instance->set('prefix', '{{DD}}/');

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

                    foreach (RecordNumber::$dates as $index => $date) {

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

                    $postfix = '';

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

                    $instance->set('prefix', $prefix);

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

                        $parts = explode('-', $date);

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

                        $number = RecordNumber::getInstance('FInvoice');

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

                    $postfix = '';

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

                    $instance->set('postfix', $postfix);

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

                    $this->assertSame($prefix, $originalRow['prefix']);

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

                    $this->assertSame(0, $originalRow['leading_zeros']);

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

                    $this->assertSame($actualNumber, $originalRow['cur_id']);

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

                        $this->assertSame(0, $number->get('leading_zeros'));

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

                        $instance = RecordNumber::getInstance('FInvoice');

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

                        $instance->set('postfix', $postfix);

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

                            $this->assertSame($currentNumber + 1, $number->get('cur_id'));

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

                            $this->assertSame($postfix, $number->get('postfix'));

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

                 * @var int

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

                private static $transaction;

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

                {

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

                    foreach (RecordNumber::$dates as $index => $date) {

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

                    $result = $instance->save();

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

                            ++$currentNumber;

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

                }

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

                        $this->assertSame($currentNumber + 1, $number->get('cur_id'));

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

                        $this->assertSame($postfix, $number->get('postfix'));

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

                    $curSequence = '';

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

                        $this->assertSame("$date/$currentNumber", $instance->getIncrementNumber());

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

                        $prefix = '{{YYYY}}-{{MM}}-{{DD}}/';

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

                        $postfix = '';

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

                        $instance->set('prefix', $prefix);

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

                        $this->assertSame($curSequence, $originalRow['cur_sequence']);

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

                            $parts = explode('-', $date);

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

                    }

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

                /**

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

                    foreach (RecordNumber::$dates as $index => $date) {

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

                {

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

                    $instance = RecordNumber::getInstance('FInvoice');

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

                        $number = RecordNumber::getInstance('FInvoice');

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

                        $this->assertSame(0, $number->get('leading_zeros'));

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

                /**

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

                    $resetSequence = 'M';

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

                            $currentDate = $sequence;

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

                 * Test record number resetting with new year.

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

                 */

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

                        $this->assertSame($resetSequence, $originalRow['reset_sequence']);

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

                            $this->assertSame($resetSequence, $number->get('reset_sequence'));

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

                }

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

                    self::$transaction = \App\Db::getInstance()->beginTransaction();

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

                /**

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

                        $parts = explode('-', $date);

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

                        $this->assertSame($parts[0] . $parts[1] . $parts[2], RecordNumber::getSequenceNumber('D'));

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

                    $actualNumber = $originalRow['cur_id'];

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

                        ++$actualNumber;

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

                /**

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

                {

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

                    $this->assertSame($prefix, $originalRow['prefix']);

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

                    $this->assertSame($postfix, $originalRow['postfix']);

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

                        RecordNumber::$currentDateIndex = $index;

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

                        $this->assertSame($prefix, $number->get('prefix'));

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

                    $prefix = '{{YYYY}}-{{MM}}-{{DD}}/';

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

                    $instance->set('postfix', $postfix);

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

                    $instance->set('leading_zeros', 0);

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

                    $this->assertSame($prefix, $originalRow['prefix']);

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

                    $this->assertSame(0, $originalRow['leading_zeros']);

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

                        $this->assertSame($prefix, $number->get('prefix'));

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

                public function testIncrementNumberYear(): void

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

                    $instance->set('prefix', $prefix);

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

                        $result = $instance->save();

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

                            }

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

                            $this->assertSame($leadingZeros, $number->get('leading_zeros'));

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

                public static function tearDownAfterClass(): void

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

                ];

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

                 * @param int|null $time

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

                 *

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

                }

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

                /**

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

                 * @codeCoverageIgnore

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

                    $instance->save();

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

                        $this->assertSame('', $number->get('postfix'));

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

                    $originalRow = (new \App\Db\Query())->from('vtiger_modentity_num')->where(['tabid' => 95])->one();

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

                    $this->assertSame($curSequence, $originalRow['cur_sequence']);

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

                    $this->assertSame(1, $result);

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

                    foreach (RecordNumber::$dates as $index => $date) {

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

                        } else {

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

                        $this->assertSame($sequence, $number->get('cur_sequence'));

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

                    $instance->set('cur_id', $actualNumber);

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

                    $instance->set('cur_sequence', $curSequence);

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

                        $sequence = $parts[0];

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

                /**

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

                                $currentNumber = 1;

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

                            $this->assertSame($sequence, $number->get('cur_sequence'));

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

                 * Cleaning after tests.

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

                /**

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

                 */

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

                 * Date method mock for testing purposes.

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

                        $this->assertSame($date, RecordNumber::date('Y-m-d'));

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

                /**

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

                    $instance = RecordNumber::getInstance('FInvoice')->set('prefix', 'F-I')->set('cur_id', 1);

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

                    $this->assertSame('', $originalRow['postfix']);

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

                        $this->assertSame($parts[1] . '/1', $instance->parseNumber(1));

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

                    $instance->set('cur_id', $actualNumber);

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

                    $this->assertSame(1, $result);

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

                    $currentDate = '';

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

                            $currentNumber = 1;

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

                        $this->assertSame("$date/$currentNumber", $instance->getIncrementNumber());

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

                        $this->assertSame($resetSequence, $number->get('reset_sequence'));

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

                    $this->assertSame($curSequence, $originalRow['cur_sequence']);

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

                        $this->assertSame(0, $number->get('leading_zeros'));

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

                }

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

                    $resetSequence = 'Y';

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

                    for ($leadingZeros = 0; $leadingZeros < 7; ++$leadingZeros) {

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

                        $this->assertSame(1, $result);

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

                {

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

                /**

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

                 * Test method "StandardNumber".

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

                        $this->assertSame($parts[0], RecordNumber::getSequenceNumber('Y'));

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

                        $number = RecordNumber::getInstance('FInvoice');

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

                 * Test method "Parse".

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

                 */

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

                        if ($sequence === $currentDate) {

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

                        }

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

                    $instance->set('cur_id', $actualNumber);

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

                        $this->assertSame($resetSequence, $number->get('reset_sequence'));

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

                    $prefix = '{{YYYY}}-{{MM}}-{{DD}}/';

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

                    $instance = RecordNumber::getInstance('FInvoice');

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

                    $instance->set('reset_sequence', $resetSequence);

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

                        } else {

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

                }

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

                        $this->assertSame($prefix, $originalRow['prefix']);

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

                {

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

                 *

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

                    if (!isset(self::$dates[self::$currentDateIndex])) {

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

                 */

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

                public static function setUpBeforeClass(): void

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

                }

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

                 */

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

                 * Test parsing method for record numbers on different dates.

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

                        RecordNumber::$currentDateIndex = $index;

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

                    $instance->set('postfix', $postfix);

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

                    $this->assertSame($resetSequence, $originalRow['reset_sequence']);

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

                    $instance = RecordNumber::getInstance('FInvoice');

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

                    $actualNumber = 1;

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

                    $this->assertSame($postfix, $originalRow['postfix']);

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

                        RecordNumber::$currentDateIndex = $index;

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

                        $this->assertSame($sequence, $number->get('cur_sequence'));

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

                        $this->assertSame($prefix, $number->get('prefix'));

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

                {

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

                            $number = RecordNumber::getInstance('FInvoice');

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

            class Z_ResetingRecordNumber extends \Tests\Base

            There are no issues that match your filters.

            Category
            Status