YetiForceCompany/YetiForceCRM

View on GitHub
app/Fields/Date.php

Summary

Maintainability
C
7 hrs
Test Coverage
F
22%

The class Date has an overall complexity of 70 which is very high. The configured complexity threshold is 50.
Open

class Date
{
    public static $jsDateFormat = [
        'dd-mm-yyyy' => 'd-m-Y',
        'mm-dd-yyyy' => 'm-d-Y',
Severity: Minor
Found in app/Fields/Date.php by phpmd

Function sanitizeDbFormat has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public static function sanitizeDbFormat(string $date, string $fromFormat)
    {
        $dbDate = '';
        if ($date) {
            [$y, $m, $d] = self::explode($date, $fromFormat);
Severity: Minor
Found in app/Fields/Date.php - About 1 hr to fix

Cognitive Complexity

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

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

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

Further reading

Function formatToDb has a Cognitive Complexity of 13 (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/Date.php - About 1 hr to fix

Cognitive Complexity

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

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

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

Further reading

Function explode has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public static function explode($date, $format = false)
    {
        if (empty($format)) {
            $format = 'yyyy-mm-dd';
        }
Severity: Minor
Found in app/Fields/Date.php - About 1 hr to fix

Cognitive Complexity

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

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

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

Further reading

Method explode has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function explode($date, $format = false)
    {
        if (empty($format)) {
            $format = 'yyyy-mm-dd';
        }
Severity: Minor
Found in app/Fields/Date.php - About 1 hr to fix

    Method sanitizeDbFormat has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function sanitizeDbFormat(string $date, string $fromFormat)
        {
            $dbDate = '';
            if ($date) {
                [$y, $m, $d] = self::explode($date, $fromFormat);
    Severity: Minor
    Found in app/Fields/Date.php - About 1 hr to fix

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

          public static function sanitizeDbFormat(string $date, string $fromFormat)
          {
              $dbDate = '';
              if ($date) {
                  [$y, $m, $d] = self::explode($date, $fromFormat);
      Severity: Minor
      Found in app/Fields/Date.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 explode() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
      Open

          public static function explode($date, $format = false)
          {
              if (empty($format)) {
                  $format = 'yyyy-mm-dd';
              }
      Severity: Minor
      Found in app/Fields/Date.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

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

              $query = (new \App\Db\Query())->from('vtiger_publicholiday');
      Severity: Minor
      Found in app/Fields/Date.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 '311', column '15').
      Open

                      throw new \App\Exceptions\AppException('Exceeded the recursive limit, a loop might have been created.');
      Severity: Minor
      Found in app/Fields/Date.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 '168', column '15').
      Open

              return (new \DateTimeField($value))->getDBInsertDateValue();
      Severity: Minor
      Found in app/Fields/Date.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 '113', column '15').
      Open

              return (new \DateTimeField($value))->getDisplayDate();
      Severity: Minor
      Found in app/Fields/Date.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 getDayFromDate has a boolean flag argument $shortName, which is a certain sign of a Single Responsibility Principle violation.
      Open

          public static function getDayFromDate($date, $shortName = false, $translated = false)
      Severity: Minor
      Found in app/Fields/Date.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 getShortDaysOfWeek has a boolean flag argument $byId, which is a certain sign of a Single Responsibility Principle violation.
      Open

          public static function getShortDaysOfWeek(bool $byId = true)
      Severity: Minor
      Found in app/Fields/Date.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 getDayFromDate has a boolean flag argument $translated, which is a certain sign of a Single Responsibility Principle violation.
      Open

          public static function getDayFromDate($date, $shortName = false, $translated = false)
      Severity: Minor
      Found in app/Fields/Date.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 getOnlyWorkingDayFromDate has a boolean flag argument $increase, which is a certain sign of a Single Responsibility Principle violation.
      Open

          public static function getOnlyWorkingDayFromDate(\DateTime $date, int $counter, bool $increase = true, int $id = \App\Utils\BusinessHours::DEFAULT_BUSINESS_HOURS_ID): string
      Severity: Minor
      Found in app/Fields/Date.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 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/Date.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 explode has a boolean flag argument $format, which is a certain sign of a Single Responsibility Principle violation.
      Open

          public static function explode($date, $format = false)
      Severity: Minor
      Found in app/Fields/Date.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 currentUserJSDateFormat has a boolean flag argument $format, which is a certain sign of a Single Responsibility Principle violation.
      Open

          public static function currentUserJSDateFormat($format = false)
      Severity: Minor
      Found in app/Fields/Date.php by phpmd

      BooleanArgumentFlag

      Since: 1.4.0

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

      Example

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

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

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

              if (\App\Cache::has('Date::getHolidays', $start . $end)) {
      Severity: Minor
      Found in app/Fields/Date.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 getShortDaysOfWeek uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
      Open

                  } else {
                      $days[static::$shortDaysTranslations[$day]] = $id;
                  }
      Severity: Minor
      Found in app/Fields/Date.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\Utils\BusinessHours' in method 'getWorkingDayFromDate'.
      Open

              $businessHours = \App\Utils\BusinessHours::getBusinessHoursById($id);
      Severity: Minor
      Found in app/Fields/Date.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\Language' in method 'getDayFromDate'.
      Open

                  return \App\Language::translate(date($shortName ? 'D' : 'l', strtotime($date)), $shortName ? 'Vtiger' : 'Calendar');
      Severity: Minor
      Found in app/Fields/Date.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\Language' in method 'getHolidays'.
      Open

                      'day' => \App\Language::translate(date('l', strtotime($row['holidaydate'])), 'PublicHoliday'),
      Severity: Minor
      Found in app/Fields/Date.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 'getHolidays'.
      Open

                  return \App\Cache::get('Date::getHolidays', $start . $end);
      Severity: Minor
      Found in app/Fields/Date.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 sanitizeDbFormat uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
      Open

                  } else {
                      $dbDate = $y . '-' . $m . '-' . $d;
                  }
      Severity: Minor
      Found in app/Fields/Date.php by phpmd

      ElseExpression

      Since: 1.4.0

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

      Example

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

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

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

              \App\Cache::save('Date::getHolidays', $start . $end, $holidays);
      Severity: Minor
      Found in app/Fields/Date.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 "Date::getHolidays" 3 times.
      Open

              if (\App\Cache::has('Date::getHolidays', $start . $end)) {
      Severity: Critical
      Found in app/Fields/Date.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 "Y-m-d" 4 times.
      Open

              'yyyy-mm-dd' => 'Y-m-d',
      Severity: Critical
      Found in app/Fields/Date.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 "mm-dd-yyyy" 3 times.
      Open

              'mm-dd-yyyy' => 'm-d-Y',
      Severity: Critical
      Found in app/Fields/Date.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 "Tuesday" 3 times.
      Open

              'Tuesday' => 2,
      Severity: Critical
      Found in app/Fields/Date.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

              'yyyy-mm-dd' => 'Y-m-d',
      Severity: Critical
      Found in app/Fields/Date.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 "Thursday" 3 times.
      Open

              'Thursday' => 4,
      Severity: Critical
      Found in app/Fields/Date.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 "holidaydate" 5 times.
      Open

                  $query->where(['between', 'holidaydate', $start, $end]);
      Severity: Critical
      Found in app/Fields/Date.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 "Wednesday" 3 times.
      Open

              'Wednesday' => 3,
      Severity: Critical
      Found in app/Fields/Date.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 "Saturday" 3 times.
      Open

              'Saturday' => 6,
      Severity: Critical
      Found in app/Fields/Date.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 "dd-mm-yyyy" 3 times.
      Open

              'dd-mm-yyyy' => 'd-m-Y',
      Severity: Critical
      Found in app/Fields/Date.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 "Sunday" 3 times.
      Open

              'Sunday' => 0,
      Severity: Critical
      Found in app/Fields/Date.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 "Monday" 3 times.
      Open

              'Monday' => 1,
      Severity: Critical
      Found in app/Fields/Date.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 "Friday" 3 times.
      Open

              'Friday' => 5,
      Severity: Critical
      Found in app/Fields/Date.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))->getDisplayDate();
      Severity: Minor
      Found in app/Fields/Date.php by phan

      Invalid offset true of array type array{dd-mm-yyyy:'d-m-Y',mm-dd-yyyy:'m-d-Y',yyyy-mm-dd:'Y-m-d',dd.mm.yyyy:'d.m.Y',mm.dd.yyyy:'m.d.Y',yyyy.mm.dd:'Y.m.d',dd/mm/yyyy:'d/m/Y',mm/dd/yyyy:'m/d/Y',yyyy/mm/dd:'Y/m/d'}
      Open

                  return static::$jsDateFormat[$format];
      Severity: Minor
      Found in app/Fields/Date.php by phan

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

              $query = (new \App\Db\Query())->from('vtiger_publicholiday');
      Severity: Critical
      Found in app/Fields/Date.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))->getDBInsertDateValue();
      Severity: Minor
      Found in app/Fields/Date.php by phan

      Returning type null but currentUserJSDateFormat() is declared to return bool|string
      Open

                  return static::$jsDateFormat[$format];
      Severity: Minor
      Found in app/Fields/Date.php by phan

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

              return static::$jsDateFormat[\App\User::getCurrentUserModel()->getDetail('date_format')] ?? false;
      Severity: Critical
      Found in app/Fields/Date.php by phan

      Avoid excessively long variable names like $shortDaysTranslations. Keep variable name length under 20.
      Open

          public static $shortDaysTranslations = [
              'Sunday' => 'LBL_SM_SUN',
              'Monday' => 'LBL_SM_MON',
              'Tuesday' => 'LBL_SM_TUE',
              'Wednesday' => 'LBL_SM_WED',
      Severity: Minor
      Found in app/Fields/Date.php by phpmd

      LongVariable

      Since: 0.2

      Detects when a field, formal or local variable is declared with a long name.

      Example

      class Something {
          protected $reallyLongIntName = -3; // VIOLATION - Field
          public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
              $otherReallyLongName = -5; // VIOLATION - Local
              for ($interestingIntIndex = 0; // VIOLATION - For
                   $interestingIntIndex < 10;
                   $interestingIntIndex++ ) {
              }
          }
      }

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

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

                      [$d, $m, $y] = array_pad(explode('-', $date, 3), 3, null);
      Severity: Minor
      Found in app/Fields/Date.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 $x. Configured minimum length is 3.
      Open

                      $x = strpos($value, $delimiter);
      Severity: Minor
      Found in app/Fields/Date.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 $id. Configured minimum length is 3.
      Open

          public static function getOnlyWorkingDayFromDate(\DateTime $date, int $counter, bool $increase = true, int $id = \App\Utils\BusinessHours::DEFAULT_BUSINESS_HOURS_ID): string
      Severity: Minor
      Found in app/Fields/Date.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] = self::explode($date, $format))
      Severity: Minor
      Found in app/Fields/Date.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] = self::explode($date, $format))
      Severity: Minor
      Found in app/Fields/Date.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] = self::explode($date, $fromFormat);
      Severity: Minor
      Found in app/Fields/Date.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] = self::explode($date, $format))
      Severity: Minor
      Found in app/Fields/Date.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/Date.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] = self::explode($date, $fromFormat);
      Severity: Minor
      Found in app/Fields/Date.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] = self::explode($date, $fromFormat);
      Severity: Minor
      Found in app/Fields/Date.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/Date.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/Date.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

                      [$d, $m, $y] = array_pad(explode('-', $date, 3), 3, null);
      Severity: Minor
      Found in app/Fields/Date.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

                      [$d, $m, $y] = array_pad(explode('-', $date, 3), 3, null);
      Severity: Minor
      Found in app/Fields/Date.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 $id. Configured minimum length is 3.
      Open

          public static function getWorkingDayFromDate(\DateTime $date, string $modify, int $id = \App\Utils\BusinessHours::DEFAULT_BUSINESS_HOURS_ID): string
      Severity: Minor
      Found in app/Fields/Date.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

      Terminating statement must be indented to the same level as the CASE body
      Open

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

      Terminating statement must be indented to the same level as the CASE body
      Open

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

      Terminating statement must be indented to the same level as the CASE body
      Open

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

      Terminating statement must be indented to the same level as the CASE body
      Open

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

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

                  return static::$jsDateFormat[$format];
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

           * Convert date from database format to user format.
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

              'Thursday' => 4,
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

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

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

              'Monday' => 1,
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

              'Wednesday' => 3,
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

           * @var array
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

              'Thursday' => 'LBL_SM_THU',
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

              'Saturday' => 'LBL_SM_SAT',
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

           * As in the date value is on mm-dd-yyyy and user date format is dd-mm-yyyy then the mm-dd-yyyy
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

           *
      Severity: Minor
      Found in app/Fields/Date.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/Date.php by phpcodesniffer

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

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

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

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

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

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

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

              'mm-dd-yyyy' => 'm-d-Y',
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

           * @var array
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

              'Tuesday' => 2,
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

              'Wednesday' => 'LBL_SM_WED',
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

              'Friday' => 'LBL_SM_FRI',
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

           * This function returns the date in user specified format.
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

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

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

              'yyyy.mm.dd' => 'Y.m.d',
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

              'dd/mm/yyyy' => 'd/m/Y',
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

          public static $dayOfWeekForJS = [
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

              'Saturday' => 6,
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

           * ISO-8601 numeric representation of the day of the week.
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

              'Tuesday' => 2,
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

              'Wednesday' => 3,
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

              'Saturday' => 6,
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

              'Thursday' => 4,
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

          public static $shortDaysTranslations = [
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

              return static::$jsDateFormat[\App\User::getCurrentUserModel()->getDetail('date_format')] ?? false;
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

          public static $jsDateFormat = [
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

              'Sunday' => 'LBL_SM_SUN',
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

              'yyyy-mm-dd' => 'Y-m-d',
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

              'mm.dd.yyyy' => 'm.d.Y',
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

              'Friday' => 5,
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

          public static $dayOfWeek = [
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

              'Monday' => 'LBL_SM_MON',
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

              'Tuesday' => 'LBL_SM_TUE',
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

              'mm/dd/yyyy' => 'm/d/Y',
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

              'yyyy/mm/dd' => 'Y/m/d',
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

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

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

              'Sunday' => 7,
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

           * limitation is that mm-dd-yyyy and dd-mm-yyyy will be considered same by this API.
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

           * value will be return as the API will be considered as considered as in same format.
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

           * @param string $value the date which should a changed to user date format
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

           * Short days translations.
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

           * @param array $range ['2018-02-03','2018-02-04']
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

              'dd.mm.yyyy' => 'd.m.Y',
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

           * Numeric representation of the day of the week.
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

           * this due to the fact that this API tries to consider the where given date is in user date
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

           * format. we need a better gauge for this case.
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

           *
      Severity: Minor
      Found in app/Fields/Date.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/Date.php by phpcodesniffer

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

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

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

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

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

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

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

                      [$m, $d, $y] = array_pad(explode('.', $date, 3), 3, null);
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

                      [$m, $d, $y] = array_pad(explode('/', $date, 3), 3, null);
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

           * @param mixed  $translated
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

              return date($shortName ? 'D' : 'l', strtotime($date));
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

                  return \App\Cache::get('Date::getHolidays', $start . $end);
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

                  if (!empty($range[0]) && !empty($range[1])) {
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

                  case 'dd-mm-yyyy':
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

                  case 'mm-dd-yyyy':
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

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

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

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

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

                          break;
      Severity: Minor
      Found in app/Fields/Date.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/Date.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/Date.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

                  $query->where(['between', 'holidaydate', $start, $end]);
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

              $holidays = [];
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

           * Convert date to single items.
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

           * @return array Array date list($y, $m, $d)
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

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

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

                      [$y, $m, $d] = array_pad(explode('.', $date, 3), 3, null);
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

           * Gets list of holidays.
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

                  case 'mm.dd.yyyy':
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

              return [$y, $m, $d];
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

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

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

              if ($start && $end) {
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

                  return false;
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

           * Function to get date value for db format.
      Severity: Minor
      Found in app/Fields/Date.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/Date.php by phpcodesniffer

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

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

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

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

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

          public static function getDayFromDate($date, $shortName = false, $translated = false)
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

              'Sunday' => 0,
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

              'Monday' => 1,
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

              'Friday' => 5,
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

           * Current user JS date format.
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

           *
      Severity: Minor
      Found in app/Fields/Date.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/Date.php by phpcodesniffer

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

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

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

          public static function formatRangeToDisplay($range)
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

                          static::formatToDisplay($range[1]),
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

           * @param bool   $leadingZeros
      Severity: Minor
      Found in app/Fields/Date.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/Date.php by phpcodesniffer

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

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

      Line exceeds 120 characters; contains 128 characters
      Open

                  return \App\Language::translate(date($shortName ? 'D' : 'l', strtotime($date)), $shortName ? 'Vtiger' : 'Calendar');
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

              return false;
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

          public static function getHolidays(string $start = '', string $end = ''): array
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

                  case 'yyyy/mm/dd':
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

           * Get day from date or datetime.
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

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

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

                          static::formatToDisplay($range[0]),
      Severity: Minor
      Found in app/Fields/Date.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/Date.php by phpcodesniffer

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

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

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

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

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

                  case 'mm/dd/yyyy':
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

          public static function getShortDaysOfWeek(bool $byId = true)
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

              if (\App\Cache::has('Date::getHolidays', $start . $end)) {
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

              'dd-mm-yyyy' => 'd-m-Y',
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

           * @example date('N')
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

           * @var array
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

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

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

          public static function currentUserJSDateFormat($format = false)
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

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

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

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

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

                      [$d, $m, $y] = array_pad(explode('-', $date, 3), 3, null);
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

                      [$y, $m, $d] = array_pad(explode('-', $date, 3), 3, null);
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

                  case 'dd/mm/yyyy':
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

                      [$y, $m, $d] = array_pad(explode('/', $date, 3), 3, null);
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

                  return \App\Language::translate(date($shortName ? 'D' : 'l', strtotime($date)), $shortName ? 'Vtiger' : 'Calendar');
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

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

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

              $days = [];
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          public static function explode($date, $format = false)
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

                  $format = 'yyyy-mm-dd';
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

                  case 'yyyy-mm-dd':
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

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

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

              foreach (static::$dayOfWeek as $day => $id) {
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

              if (\is_array($range)) {
      Severity: Minor
      Found in app/Fields/Date.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/Date.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

                      $days[static::$shortDaysTranslations[$day]] = $id;
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

              return $days;
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

              $query->orderBy(['holidaydate' => SORT_ASC]);
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

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

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

                      [$d, $m, $y] = array_pad(explode('.', $date, 3), 3, null);
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

                      [$d, $m, $y] = array_pad(explode('/', $date, 3), 3, null);
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

                      $days[$id] = static::$shortDaysTranslations[$day];
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

           * @return array|bool ['03.02.2018','04.02.2018'] or false
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

           */
      Severity: Minor
      Found in app/Fields/Date.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/Date.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

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

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

           * @param bool $byId associative array by day id
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

              $query = (new \App\Db\Query())->from('vtiger_publicholiday');
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

           */
      Severity: Minor
      Found in app/Fields/Date.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/Date.php by phpcodesniffer

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

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

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

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

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

           * @param bool|string $format Date format
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

                      [$m, $d, $y] = array_pad(explode('-', $date, 3), 3, null);
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

                  case 'dd.mm.yyyy':
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

                  case 'yyyy.mm.dd':
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

           * Get short days of week.
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

              $dataReader = $query->createCommand()->query();
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

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

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

              while ($counter-- > 0) {
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

                      $formatToConvert = str_replace(['/', '.'], '-', $fromFormat);
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

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

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

                      'type' => $row['holidaytype'],
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

           * @param \DateTime $date
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

      Line exceeds 120 characters; contains 177 characters
      Open

          public static function getOnlyWorkingDayFromDate(\DateTime $date, int $counter, bool $increase = true, int $id = \App\Utils\BusinessHours::DEFAULT_BUSINESS_HOURS_ID): string
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

                      } elseif (false !== strpos($date, '.')) {
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

              if ($businessHours['holidays'] ?? 1) {
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

          public static function getOnlyWorkingDayFromDate(\DateTime $date, int $counter, bool $increase = true, int $id = \App\Utils\BusinessHours::DEFAULT_BUSINESS_HOURS_ID): string
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

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

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

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

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

          public static function isValid(string $date, ?string $format = null): bool
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

          public static function getWorkingDayFromDate(\DateTime $date, string $modify, int $id = \App\Utils\BusinessHours::DEFAULT_BUSINESS_HOURS_ID): string
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

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

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

              while (isset($holidays[$value]) || !\in_array($date->format('N'), $workingDays)) {
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

              $value = $date->format('Y-m-d');
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

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

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

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

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

                  [$y, $m, $d] = self::explode($date, $fromFormat);
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

                  if (!$y || !$m || !$d) {
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

                      } elseif (false !== strpos($date, '/')) {
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

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

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

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

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

              && ([$y, $m, $d] = self::explode($date, $format))
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

           * Check if the date is correct.
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

              return (false !== strpos($date, '-') || false !== strpos($date, '.') || false !== strpos($date, '/'))
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

                      'name' => $row['holidayname'],
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

              \App\Cache::save('Date::getHolidays', $start . $end, $holidays);
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

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

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

           * @param int       $counter
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

                      case 'dd-mm-yyyy':
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

              $value = $date->modify($modify)->format('Y-m-d');
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

              $iterator = 31;
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

           * Method to return date counted only using working days.
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

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

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

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

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

                          $separator = '-';
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

                  $holidays[$row['holidaydate']] = [
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

                      'id' => $row['publicholidayid'],
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

           * Get closest working day from given data.
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

                      $dateToConvert = str_replace($separator, '-', $date);
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

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

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

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

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

              return $holidays;
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

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

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

                  $holidays = self::getHolidays();
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

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

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

           * @return bool
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

                      'date' => $row['holidaydate'],
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

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

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

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

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

              && checkdate($m, $d, $y) && strtotime("{$y}-{$m}-{$d}");
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

           * @param \DateTime $date
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

                      case 'mm-dd-yyyy':
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

           * @param int       $id
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

              $businessHours = \App\Utils\BusinessHours::getBusinessHoursById($id);
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

              $holidays = [];
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

                      throw new \App\Exceptions\AppException('Exceeded the recursive limit, a loop might have been created.');
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

                      $dbDate = $y . '-' . $m . '-' . $d;
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

              return $dbDate;
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

              && is_numeric($m) && is_numeric($d) && is_numeric($y)
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

                      'day' => \App\Language::translate(date('l', strtotime($row['holidaydate'])), 'PublicHoliday'),
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

              $workingDays = explode(',', $businessHours['working_days'] ?? '1,2,3,4,5');
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

                  $value = $date->modify($modify[0] . '1 day')->format('Y-m-d');
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

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

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

           * @param string|null $format
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

      Line exceeds 120 characters; contains 152 characters
      Open

          public static function getWorkingDayFromDate(\DateTime $date, string $modify, int $id = \App\Utils\BusinessHours::DEFAULT_BUSINESS_HOURS_ID): string
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

                  $value = self::getWorkingDayFromDate($date, ($increase ? '+' : '-') . '1 day', $id);
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

                      if (false !== strpos($date, '-')) {
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

                      $dbDate = $y . '-' . $m . '-' . $d;
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

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

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

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

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

                  if (0 === --$iterator) {
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

           * @param int       $id
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

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

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

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

                      case 'yyyy-mm-dd':
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

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

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

      Line indented incorrectly; expected 20 spaces, found 16
      Open

                      case 'yyyy-mm-dd':
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

      Closing brace indented incorrectly; expected 16 spaces, found 12
      Open

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

      Line indented incorrectly; expected 20 spaces, found 16
      Open

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

      Line indented incorrectly; expected 20 spaces, found 16
      Open

                      case 'mm-dd-yyyy':
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

      Line indented incorrectly; expected 20 spaces, found 16
      Open

                      case 'dd-mm-yyyy':
      Severity: Minor
      Found in app/Fields/Date.php by phpcodesniffer

      Line indented incorrectly; expected at least 24 spaces, found 20
      Open

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

      Line indented incorrectly; expected at least 24 spaces, found 20
      Open

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

      Line indented incorrectly; expected 16 spaces, found 12
      Open

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

      Line indented incorrectly; expected at least 24 spaces, found 20
      Open

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

      There are no issues that match your filters.

      Category
      Status