YetiForceCompany/YetiForceCRM

View on GitHub
include/fields/DateTimeRange.php

Summary

Maintainability
F
3 days
Test Coverage
F
14%

Method getDateRangeByType has 193 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function getDateRangeByType($type, $dateObject = null)
    {
        $currentUser = \App\User::getCurrentUserModel();
        $weekStartDay = $currentUser->getDetail('dayoftheweek');

Severity: Major
Found in include/fields/DateTimeRange.php - About 7 hrs to fix

    Function getDateRangeByType has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function getDateRangeByType($type, $dateObject = null)
        {
            $currentUser = \App\User::getCurrentUserModel();
            $weekStartDay = $currentUser->getDetail('dayoftheweek');
    
    
    Severity: Minor
    Found in include/fields/DateTimeRange.php - About 5 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    File DateTimeRange.php has 314 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * Date time range class.
     *
     * @copyright YetiForce S.A.
    Severity: Minor
    Found in include/fields/DateTimeRange.php - About 3 hrs to fix

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

      class DateTimeRange
      {
          /** Function that converts string to dates.
           * @param $type :: type string
           * @param mixed|null $dateObject
      Severity: Minor
      Found in include/fields/DateTimeRange.php by phpmd

      Function getPresentQuarterRange has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function getPresentQuarterRange($month = 0, &$dateObject = null)
          {
              $quarter = [];
              if (!$month) {
                  $month = date('n');
      Severity: Minor
      Found in include/fields/DateTimeRange.php - About 45 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

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

          public static function getNextQuarterRange($month = 0, $dateObject = null)
          {
              $quarter = [];
              if (!$month) {
                  $month = date('n');
      Severity: Minor
      Found in include/fields/DateTimeRange.php - About 35 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

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

          public static function getPreviousQuarterRange($month = 0, &$dateObject = null)
          {
              $quarter = [];
              if (!$month) {
                  $month = date('n');
      Severity: Minor
      Found in include/fields/DateTimeRange.php - About 35 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

      The method getDateRangeByType() has 197 lines of code. Current threshold is set to 100. Avoid really long methods.
      Open

          public static function getDateRangeByType($type, $dateObject = null)
          {
              $currentUser = \App\User::getCurrentUserModel();
              $weekStartDay = $currentUser->getDetail('dayoftheweek');
      
      
      Severity: Minor
      Found in include/fields/DateTimeRange.php by phpmd

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

          public static function getDateRangeByType($type, $dateObject = null)
          {
              $currentUser = \App\User::getCurrentUserModel();
              $weekStartDay = $currentUser->getDetail('dayoftheweek');
      
      
      Severity: Minor
      Found in include/fields/DateTimeRange.php by phpmd

      CyclomaticComplexity

      Since: 0.1

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

      Example

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

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

      Reduce the number of switch cases from 31 to at most 30.
      Open

              switch ($type) {
      Severity: Major
      Found in include/fields/DateTimeRange.php by sonar-php

      When switch statements have large sets of case clauses, it is usually an attempt to map two sets of data. A real map structure would be more readable and maintainable, and should be used instead.

      This function "getDateRangeByType" has 196 lines, which is greater than the 150 lines authorized. Split it into smaller functions.
      Open

          public static function getDateRangeByType($type, $dateObject = null)
      Severity: Major
      Found in include/fields/DateTimeRange.php by sonar-php

      A function that grows too large tends to aggregate too many responsibilities.

      Such functions inevitably become harder to understand and therefore harder to maintain.

      Above a specific threshold, it is strongly advised to refactor into smaller functions which focus on well-defined tasks.

      Those smaller functions will not only be easier to understand, but also probably easier to test.

      Missing class import via use statement (line '38', column '22').
      Open

                  $dateObject = new DateTime($dateObject);
      Severity: Minor
      Found in include/fields/DateTimeRange.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 '296', column '22').
      Open

                  $dateObject = new DateTime();
      Severity: Minor
      Found in include/fields/DateTimeRange.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 '35', column '22').
      Open

                  $dateObject = new DateTime();
      Severity: Minor
      Found in include/fields/DateTimeRange.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 '253', column '22').
      Open

                  $dateObject = new DateTime();
      Severity: Minor
      Found in include/fields/DateTimeRange.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 '236', column '22').
      Open

                  $dateObject = new DateTime();
      Severity: Minor
      Found in include/fields/DateTimeRange.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 '238', column '22').
      Open

                  $dateObject = new DateTime($dateObject);
      Severity: Minor
      Found in include/fields/DateTimeRange.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 '272', column '22').
      Open

                  $dateObject = new DateTime();
      Severity: Minor
      Found in include/fields/DateTimeRange.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 '274', column '22').
      Open

                  $dateObject = new DateTime($dateObject);
      Severity: Minor
      Found in include/fields/DateTimeRange.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 '255', column '22').
      Open

                  $dateObject = new DateTime($dateObject);
      Severity: Minor
      Found in include/fields/DateTimeRange.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 '330', column '22').
      Open

                  $dateObject = new DateTime();
      Severity: Minor
      Found in include/fields/DateTimeRange.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 '365', column '22').
      Open

                  $dateObject = new DateTime();
      Severity: Minor
      Found in include/fields/DateTimeRange.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 '34', column '20').
      Open

                  $timeZone = new DateTimeZone($currentUser->getDetail('time_zone'));
      Severity: Minor
      Found in include/fields/DateTimeRange.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 getNextQuarterRange uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
      Open

              } else { // 4th Quarter - October - December
                  $dateObject->modify('next year');
                  $quarter[0] = $dateObject->format('Y-01-01');
                  $quarter[1] = $dateObject->format('Y-03-31');
              }
      Severity: Minor
      Found in include/fields/DateTimeRange.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\Fields\Date' in method 'getDateRangeByType'.
      Open

                      $dateValue[0] = \App\Fields\Date::getWorkingDayFromDate($todayObject, '-1 day');
      Severity: Minor
      Found in include/fields/DateTimeRange.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 getDateRangeByType uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
      Open

                      } else {
                          $dateObject->modify('-1 week ' . $weekStartDay);
                      }
      Severity: Minor
      Found in include/fields/DateTimeRange.php by phpmd

      ElseExpression

      Since: 1.4.0

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

      Example

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

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

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

              } else { // 4th Quarter - October - December
                  $quarter[0] = $dateObject->format('Y-10-01');
                  $quarter[1] = $dateObject->format('Y-12-31');
              }
      Severity: Minor
      Found in include/fields/DateTimeRange.php by phpmd

      ElseExpression

      Since: 1.4.0

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

      Example

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

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

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

              } else { // 4th Quarter - October - December
                  $quarter[0] = $dateObject->format('Y-07-01');
                  $quarter[1] = $dateObject->format('Y-09-30');
              }
      Severity: Minor
      Found in include/fields/DateTimeRange.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\Fields\Date' in method 'getDateRangeByType'.
      Open

                      $dateValue[0] = \App\Fields\Date::getWorkingDayFromDate($todayObject, '+1 day');
      Severity: Minor
      Found in include/fields/DateTimeRange.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\User' in method 'getDateRangeByType'.
      Open

              $currentUser = \App\User::getCurrentUserModel();
      Severity: Minor
      Found in include/fields/DateTimeRange.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 getDateRangeByType uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
      Open

                      } else {
                          $dateObject->modify('this ' . $weekStartDay);
                      }
      Severity: Minor
      Found in include/fields/DateTimeRange.php by phpmd

      ElseExpression

      Since: 1.4.0

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

      Example

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

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

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

                      } else {
                          $dateObject->modify('-2 week ' . $weekStartDay);
                      }
      Severity: Minor
      Found in include/fields/DateTimeRange.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

      Define a constant instead of duplicating this literal "Y-m-d" 22 times.
      Open

              $today = $todayObject->format('Y-m-d');
      Severity: Critical
      Found in include/fields/DateTimeRange.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-09-30" 3 times.
      Open

                  $quarter[1] = $dateObject->format('Y-09-30');
      Severity: Critical
      Found in include/fields/DateTimeRange.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-07-01" 3 times.
      Open

                  $quarter[0] = $dateObject->format('Y-07-01');
      Severity: Critical
      Found in include/fields/DateTimeRange.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-10-01" 3 times.
      Open

                  $quarter[0] = $dateObject->format('Y-10-01');
      Severity: Critical
      Found in include/fields/DateTimeRange.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-03-31" 3 times.
      Open

                  $quarter[1] = $dateObject->format('Y-03-31');
      Severity: Critical
      Found in include/fields/DateTimeRange.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-01-01" 6 times.
      Open

              return [$dateObject->format('Y-01-01'), $dateObject->format('Y-12-31')];
      Severity: Critical
      Found in include/fields/DateTimeRange.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-01" 3 times.
      Open

                      $currentMonthStart = $dateObject->format('Y-m-01');
      Severity: Critical
      Found in include/fields/DateTimeRange.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-t" 3 times.
      Open

                      $currentMonthEnd = $dateObject->format('Y-m-t');
      Severity: Critical
      Found in include/fields/DateTimeRange.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-12-31" 6 times.
      Open

              return [$dateObject->format('Y-01-01'), $dateObject->format('Y-12-31')];
      Severity: Critical
      Found in include/fields/DateTimeRange.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-04-01" 3 times.
      Open

                  $quarter[0] = $dateObject->format('Y-04-01');
      Severity: Critical
      Found in include/fields/DateTimeRange.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-06-30" 3 times.
      Open

                  $quarter[1] = $dateObject->format('Y-06-30');
      Severity: Critical
      Found in include/fields/DateTimeRange.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 "+6 days" 4 times.
      Open

                      $dateObject->modify('+6 days');
      Severity: Critical
      Found in include/fields/DateTimeRange.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.

      Saw misspelled annotation @returns. Did you mean @return?
      Open

           * @returns  $dateValue array in the following format
      Severity: Info
      Found in include/fields/DateTimeRange.php by phan

      Variable $dateValue was undeclared, but array fields are being added to it.
      Open

                      $dateValue[0] = $yesterday;
      Severity: Info
      Found in include/fields/DateTimeRange.php by phan

      Variable $dateValue was undeclared, but array fields are being added to it.
      Open

                      $dateValue[0] = \App\Fields\Date::getWorkingDayFromDate($todayObject, '+1 day');
      Severity: Info
      Found in include/fields/DateTimeRange.php by phan

      Return type of getNextQuarterRange() is undeclared type \date
      Open

          public static function getNextQuarterRange($month = 0, $dateObject = null)
      Severity: Minor
      Found in include/fields/DateTimeRange.php by phan

      Variable $dateValue was undeclared, but array fields are being added to it.
      Open

                      $dateValue[0] = $thisWeekStart;
      Severity: Info
      Found in include/fields/DateTimeRange.php by phan

      Return type of getPreviousYearRange() is undeclared type \date
      Open

          public static function getPreviousYearRange(&$dateObject = null)
      Severity: Minor
      Found in include/fields/DateTimeRange.php by phan

      Variable $dateValue was undeclared, but array fields are being added to it.
      Open

                      $dateValue[0] = $lastWeekStart;
      Severity: Info
      Found in include/fields/DateTimeRange.php by phan

      Variable $dateValue was undeclared, but array fields are being added to it.
      Open

                      $dateValue[0] = $today;
      Severity: Info
      Found in include/fields/DateTimeRange.php by phan

      Return type of getPresentYearRange() is undeclared type \date
      Open

          public static function getPresentYearRange(&$dateObject = null)
      Severity: Minor
      Found in include/fields/DateTimeRange.php by phan

      Variable $dateValue was undeclared, but array fields are being added to it.
      Open

                      $dateValue[0] = $last60days;
      Severity: Info
      Found in include/fields/DateTimeRange.php by phan

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

              $currentUser = \App\User::getCurrentUserModel();
      Severity: Critical
      Found in include/fields/DateTimeRange.php by phan

      Variable $dateValue was undeclared, but array fields are being added to it.
      Open

                      $dateValue[0] = $last7days;
      Severity: Info
      Found in include/fields/DateTimeRange.php by phan

      Variable $dateValue was undeclared, but array fields are being added to it.
      Open

                      $dateValue[0] = $last90days;
      Severity: Info
      Found in include/fields/DateTimeRange.php by phan

      Argument 1 (month) is string but \DateTimeRange::getPreviousQuarterRange() takes int defined at /code/include/fields/DateTimeRange.php:323
      Open

                      $dateValue = self::getPreviousQuarterRange($thisMonth, $dateObject);
      Severity: Minor
      Found in include/fields/DateTimeRange.php by phan

      Returning type array{0:string,1:string} but getPreviousYearRange() is declared to return \date
      Open

              return [$dateObject->format('Y-01-01'), $dateObject->format('Y-12-31')];
      Severity: Minor
      Found in include/fields/DateTimeRange.php by phan

      Returning type array{1:string,0:string} but getPresentQuarterRange() is declared to return \date
      Open

              return $quarter;
      Severity: Minor
      Found in include/fields/DateTimeRange.php by phan

      Return type of getPreviousQuarterRange() is undeclared type \date
      Open

          public static function getPreviousQuarterRange($month = 0, &$dateObject = null)
      Severity: Minor
      Found in include/fields/DateTimeRange.php by phan

      Variable $dateValue was undeclared, but array fields are being added to it.
      Open

                      $dateValue[0] = $today;
      Severity: Info
      Found in include/fields/DateTimeRange.php by phan

      Variable $dateValue was undeclared, but array fields are being added to it.
      Open

                      $dateValue[0] = $today;
      Severity: Info
      Found in include/fields/DateTimeRange.php by phan

      Variable $dateValue was undeclared, but array fields are being added to it.
      Open

                      $dateValue[0] = '';
      Severity: Info
      Found in include/fields/DateTimeRange.php by phan

      Variable $dateValue was undeclared, but array fields are being added to it.
      Open

                      $dateValue[0] = $tomorrow;
      Severity: Info
      Found in include/fields/DateTimeRange.php by phan

      Variable $dateValue was undeclared, but array fields are being added to it.
      Open

                      $dateValue[0] = date('Y-m-d', strtotime(0));
      Severity: Info
      Found in include/fields/DateTimeRange.php by phan

      Argument 1 (month) is string but \DateTimeRange::getPresentQuarterRange() takes int defined at /code/include/fields/DateTimeRange.php:289
      Open

                      $dateValue = self::getPresentQuarterRange($thisMonth, $dateObject);
      Severity: Minor
      Found in include/fields/DateTimeRange.php by phan

      Variable $dateValue was undeclared, but array fields are being added to it.
      Open

                      $dateValue[0] = \App\Fields\Date::getWorkingDayFromDate($todayObject, '-1 day');
      Severity: Info
      Found in include/fields/DateTimeRange.php by phan

      Returning type array{1:string,0:string} but getPreviousQuarterRange() is declared to return \date
      Open

              return $quarter;
      Severity: Minor
      Found in include/fields/DateTimeRange.php by phan

      Variable $dateValue was undeclared, but array fields are being added to it.
      Open

                      $dateValue[0] = $nextMonthStart;
      Severity: Info
      Found in include/fields/DateTimeRange.php by phan

      Variable $dateValue was undeclared, but array fields are being added to it.
      Open

                      $dateValue[0] = $today;
      Severity: Info
      Found in include/fields/DateTimeRange.php by phan

      Variable $dateValue was undeclared, but array fields are being added to it.
      Open

                      $dateValue[0] = $last30days;
      Severity: Info
      Found in include/fields/DateTimeRange.php by phan

      Variable $dateValue was undeclared, but array fields are being added to it.
      Open

                      $dateValue[0] = $today;
      Severity: Info
      Found in include/fields/DateTimeRange.php by phan

      Variable $dateValue was undeclared, but array fields are being added to it.
      Open

                      $dateValue[0] = $lastMonthStart;
      Severity: Info
      Found in include/fields/DateTimeRange.php by phan

      Variable $dateValue was undeclared, but array fields are being added to it.
      Open

                      $dateValue[0] = $today;
      Severity: Info
      Found in include/fields/DateTimeRange.php by phan

      Variable $dateValue was undeclared, but array fields are being added to it.
      Open

                      $dateValue[0] = $today;
      Severity: Info
      Found in include/fields/DateTimeRange.php by phan

      Argument 1 (month) is string but \DateTimeRange::getNextQuarterRange() takes int defined at /code/include/fields/DateTimeRange.php:358
      Open

                      $dateValue = self::getNextQuarterRange($thisMonth, $dateObject);
      Severity: Minor
      Found in include/fields/DateTimeRange.php by phan

      Variable $dateValue was undeclared, but array fields are being added to it.
      Open

                      $dateValue[0] = $nextWeekStart;
      Severity: Info
      Found in include/fields/DateTimeRange.php by phan

      Variable $dateValue was undeclared, but array fields are being added to it.
      Open

                      $dateValue[0] = $last120days;
      Severity: Info
      Found in include/fields/DateTimeRange.php by phan

      Returning type array{0:string,1:string} but getPresentYearRange() is declared to return \date
      Open

              return [$dateObject->format('Y-01-01'), $dateObject->format('Y-12-31')];
      Severity: Minor
      Found in include/fields/DateTimeRange.php by phan

      Returning type array{0:string,1:string} but getNextYearRange() is declared to return \date
      Open

              return [$dateObject->format('Y-01-01'), $dateObject->format('Y-12-31')];
      Severity: Minor
      Found in include/fields/DateTimeRange.php by phan

      Returning type array{1:string,0:string} but getNextQuarterRange() is declared to return \date
      Open

              return $quarter;
      Severity: Minor
      Found in include/fields/DateTimeRange.php by phan

      Variable $dateValue was undeclared, but array fields are being added to it.
      Open

                      $dateValue[0] = $currentMonthStart;
      Severity: Info
      Found in include/fields/DateTimeRange.php by phan

      Variable $dateValue was undeclared, but array fields are being added to it.
      Open

                      $dateValue[0] = $last15days;
      Severity: Info
      Found in include/fields/DateTimeRange.php by phan

      Argument 1 (time) is 0 but \strtotime() takes string
      Open

                      $dateValue[0] = date('Y-m-d', strtotime(0));
      Severity: Minor
      Found in include/fields/DateTimeRange.php by phan

      Return type of getNextYearRange() is undeclared type \date
      Open

          public static function getNextYearRange(&$dateObject = null)
      Severity: Minor
      Found in include/fields/DateTimeRange.php by phan

      Return type of getPresentQuarterRange() is undeclared type \date
      Open

          public static function getPresentQuarterRange($month = 0, &$dateObject = null)
      Severity: Minor
      Found in include/fields/DateTimeRange.php by phan

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

              if ($month <= 3) { // 1st Quarter - January - March
                  $dateObject->modify('last year');
                  $quarter[0] = $dateObject->format('Y-10-01');
                  $quarter[1] = $dateObject->format('Y-12-31');
              } elseif ($month > 3 && $month <= 6) { // 2nd Quarter - April - June
      Severity: Major
      Found in include/fields/DateTimeRange.php and 2 other locations - About 1 hr to fix
      include/fields/DateTimeRange.php on lines 299..311
      include/fields/DateTimeRange.php on lines 368..381

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 101.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

              if ($month <= 3) { // 1st Quarter - January - March
                  $quarter[0] = $dateObject->format('Y-04-01');
                  $quarter[1] = $dateObject->format('Y-06-30');
              } elseif ($month > 3 && $month <= 6) { // 2nd Quarter - April - June
                  $quarter[0] = $dateObject->format('Y-07-01');
      Severity: Major
      Found in include/fields/DateTimeRange.php and 2 other locations - About 1 hr to fix
      include/fields/DateTimeRange.php on lines 299..311
      include/fields/DateTimeRange.php on lines 333..346

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 101.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

              if ($month <= 3) { // 1st Quarter - January - March
                  $quarter[0] = $dateObject->format('Y-01-01');
                  $quarter[1] = $dateObject->format('Y-03-31');
              } elseif ($month > 3 && $month <= 6) { // 2nd Quarter - April - June
                  $quarter[0] = $dateObject->format('Y-04-01');
      Severity: Major
      Found in include/fields/DateTimeRange.php and 2 other locations - About 1 hr to fix
      include/fields/DateTimeRange.php on lines 333..346
      include/fields/DateTimeRange.php on lines 368..381

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 101.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

                  case 'lastweek':
                      if ($todayName == $weekStartDay) {
                          $dateObject->modify('-1 week ' . $weekStartDay);
                      } else {
                          $dateObject->modify('-2 week ' . $weekStartDay);
      Severity: Major
      Found in include/fields/DateTimeRange.php and 2 other locations - About 1 hr to fix
      include/fields/DateTimeRange.php on lines 61..72
      include/fields/DateTimeRange.php on lines 85..96

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 100.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

                  case 'thisweek':
                      if ($todayName == $weekStartDay) {
                          $dateObject->modify('-0 week ' . $weekStartDay);
                      } else {
                          $dateObject->modify('-1 week ' . $weekStartDay);
      Severity: Major
      Found in include/fields/DateTimeRange.php and 2 other locations - About 1 hr to fix
      include/fields/DateTimeRange.php on lines 73..84
      include/fields/DateTimeRange.php on lines 85..96

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 100.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

                  case 'nextweek':
                      if ($todayName == $weekStartDay) {
                          $dateObject->modify('+1 week ' . $weekStartDay);
                      } else {
                          $dateObject->modify('this ' . $weekStartDay);
      Severity: Major
      Found in include/fields/DateTimeRange.php and 2 other locations - About 1 hr to fix
      include/fields/DateTimeRange.php on lines 61..72
      include/fields/DateTimeRange.php on lines 73..84

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 100.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Each class must be in a namespace of at least one level (a top-level vendor name)
      Open

      class DateTimeRange

      A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 20 and the first side effect is on line 8.
      Open

      <?php

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

                      $dateValue[0] = $today;

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

                      break;

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

                  case 'thisweek':

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

                      if ($todayName == $weekStartDay) {

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

                  case 'lastweek':

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

                      $nextWeekEnd = $dateObject->format('Y-m-d');

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

                      $dateValue[0] = $currentMonthStart;

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

                      $dateValue[1] = $next15days;

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

                      $dateValue[1] = $next60days;

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

                      $last7days = $dateObject->format('Y-m-d');

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

                      $dateObject->modify('-59 days');

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

                  case 'nextfy':

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

                      $dateValue[0] = \App\Fields\Date::getWorkingDayFromDate($todayObject, '-1 day');

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

                      $dateValue[0] = \App\Fields\Date::getWorkingDayFromDate($todayObject, '+1 day');

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

              switch ($type) {

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

                      $dateValue[1] = $today;

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

                          $dateObject->modify('-0 week ' . $weekStartDay);

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

                      $dateValue[1] = $lastWeekEnd;

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

                      $dateValue[1] = $lastMonthEnd;

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

                      $dateValue[1] = $nextMonthEnd;

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

                      break;

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

                      $dateObject->modify('-6 days');

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

                      break;

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

                  case 'last90days':

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

                      $last90days = $dateObject->format('Y-m-d');

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

                  case 'prevfy':

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

          /** Function that converts string to dates.

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

          {

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

              $thisMonth = $dateObject->format('m');

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

                      $dateObject->modify('+6 days');

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

                      if ($todayName == $weekStartDay) {

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

                          $dateObject->modify('-1 week ' . $weekStartDay);

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

                          $dateObject->modify('this ' . $weekStartDay);

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

                      $next15days = $dateObject->format('Y-m-d');

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

                      break;

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

                      break;

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

                  case 'next120days':

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

                  case 'last7days':

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

                      break;

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

                      $dateValue[0] = $last120days;

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

                      $dateValue = self::getPresentYearRange($dateObject);

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

                  case 'previousworkingday':

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

                      $dateValue[1] = $dateValue[0];

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

                      break;

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

                      $thisWeekEnd = $dateObject->format('Y-m-d');

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

                      $lastWeekEnd = $dateObject->format('Y-m-d');

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

                      $dateObject->modify('+6 days');

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

                      $dateValue[0] = $nextWeekStart;

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

                      $currentMonthEnd = $dateObject->format('Y-m-t');

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

                      $dateObject->modify('first day of last month');

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

                      $dateValue[0] = $today;

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

                      $dateObject->modify('+59 days');

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

                      $dateValue[0] = $today;

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

                      $dateValue[0] = $last15days;

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

                      $last120days = $dateObject->format('Y-m-d');

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

                      break;

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

                      break;

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

           *              $dateValue = Array(0=>$startdate,1=>$enddate)

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

           */

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

                  $timeZone = new DateTimeZone($currentUser->getDetail('time_zone'));

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

                      $dateObject->modify('last day');

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

                  case 'nextweek':

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

                  case 'nextmonth':

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

                      break;

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

                      break;

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

                  case 'nextworkingday':

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

                      break;

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

              }

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

                      $dateValue[1] = $tomorrow;

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

                      break;

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

                      $dateValue[0] = $lastWeekStart;

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

                      break;

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

                      $dateValue[1] = $nextWeekEnd;

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

                      $nextMonthStart = $dateObject->format('Y-m-01');

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

                      $dateValue[0] = $today;

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

                      $dateValue[0] = $today;

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

                      $dateValue[1] = $today;

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

                  case 'last30days':

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

                      $dateValue[1] = $today;

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

                      $dateValue[0] = date('Y-m-d', strtotime(0));

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

                      $dateValue[0] = $yesterday;

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

                          $dateObject->modify('-1 week ' . $weekStartDay);

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

                      if ($todayName == $weekStartDay) {

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

                      $dateValue[0] = $lastMonthStart;

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

                      break;

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

                      $dateValue[1] = $next30days;

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

                      $last15days = $dateObject->format('Y-m-d');

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

                      $dateValue[1] = $today;

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

                      $dateValue = self::getNextYearRange($dateObject);

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

                  case 'thisfq':

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

                  $dateObject->setTimezone($timeZone);

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

              $todayObject = clone $dateObject;

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

                      $tomorrow = $dateObject->format('Y-m-d');

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

                      break;

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

                      }

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

                      $dateValue[0] = $thisWeekStart;

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

                      break;

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

                      $dateValue[0] = $today;

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

                      $next90days = $dateObject->format('Y-m-d');

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

                      $dateValue[1] = $next90days;

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

                      break;

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

                      break;

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

                  case 'last120days':

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

                  case 'yesterday':

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

                          $dateObject->modify('-2 week ' . $weekStartDay);

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

                      $lastMonthEnd = $dateObject->format('Y-m-t');

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

                      $dateValue[0] = $nextMonthStart;

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

                      $next7days = $dateObject->format('Y-m-d');

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

                      $dateObject->modify('+14 days');

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

                  case 'next90days':

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

                      $dateValue[1] = $today;

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

                      break;

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

                      break;

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

                  case 'nextfq':

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

                      $dateValue = self::getNextQuarterRange($thisMonth, $dateObject);

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

                      break;

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

           * @param mixed|null $dateObject

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

                  $dateObject = new DateTime();

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

                      $yesterday = $dateObject->format('Y-m-d');

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

                          $dateObject->modify('+1 week ' . $weekStartDay);

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

                      $currentMonthStart = $dateObject->format('Y-m-01');

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

                      $dateValue[0] = $last7days;

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

                      $dateValue[1] = $today;

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

                      $dateValue[0] = $last60days;

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

                      $dateValue[1] = $today;

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

                  case 'prevfq':

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

                      $dateValue = self::getPreviousQuarterRange($thisMonth, $dateObject);

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

                  $dateObject = new DateTime($dateObject);

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

              $today = $todayObject->format('Y-m-d');

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

                      } else {

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

                      } else {

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

                  case 'thismonth':

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

                      break;

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

                      $dateValue[1] = $next120days;

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

                      break;

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

                      break;

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

              $todayName = $todayObject->format('l');

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

                  case 'tomorrow':

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

                  case 'next7days':

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

                      $dateObject->modify('+6 days');

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

                      $dateValue[1] = $next7days;

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

                  case 'next15days':

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

                      $dateObject->modify('+29 days');

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

                  case 'next60days':

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

                      $next120days = $dateObject->format('Y-m-d');

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

                      $dateObject->modify('-14 days');

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

                      $dateObject->modify('-29 days');

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

                      $dateObject->modify('-119 days');

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

                  default:

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

              return $dateValue;

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

                  $dateObject = new DateTime();

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

              } elseif (\is_string($dateObject)) {

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

                  $dateObject = new DateTime($dateObject);

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

                  $quarter[0] = $dateObject->format('Y-07-01');

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

                  $quarter[1] = $dateObject->format('Y-09-30');

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

              } else { // 4th Quarter - October - December

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

                  $quarter[0] = $dateObject->format('Y-07-01');

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

           * @param object $dateObject

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

                      $dateValue[0] = $tomorrow;

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

                      $dateObject->modify('+6 days');

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

                  case 'lastmonth':

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

                      break;

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

                      $next30days = $dateObject->format('Y-m-d');

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

                      $dateValue[0] = $last30days;

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

                  case 'last60days':

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

                      $last60days = $dateObject->format('Y-m-d');

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

           */

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

              }

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

           * @param object|string $dateObject - date object or string

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

                  $dateObject = new DateTime();

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

              } else { // 4th Quarter - October - December

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

          /**

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

           */

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

          /**

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

              } elseif (\is_string($dateObject)) {

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

                  case 'today':

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

                      $dateObject->modify('tomorrow');

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

                      $dateObject->modify('first day of next month');

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

                      $nextMonthEnd = $dateObject->format('Y-m-t');

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

                      $dateValue[0] = $today;

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

                  case 'next30days':

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

                  case 'last15days':

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

                      $dateValue[1] = $today;

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

                      $dateValue[0] = $last90days;

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

                  case 'thisfy':

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

                      break;

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

                      break;

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

                      $dateValue = self::getPresentQuarterRange($thisMonth, $dateObject);

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

           *

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

           * @param int    $month

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

           * @return date range of present quarter

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

                  $quarter[0] = $dateObject->format('Y-10-01');

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

          {

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

           * @returns  $dateValue array in the following format

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

          public static function getDateRangeByType($type, $dateObject = null)

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

              if (!$dateObject) {

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

                      $dateValue[1] = $yesterday;

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

                      } else {

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

                      break;

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

                      $next60days = $dateObject->format('Y-m-d');

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

                      $dateObject->modify('+89 days');

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

                      $dateObject->modify('+119 days');

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

                      break;

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

          /**

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

              if (!$dateObject) {

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

              return [$dateObject->format('Y-01-01'), $dateObject->format('Y-12-31')];

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

                  $quarter[1] = $dateObject->format('Y-06-30');

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

                  $quarter[1] = $dateObject->format('Y-09-30');

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

           * @param $type :: type string

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

              $currentUser = \App\User::getCurrentUserModel();

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

              $weekStartDay = $currentUser->getDetail('dayoftheweek');

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

                      $thisWeekStart = $dateObject->format('Y-m-d');

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

                      $dateValue[1] = $thisWeekEnd;

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

                      }

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

                      $lastWeekStart = $dateObject->format('Y-m-d');

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

                      }

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

                      $nextWeekStart = $dateObject->format('Y-m-d');

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

                      $dateValue[1] = $currentMonthEnd;

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

                      $lastMonthStart = $dateObject->format('Y-m-01');

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

                      $last30days = $dateObject->format('Y-m-d');

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

                      $dateObject->modify('-89 days');

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

                  case 'untiltoday':

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

                      $dateValue = self::getPreviousYearRange($dateObject);

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

                      $dateValue[1] = $dateValue[0];

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

           * @return date range of present year

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

          {

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

                  $quarter[0] = $dateObject->format('Y-01-01');

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

              } elseif ($month > 3 && $month <= 6) { // 2nd Quarter - April - June

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

                  $quarter[1] = $dateObject->format('Y-06-30');

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

              } elseif ($month > 6 && $month <= 9) { // 3rd Quarter - July - September

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

              return $quarter;

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

                  $quarter[1] = $dateObject->format('Y-12-31');

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

          public static function getNextQuarterRange($month = 0, $dateObject = null)

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

              if (!$month) {

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

              }

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

          }

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

          }

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

              $dateObject->modify('next year');

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

          public static function getPreviousYearRange(&$dateObject = null)

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

              $quarter = [];

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

          }

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

              if ($month <= 3) { // 1st Quarter - January - March

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

                  $quarter[0] = $dateObject->format('Y-07-01');

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

              } else { // 4th Quarter - October - December

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

          {

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

              return [$dateObject->format('Y-01-01'), $dateObject->format('Y-12-31')];

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

           * Function to get start and end date of next calendar year.

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

           *

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

              return [$dateObject->format('Y-01-01'), $dateObject->format('Y-12-31')];

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

           *

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

           * @param object|string $dateObject - date object or string

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

           */

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

                  $quarter[0] = $dateObject->format('Y-04-01');

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

              }

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

              }

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

              }

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

                  $quarter[0] = $dateObject->format('Y-04-01');

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

              } elseif ($month > 3 && $month <= 6) { // 2nd Quarter - April - June

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

                      $dateValue[1] = '';

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

           * Function to get start and end date of past calendar year.

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

          /**

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

           * Function to get start and end date of present calendar quarter.

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

           * @param object $dateObject

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

           * @return date range of present quarter

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

                  $dateObject->modify('last year');

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

              } elseif ($month > 6 && $month <= 9) { // 3rd Quarter - July - September

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

           * Function to get start and end date of next calendar quarter.

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

           * @param int    $month

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

              return $quarter;

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

                  $dateObject = new DateTime();

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

           * Function to get start and end date of present calendar year.

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

           *

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

              }

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

           */

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

          public static function getPresentQuarterRange($month = 0, &$dateObject = null)

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

                  $quarter[1] = $dateObject->format('Y-06-30');

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

              return $quarter;

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

                  $dateObject->modify('next year');

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

                      $dateValue[0] = '';

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

          {

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

              if (!$dateObject) {

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

              }

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

              if (!$dateObject) {

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

              }

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

           * Function to get start and end date of previous calendar quarter.

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

                  $quarter[1] = $dateObject->format('Y-12-31');

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

              }

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

          /**

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

              if (!$dateObject) {

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

                  $dateObject = new DateTime();

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

          /**

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

                  $quarter[1] = $dateObject->format('Y-03-31');

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

           * @param object $dateObject

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

                  $quarter[0] = $dateObject->format('Y-04-01');

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

           *

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

          public static function getPresentYearRange(&$dateObject = null)

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

          public static function getNextYearRange(&$dateObject = null)

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

              } elseif (\is_string($dateObject)) {

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

              if (!$month) {

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

              $quarter = [];

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

              if (!$month) {

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

              if (!$dateObject) {

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

              if ($month <= 3) { // 1st Quarter - January - March

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

                  $quarter[1] = $dateObject->format('Y-03-31');

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

           * @return date range of present quarter

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

              $quarter = [];

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

              } elseif ($month > 6 && $month <= 9) { // 3rd Quarter - July - September

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

                  $quarter[0] = $dateObject->format('Y-10-01');

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

          }

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

           *

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

           */

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

              $dateObject->modify('last year');

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

              if ($month <= 3) { // 1st Quarter - January - March

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

                  $quarter[0] = $dateObject->format('Y-10-01');

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

              }

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

          }

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

                  $quarter[0] = $dateObject->format('Y-01-01');

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

              } elseif (\is_string($dateObject)) {

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

           *

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

           * @return date range of past year

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

                  $dateObject = new DateTime($dateObject);

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

                  $dateObject = new DateTime($dateObject);

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

           * @return date range of next year

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

           *

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

          }

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

          {

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

                  $quarter[1] = $dateObject->format('Y-12-31');

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

                  $month = date('n');

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

           * @param int    $month

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

           *

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

           *

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

              }

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

                  $quarter[0] = $dateObject->format('Y-01-01');

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

              } elseif ($month > 3 && $month <= 6) { // 2nd Quarter - April - June

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

                  $quarter[1] = $dateObject->format('Y-09-30');

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

           *

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

              }

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

           */

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

                  $month = date('n');

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

           * @param object|string $dateObject - date object or string

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

           *

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

              }

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

          }

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

                  $dateObject = new DateTime();

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

          public static function getPreviousQuarterRange($month = 0, &$dateObject = null)

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

          {

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

                  $month = date('n');

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

                  $dateObject = new DateTime();

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

              if (!$dateObject) {

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

                  $quarter[1] = $dateObject->format('Y-03-31');

      There are no issues that match your filters.

      Category
      Status