YetiForceCompany/YetiForceCRM

View on GitHub
app/Fields/DateTime.php

Summary

Maintainability
C
1 day
Test Coverage
F
53%

Function formatToDb has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public static function formatToDb($value, $leadingZeros = false)
    {
        if ($leadingZeros) {
            $delim = ['/', '.'];
            foreach ($delim as $delimiter) {
Severity: Minor
Found in app/Fields/DateTime.php - About 2 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Method getDiff has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function getDiff($start, $end, $format = '%a')
    {
        $interval = (new \DateTime($start))->diff(new \DateTime($end));
        switch ($format) {
            case 'years':
Severity: Minor
Found in app/Fields/DateTime.php - About 2 hrs to fix

    Method formatToDb has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function formatToDb($value, $leadingZeros = false)
        {
            if ($leadingZeros) {
                $delim = ['/', '.'];
                foreach ($delim as $delimiter) {
    Severity: Minor
    Found in app/Fields/DateTime.php - About 1 hr to fix

      Function getDiff has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function getDiff($start, $end, $format = '%a')
          {
              $interval = (new \DateTime($start))->diff(new \DateTime($end));
              switch ($format) {
                  case 'years':
      Severity: Minor
      Found in app/Fields/DateTime.php - About 55 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

      Avoid too many return statements within this method.
      Open

                      return $minutes + $interval->format('%i');
      Severity: Major
      Found in app/Fields/DateTime.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                return $interval->format($format);
        Severity: Major
        Found in app/Fields/DateTime.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                          return $seconds + $interval->format('%s');
          Severity: Major
          Found in app/Fields/DateTime.php - About 30 mins to fix

            The method formatToDb() has an NPath complexity of 217. The configured NPath complexity threshold is 200.
            Open

                public static function formatToDb($value, $leadingZeros = false)
                {
                    if ($leadingZeros) {
                        $delim = ['/', '.'];
                        foreach ($delim as $delimiter) {
            Severity: Minor
            Found in app/Fields/DateTime.php by phpmd

            NPathComplexity

            Since: 0.1

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

            Example

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

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

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

                public static function getDiff($start, $end, $format = '%a')
                {
                    $interval = (new \DateTime($start))->diff(new \DateTime($end));
                    switch ($format) {
                        case 'years':
            Severity: Minor
            Found in app/Fields/DateTime.php by phpmd

            CyclomaticComplexity

            Since: 0.1

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

            Example

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

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

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

                public static function formatToDb($value, $leadingZeros = false)
                {
                    if ($leadingZeros) {
                        $delim = ['/', '.'];
                        foreach ($delim as $delimiter) {
            Severity: Minor
            Found in app/Fields/DateTime.php by phpmd

            CyclomaticComplexity

            Since: 0.1

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

            Example

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

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

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

                public static function getDiff($start, $end, $format = '%a')
            Severity: Major
            Found in app/Fields/DateTime.php by sonar-php

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

            Noncompliant Code Example

            With the default threshold of 3:

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

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

                public static function formatToDb($value, $leadingZeros = false)
            Severity: Critical
            Found in app/Fields/DateTime.php by sonar-php

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

            See

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

                public static function formatToViewDate($dateTime)
            Severity: Major
            Found in app/Fields/DateTime.php by sonar-php

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

            Noncompliant Code Example

            With the default threshold of 3:

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

            Missing class import via use statement (line '35', column '15').
            Open

                    return (new \DateTimeField($value))->getDisplayDateTimeValue();
            Severity: Minor
            Found in app/Fields/DateTime.php by phpmd

            MissingImport

            Since: 2.7.0

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

            Example

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

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

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

                public static function formatToDb($value, $leadingZeros = false)
            Severity: Minor
            Found in app/Fields/DateTime.php by phpmd

            BooleanArgumentFlag

            Since: 1.4.0

            A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

            Example

            class Foo {
                public function bar($flag = true) {
                }
            }

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

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

                public static function formatToDay($dateTime, $allday = false)
            Severity: Minor
            Found in app/Fields/DateTime.php by phpmd

            BooleanArgumentFlag

            Since: 1.4.0

            A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

            Example

            class Foo {
                public function bar($flag = true) {
                }
            }

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

            Missing class import via use statement (line '182', column '49').
            Open

                    $interval = (new \DateTime($start))->diff(new \DateTime($end));
            Severity: Minor
            Found in app/Fields/DateTime.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 '112', column '12').
            Open

                    if ((new \DateTime($dateTime))->format('Y-m-d') === date('Y-m-d')) {
            Severity: Minor
            Found in app/Fields/DateTime.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 '76', column '16').
            Open

                        return (new \DateTimeField($valueList[0] . ' ' . $dbTimeValue))->getDBInsertDateTimeValue();
            Severity: Minor
            Found in app/Fields/DateTime.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 '78', column '15').
            Open

                    return (new \DateTimeField($value))->getDBInsertDateTimeValue();
            Severity: Minor
            Found in app/Fields/DateTime.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 '182', column '20').
            Open

                    $interval = (new \DateTime($start))->diff(new \DateTime($end));
            Severity: Minor
            Found in app/Fields/DateTime.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 '\Vtiger_Util_Helper' in method 'formatToViewDate'.
            Open

                            return '<span title="' . \Vtiger_Util_Helper::formatDateDiffInStrings($dateTime) . '">' . static::formatToDay($dateTime) . '</span>';
            Severity: Minor
            Found in app/Fields/DateTime.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\Fields\Time' in method 'sanitizeDbFormat'.
            Open

                            $value .= ' ' . \App\Fields\Time::sanitizeDbFormat($time);
            Severity: Minor
            Found in app/Fields/DateTime.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 '\Vtiger_Util_Helper' in method 'formatToViewDate'.
            Open

                            return '<span title="' . \Vtiger_Util_Helper::formatDateDiffInStrings($dateTime) . '">' . static::formatToDisplay($dateTime) . '</span>';
            Severity: Minor
            Found in app/Fields/DateTime.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 '\Vtiger_Util_Helper' in method 'formatToViewDate'.
            Open

                            return '<span title="' . static::formatToDay($dateTime) . '">' . \Vtiger_Util_Helper::formatDateDiffInStrings($dateTime) . '</span>';
            Severity: Minor
            Found in app/Fields/DateTime.php by phpmd

            StaticAccess

            Since: 1.4.0

            Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

            Example

            class Foo
            {
                public function bar()
                {
                    Bar::baz();
                }
            }

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

            Avoid using static access to class '\App\Config' in method 'getTimeZone'.
            Open

                            $defaultTimeZone = \App\Config::main('default_timezone');
            Severity: Minor
            Found in app/Fields/DateTime.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\Fields\Date' in method 'sanitizeDbFormat'.
            Open

                        $date = \App\Fields\Date::sanitizeDbFormat($date, $fromFormat);
            Severity: Minor
            Found in app/Fields/DateTime.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\Fields\Time' in method 'formatToShort'.
            Open

                        return \App\Fields\Time::formatToDisplay($dateTime);
            Severity: Minor
            Found in app/Fields/DateTime.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\Fields\Date' in method 'formatToDay'.
            Open

                    $dateDay = Date::getDayFromDate($dateTime, false, true);
            Severity: Minor
            Found in app/Fields/DateTime.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 formatToDay uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

                        } else {
                            [$hours, $minutes] = $timeInUserFormat;
                            $seconds = '';
                        }
            Severity: Minor
            Found in app/Fields/DateTime.php by phpmd

            ElseExpression

            Since: 1.4.0

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

            Example

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

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

            Avoid using static access to class '\App\Language' in method 'formatToDay'.
            Open

                        $formatedDate .= ' ' . \App\Language::translate('LBL_AT') . ' ' . $displayTime;
            Severity: Minor
            Found in app/Fields/DateTime.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 "" 3 times.
            Open

                            return '<span title="' . \Vtiger_Util_Helper::formatDateDiffInStrings($dateTime) . '">' . static::formatToDisplay($dateTime) . '</span>';
            Severity: Critical
            Found in app/Fields/DateTime.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 "<span title="" times.></span>
            Open

                            return '<span title="' . \Vtiger_Util_Helper::formatDateDiffInStrings($dateTime) . '">' . static::formatToDisplay($dateTime) . '</span>';
            Severity: Critical
            Found in app/Fields/DateTime.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.

            Argument 1 (value) is string but \DateTimeField::__construct() takes \type defined at /code/include/fields/DateTimeField.php:31
            Open

                    return (new \DateTimeField($value))->getDBInsertDateTimeValue();
            Severity: Minor
            Found in app/Fields/DateTime.php by phan

            Argument 1 (value) is ?string but \DateTimeField::__construct() takes \type defined at /code/include/fields/DateTimeField.php:31
            Open

                    return (new \DateTimeField($value))->getDisplayDateTimeValue();
            Severity: Minor
            Found in app/Fields/DateTime.php by phan

            Call to method getCurrentUserModel from undeclared class \App\User (Did you mean class \Tests\App\User)
            Open

                    switch (\App\User::getCurrentUserModel()->getDetail('view_date_format')) {
            Severity: Critical
            Found in app/Fields/DateTime.php by phan

            Assigning false to property but \App\Fields\DateTime::$databaseTimeZone is string
            Open

                protected static $databaseTimeZone = false;
            Severity: Minor
            Found in app/Fields/DateTime.php by phan

            Argument 1 (value) is string but \DateTimeField::__construct() takes \type defined at /code/include/fields/DateTimeField.php:31
            Open

                        return (new \DateTimeField($valueList[0] . ' ' . $dbTimeValue))->getDBInsertDateTimeValue();
            Severity: Minor
            Found in app/Fields/DateTime.php by phan

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

                            $x = strpos($value, $delimiter);
            Severity: Minor
            Found in app/Fields/DateTime.php by phpmd

            ShortVariable

            Since: 0.2

            Detects when a field, local, or parameter has a very short name.

            Example

            class Something {
                private $q = 15; // VIOLATION - Field
                public static function main( array $as ) { // VIOLATION - Formal
                    $r = 20 + $this->q; // VIOLATION - Local
                    for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                        $r += $this->q;
                    }
                }
            }

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

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

                        [$y, $m, $d] = explode('-', $value);
            Severity: Minor
            Found in app/Fields/DateTime.php by phpmd

            ShortVariable

            Since: 0.2

            Detects when a field, local, or parameter has a very short name.

            Example

            class Something {
                private $q = 15; // VIOLATION - Field
                public static function main( array $as ) { // VIOLATION - Formal
                    $r = 20 + $this->q; // VIOLATION - Local
                    for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                        $r += $this->q;
                    }
                }
            }

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

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

                        [$y, $m, $d] = explode('-', $value);
            Severity: Minor
            Found in app/Fields/DateTime.php by phpmd

            ShortVariable

            Since: 0.2

            Detects when a field, local, or parameter has a very short name.

            Example

            class Something {
                private $q = 15; // VIOLATION - Field
                public static function main( array $as ) { // VIOLATION - Formal
                    $r = 20 + $this->q; // VIOLATION - Local
                    for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                        $r += $this->q;
                    }
                }
            }

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

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

                        [$y, $m, $d] = explode('-', $value);
            Severity: Minor
            Found in app/Fields/DateTime.php by phpmd

            ShortVariable

            Since: 0.2

            Detects when a field, local, or parameter has a very short name.

            Example

            class Something {
                private $q = 15; // VIOLATION - Field
                public static function main( array $as ) { // VIOLATION - Formal
                    $r = 20 + $this->q; // VIOLATION - Local
                    for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                        $r += $this->q;
                    }
                }
            }

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

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

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

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

                 * Function returns the date in user specified format.
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

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

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

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

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

                public static function formatToDisplay($value)
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

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

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

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

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

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

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

                 * @param string $value Date time
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                        return '';
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                        $value = null;
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                    if ('now' === $value) {
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

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

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

                 * Function to get date and time value for db format.
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                            $x = strpos($value, $delimiter);
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

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

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

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

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

                        $timeInUserFormat = explode(':', $timeInUserFormat);
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                            [$hours, $minutes, $seconds] = $timeInUserFormat;
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

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

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

                        $defaultTimeZone = date_default_timezone_get();
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

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

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

                 * @return int|string difference in format
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                 * @param string $value        Date time
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                            if (false !== $x) {
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                 * Function to parse dateTime into days.
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

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

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

                        if (3 === \count($timeInUserFormat)) {
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                    return $formatedDate . " ($dateDay)";
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                 * Function returning difference in format between date times.
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                public static function getDiff($start, $end, $format = '%a')
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                 * @return string
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                        if (1 == \strlen($m)) {
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                        return (new \DateTimeField($valueList[0] . ' ' . $dbTimeValue))->getDBInsertDateTimeValue();
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                public static function formatToViewDate($dateTime)
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

            Line exceeds 120 characters; contains 149 characters
            Open

                            return '<span title="' . \Vtiger_Util_Helper::formatDateDiffInStrings($dateTime) . '">' . static::formatToDay($dateTime) . '</span>';
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                 * Crop date if today and only return the hour.
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

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

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

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

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

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

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

                            return $interval->format('%Y');
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                            $months = 0;
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                public static function formatToDb($value, $leadingZeros = false)
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                        [$y, $m, $d] = explode('-', $value);
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                            $y = '0' . $y;
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                        $value = implode('-', [$y, $m, $d]);
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                        if (!empty($dbTimeValue) && strrpos($dbTimeValue, ':') == (\strlen($dbTimeValue) - 1)) {
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                        default:
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                            break;
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                    return static::formatToDisplay($dateTime);
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                    return static::$databaseTimeZone;
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                        case 'years':
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                 * @return string
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                        foreach ($delim as $delimiter) {
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                        if (1 == \strlen($d)) {
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

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

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

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

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

                 * @return string
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

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

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

                            [$hours, $minutes] = $timeInUserFormat;
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                 * Time zone cache.
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                            $defaultTimeZone = \App\Config::main('default_timezone');
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                            $years = $interval->format('%Y');
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

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

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

                    if ($leadingZeros) {
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                                $value = str_replace($delimiter, '-', $value);
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                 * @param string $dateTime Date time
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                 * @return string
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                    if ((new \DateTime($dateTime))->format('Y-m-d') === date('Y-m-d')) {
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

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

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

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

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

                    if (!static::$databaseTimeZone) {
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                                $months += $years * 12;
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                            $dbTimeValue = $dbTimeValue . '00';
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

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

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

                        $displayTime = $hours . ':' . $minutes . ' ' . $seconds;
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                 * @return string
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

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

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

                 * @param string $start  ex. '2017-07-10 11:45:56
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                        case 'months':
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                 * @param bool   $leadingZeros
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

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

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

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

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

                 * @param string $dateTime Date time
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                    switch (\App\User::getCurrentUserModel()->getDetail('view_date_format')) {
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                        case 'PLL_FULL':
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                        return \App\Fields\Time::formatToDisplay($dateTime);
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

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

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

                 * @param bool   $allday
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                public static function getTimeZone()
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                        static::$databaseTimeZone = $defaultTimeZone;
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                 * @param string $format Default %a
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                 * @see https://secure.php.net/manual/en/dateinterval.format.php
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                        if (1 == \strlen($y)) {
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

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

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

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

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

                            return '<span title="' . \Vtiger_Util_Helper::formatDateDiffInStrings($dateTime) . '">' . static::formatToDisplay($dateTime) . '</span>';
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

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

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

                 * @return string
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                public static function formatToDay($dateTime, $allday = false)
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                    if (!$allday) {
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

                            if ($years) {
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                                break;
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                        $formatedDate .= ' ' . \App\Language::translate('LBL_AT') . ' ' . $displayTime;
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

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

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

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

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

                 * @see https://secure.php.net/manual/en/class.dateinterval.php
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                            $d = '0' . $d;
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                            $dbTimeValue = $dbTimeValue . ':';
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

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

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

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

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

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

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

                        case 'PLL_ELAPSED':
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                 * @param string $dateTime Date time
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                    [$formatedDate, $timeInUserFormat] = explode(' ', static::formatToDisplay($dateTime));
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

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

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

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

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

                        $delim = ['/', '.'];
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

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

            Line exceeds 120 characters; contains 149 characters
            Open

                            return '<span title="' . static::formatToDay($dateTime) . '">' . \Vtiger_Util_Helper::formatDateDiffInStrings($dateTime) . '</span>';
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                        case 'PLL_FULL_AND_DAY':
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                    return '-';
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

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

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

                 * Get system time zone.
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

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

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

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

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

                        $valueList = explode(' ', $value);
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                 * The function returns the date according to the user's settings.
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

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

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

                            return '<span title="' . static::formatToDay($dateTime) . '">' . \Vtiger_Util_Helper::formatDateDiffInStrings($dateTime) . '</span>';
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

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

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

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

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

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

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

                    if (empty($value) || '0000-00-00' === $value || '0000-00-00 00:00:00' === $value) {
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

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

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

                    return (new \DateTimeField($value))->getDisplayDateTimeValue();
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

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

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

                            $m = '0' . $m;
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                        if (!empty($dbTimeValue) && false === strpos($dbTimeValue, ':')) {
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

            Line exceeds 120 characters; contains 153 characters
            Open

                            return '<span title="' . \Vtiger_Util_Helper::formatDateDiffInStrings($dateTime) . '">' . static::formatToDisplay($dateTime) . '</span>';
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

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

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

                public static function formatToShort(string $dateTime)
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                            $seconds = '';
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                protected static $databaseTimeZone = false;
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

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

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

                    $interval = (new \DateTime($start))->diff(new \DateTime($end));
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

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

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

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

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

                        $dbTimeValue = $valueList[1];
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

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

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

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

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

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

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

                 * @var string
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                        if (empty($defaultTimeZone)) {
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

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

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

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

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

                        case 'days':
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

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

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

                            break;
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                    return (new \DateTimeField($value))->getDBInsertDateTimeValue();
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                            return '<span title="' . \Vtiger_Util_Helper::formatDateDiffInStrings($dateTime) . '">' . static::formatToDay($dateTime) . '</span>';
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

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

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

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

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

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

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

                    $dateDay = Date::getDayFromDate($dateTime, false, true);
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                 * @param string $end    ex. 2017-07-30 12:08:19
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                    switch ($format) {
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                            return $interval->format('%a');
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                            if ($days) {
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

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

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

                            return $months + $interval->format('%m');
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                            return $minutes + $interval->format('%i');
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                        case 'seconds':
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                            if ($hours) {
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

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

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

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

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

                                $minutes += 60 * $hours;
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

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

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

                 * Function changes the datetime format to the database format without changing the time zone.
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                            $value .= ' ' . \App\Fields\Time::sanitizeDbFormat($time);
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                            $hours = 0;
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                            $minutes = 0;
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                    return $interval->format($format);
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

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

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

                    return $value;
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                 * @param string $fromFormat
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                                $hours += 24 * $days;
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                            $hours = $interval->format('%H');
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                            return $seconds + $interval->format('%s');
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                            $days = $interval->format('%a');
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                 * @return string
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                    [$date, $time] = array_pad(explode(' ', $value, 2), 2, '');
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                        if (!empty($time)) {
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                            return $hours + $interval->format('%H');
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                        default:
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                 * @param string $value
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                        $date = \App\Fields\Date::sanitizeDbFormat($date, $fromFormat);
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                            if ($days) {
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                            $days = $interval->format('%a');
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

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

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

                            if ($hours) {
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                            $seconds = 0;
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                                $seconds += 24 * 60 * 60 * $days;
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                                $seconds += 60 * $minutes;
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

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

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

                        case 'hours':
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

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

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

                            $hours = $interval->format('%H');
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

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

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

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

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

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

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

                    if (!empty($date)) {
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                            $days = $interval->format('%a');
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                        case 'minutes':
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                            if ($days) {
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                            if ($minutes) {
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

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

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

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

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

                public static function sanitizeDbFormat(string $value, string $fromFormat): string
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

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

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

                                $minutes += 24 * 60 * $days;
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                                $seconds += 60 * 60 * $hours;
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                            $minutes = $interval->format('%i');
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

                        $value = $date;
            Severity: Minor
            Found in app/Fields/DateTime.php by phpcodesniffer

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

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

            There are no issues that match your filters.

            Category
            Status