YetiForceCompany/YetiForceCRM

View on GitHub
modules/com_vtiger_workflow/Workflow.php

Summary

Maintainability
F
3 days
Test Coverage
F
16%

Function getNextTriggerTimeForWeekly has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Open

    public function getNextTriggerTimeForWeekly($scheduledDaysOfWeek, $scheduledTime)
    {
        $weekDays = ['1' => 'Monday', '2' => 'Tuesday', '3' => 'Wednesday', '4' => 'Thursday', '5' => 'Friday', '6' => 'Saturday', '7' => 'Sunday'];
        $currentTime = time();
        $currentWeekDay = date('N', $currentTime);
Severity: Minor
Found in modules/com_vtiger_workflow/Workflow.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 Workflow.php has 338 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/* +**********************************************************************************
 * The contents of this file are subject to the vtiger CRM Public License Version 1.0
 * ("License"); You may not use this file except in compliance with the License
 * The Original Code is:  vtiger CRM Open Source
Severity: Minor
Found in modules/com_vtiger_workflow/Workflow.php - About 4 hrs to fix

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

    class Workflow
    {
        /**
         * Scheduled hourly.
         *

    Function getNextTriggerTimeForMonthlyByDate has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getNextTriggerTimeForMonthlyByDate($scheduledDayOfMonth, $scheduledTime)
        {
            $currentDayOfMonth = date('j', time());
            if ($scheduledDayOfMonth) {
                $scheduledDaysOfMonth = \App\Json::decode($scheduledDayOfMonth);
    Severity: Minor
    Found in modules/com_vtiger_workflow/Workflow.php - About 3 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

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

        public function performTasks(Vtiger_Record_Model $recordModel, ?array $tasks = null)
        {
            require_once 'modules/com_vtiger_workflow/VTTaskManager.php';
            require_once 'modules/com_vtiger_workflow/VTTaskQueue.php';
    
    
    Severity: Minor
    Found in modules/com_vtiger_workflow/Workflow.php - About 2 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    Workflow has 21 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Workflow
    {
        /**
         * Scheduled hourly.
         *
    Severity: Minor
    Found in modules/com_vtiger_workflow/Workflow.php - About 2 hrs to fix

      Function getNextTriggerTimeForAnnualDates has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getNextTriggerTimeForAnnualDates($annualDates, $scheduledTime)
          {
              if ($annualDates) {
                  $today = date('Y-m-d');
                  $annualDates = \App\Json::decode($annualDates);
      Severity: Minor
      Found in modules/com_vtiger_workflow/Workflow.php - About 2 hrs to fix

      Cognitive Complexity

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

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

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

      Further reading

      Method getNextTriggerTime has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getNextTriggerTime()
          {
              $default_timezone = \App\Config::main('default_timezone');
              $admin = Users::getActiveAdminUser();
              $adminTimeZone = $admin->time_zone;
      Severity: Major
      Found in modules/com_vtiger_workflow/Workflow.php - About 2 hrs to fix

        Function getNextTriggerTime has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getNextTriggerTime()
            {
                $default_timezone = \App\Config::main('default_timezone');
                $admin = Users::getActiveAdminUser();
                $adminTimeZone = $admin->time_zone;
        Severity: Minor
        Found in modules/com_vtiger_workflow/Workflow.php - About 1 hr to fix

        Cognitive Complexity

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

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

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

        Further reading

        Method getNextTriggerTimeForWeekly has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getNextTriggerTimeForWeekly($scheduledDaysOfWeek, $scheduledTime)
            {
                $weekDays = ['1' => 'Monday', '2' => 'Tuesday', '3' => 'Wednesday', '4' => 'Thursday', '5' => 'Friday', '6' => 'Saturday', '7' => 'Sunday'];
                $currentTime = time();
                $currentWeekDay = date('N', $currentTime);
        Severity: Minor
        Found in modules/com_vtiger_workflow/Workflow.php - About 1 hr to fix

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

              public function getNextTriggerTimeForMonthlyByDate($scheduledDayOfMonth, $scheduledTime)
              {
                  $currentDayOfMonth = date('j', time());
                  if ($scheduledDayOfMonth) {
                      $scheduledDaysOfMonth = \App\Json::decode($scheduledDayOfMonth);
          Severity: Minor
          Found in modules/com_vtiger_workflow/Workflow.php - About 1 hr to fix

            Method getNextTriggerTimeForAnnualDates has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getNextTriggerTimeForAnnualDates($annualDates, $scheduledTime)
                {
                    if ($annualDates) {
                        $today = date('Y-m-d');
                        $annualDates = \App\Json::decode($annualDates);
            Severity: Minor
            Found in modules/com_vtiger_workflow/Workflow.php - About 1 hr to fix

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

                  public function getNextTriggerTime()
                  {
                      $default_timezone = \App\Config::main('default_timezone');
                      $admin = Users::getActiveAdminUser();
                      $adminTimeZone = $admin->time_zone;

              CyclomaticComplexity

              Since: 0.1

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

              Example

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

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

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

                  public function getNextTriggerTimeForWeekly($scheduledDaysOfWeek, $scheduledTime)
                  {
                      $weekDays = ['1' => 'Monday', '2' => 'Tuesday', '3' => 'Wednesday', '4' => 'Thursday', '5' => 'Friday', '6' => 'Saturday', '7' => 'Sunday'];
                      $currentTime = time();
                      $currentWeekDay = date('N', $currentTime);

              CyclomaticComplexity

              Since: 0.1

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

              Example

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

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

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

                  public function performTasks(Vtiger_Record_Model $recordModel, ?array $tasks = null)

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

              See

              Class "Workflow" has 21 methods, which is greater than 20 authorized. Split it into smaller classes.
              Open

              class Workflow

              A class that grows too much tends to aggregate too many responsibilities and inevitably becomes harder to understand and therefore to maintain. Above a specific threshold, it is strongly advised to refactor the class into smaller ones which focus on well defined topics.

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

                  public function getNextTriggerTimeForMonthlyByDate($scheduledDayOfMonth, $scheduledTime)

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

              See

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

                  public function getNextTriggerTimeForWeekly($scheduledDaysOfWeek, $scheduledTime)

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

              See

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

              class Workflow
              {
                  /**
                   * Scheduled hourly.
                   *

              CouplingBetweenObjects

              Since: 1.1.0

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

              Example

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

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

              Missing class import via use statement (line '186', column '30').
              Open

                      $queryWorkflowTasks = (new \App\Db\Query())->from('com_vtiger_workflowtasks')

              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 '218', column '13').
              Open

                      $tm = new VTTaskManager();

              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 '219', column '20').
              Open

                      $taskQueue = new VTTaskQueue();

              MissingImport

              Since: 2.7.0

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

              Example

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

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

              Missing class import via use statement (line '133', column '34').
              Open

                      $this->conditionStrategy = new VTJsonCondition();

              MissingImport

              Since: 2.7.0

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

              Example

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

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

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

                      return (new DateTimeField($this->schtime))->getDisplayTime();

              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 '185', column '33').
              Open

                      $isExistsActivateDonce = (new \App\Db\Query())->from('com_vtiger_workflow_activatedonce')->where(['entity_id' => $recordId, 'workflow_id' => $this->id])->exists();

              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 '389', column '29').
              Open

                                  $firstWorkingDay = new DateTime($nextTime);

              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 '393', column '30').
              Open

                                  $firstDayNextWeek = new DateTime('monday next week');

              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 '397', column '31').
              Open

                                  $firstDayNextMonth = new DateTime('first day of next month');

              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 performTasks uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
              Open

                              } else {
                                  $delay = 0;
                              }

              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 getNextTriggerTimeForMonthlyByWeekDay uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
              Open

                      } else {
                          $monthInFullText = date('F', $currentTime);
                          $yearFullNumberic = date('Y', $currentTime);
                          if ($scheduledWeekDayOfMonth < $currentDayOfMonth) {
                              $nextMonth = date('Y-m-d H:i:s', strtotime('first day of next month'));

              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 'getNextTriggerTime'.
              Open

                                  $nextTime = \App\Fields\Date::getWorkingDayFromDate($firstWorkingDay, '+0 day') . ' ' . $this->getWFScheduleTime();

              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 getNextTriggerTimeForDaily uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
              Open

                      } else {
                          $nextTime = date('Y-m-d H:i:s', $todayScheduledTime);
                      }

              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\Json' in method 'getNextTriggerTimeForAnnualDates'.
              Open

                          $annualDates = \App\Json::decode($annualDates);

              StaticAccess

              Since: 1.4.0

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

              Example

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

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

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

                      $default_timezone = \App\Config::main('default_timezone');

              StaticAccess

              Since: 1.4.0

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

              Example

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

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

              Avoid using static access to class '\App\Fields\Date' in method 'getNextTriggerTime'.
              Open

                                  $nextTime = \App\Fields\Date::getWorkingDayFromDate($firstDayNextMonth, '+0 day') . ' ' . $this->getWFScheduleTime();

              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 getNextTriggerTimeForAnnualDates uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
              Open

                          } else {
                              $nextTriggerDay = $annualDates[0];
                              $nextTime = date('Y:m:d H:i:s', strtotime($nextTriggerDay . ' ' . $scheduledTime . '+1 year'));
                          }

              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\Json' in method 'getNextTriggerTimeForMonthlyByDate'.
              Open

                          $scheduledDaysOfMonth = \App\Json::decode($scheduledDayOfMonth);

              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 'Users' in method 'getNextTriggerTime'.
              Open

                      $admin = Users::getActiveAdminUser();

              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 getNextTriggerTimeForMonthlyByDate uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
              Open

                              } else {
                                  $firstDayofNextMonth = date('Y:m:d H:i:s', strtotime('first day of next month'));
                                  $nextTime = date('Y:m:d', strtotime($firstDayofNextMonth . ' + ' . ($scheduledDaysOfMonth[0] - 1) . ' days'));
                                  $nextTime = $nextTime . ' ' . $scheduledTime;
                              }

              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 performTasks uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
              Open

                              } else {
                                  $hasContents = $task->hasContents($recordModel);
                                  if ($hasContents) {
                                      $taskQueue->queueTask($task->id, $recordModel->getId(), $delay, $task->getContents($recordModel));
                                  }

              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 getNextTriggerTimeForWeekly uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
              Open

                                  } else {
                                      $nextTime = date('Y-m-d H:i:s', strtotime($weekDays[$scheduledDaysOfWeek[0]] . ' ' . $scheduledTime));
                                  }

              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 getNextTriggerTimeForWeekly uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
              Open

                                          } else {
                                              $nextWeekDay = $scheduledDaysOfWeek[$index + 1]; // its the last day of the week i.e. sunday
                                              if (empty($nextWeekDay)) {
                                                  $nextWeekDay = $scheduledDaysOfWeek[0];
                                              }

              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\Json' in method 'getNextTriggerTimeForWeekly'.
              Open

                          $scheduledDaysOfWeek = \App\Json::decode($scheduledDaysOfWeek);

              StaticAccess

              Since: 1.4.0

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

              Example

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

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

              Avoid using static access to class '\App\Fields\Date' in method 'getNextTriggerTime'.
              Open

                                  $nextTime = \App\Fields\Date::getWorkingDayFromDate($firstDayNextWeek, '+0 day') . ' ' . $this->getWFScheduleTime();

              StaticAccess

              Since: 1.4.0

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

              Example

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

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

              Define a constant instead of duplicating this literal "Y:m:d H:i:s" 4 times.
              Open

                                  $firstDayofNextMonth = date('Y:m:d H:i:s', strtotime('first day of this month'));

              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.

              Add a "case default" clause to this "switch" statement.
              Open

                      switch ($this->getWFScheduleType()) {

              The requirement for a final case default clause is defensive programming. The clause should either take appropriate action, or contain a suitable comment as to why no action is taken. Even when the switch covers all current values of an enum, a default case should still be used because there is no guarantee that the enum won't be extended.

              Noncompliant Code Example

              switch ($param) {  //missing default clause
                case 0:
                  do_something();
                  break;
                case 1:
                  do_something_else();
                  break;
              }
              
              switch ($param) {
                default: // default clause should be the last one
                  error();
                  break;
                case 0:
                  do_something();
                  break;
                case 1:
                  do_something_else();
                  break;
              }
              

              Compliant Solution

              switch ($param) {
                case 0:
                  do_something();
                  break;
                case 1:
                  do_something_else();
                  break;
                default:
                  error();
                  break;
              }
              

              See

              • MISRA C:2004, 15.0 - The MISRA C switch syntax shall be used.
              • MISRA C:2004, 15.3 - The final clause of a switch statement shall be the default clause
              • MISRA C++:2008, 6-4-3 - A switch statement shall be a well-formed switch statement.
              • MISRA C++:2008, 6-4-6 - The final clause of a switch statement shall be the default-clause
              • MISRA C:2012, 16.1 - All switch statements shall be well-formed
              • MISRA C:2012, 16.4 - Every switch statement shall have a default label
              • MISRA C:2012, 16.5 - A default label shall appear as either the first or the last switch label of a switch statement
              • MITRE, CWE-478 - Missing Default Case in Switch Statement
              • CERT, MSC01-C. - Strive for logical completeness
              • CERT, MSC01-CPP. - Strive for logical completeness

              Define a constant instead of duplicating this literal "+0 day" 3 times.
              Open

                                  $nextTime = \App\Fields\Date::getWorkingDayFromDate($firstWorkingDay, '+0 day') . ' ' . $this->getWFScheduleTime();

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

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

              Noncompliant Code Example

              With the default threshold of 3:

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

              Compliant Solution

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

              Exceptions

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

              Define a constant instead of duplicating this literal "Y-m-d H:i:s" 14 times.
              Open

                              $nextTime = date('Y-m-d H:i:s', strtotime('+5 minutes'));

              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 "workflow_id" 5 times.
              Open

                      $this->id = $row['workflow_id'] ?? '';

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

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

              Noncompliant Code Example

              With the default threshold of 3:

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

              Compliant Solution

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

              Exceptions

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

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

                                      $scheduleWeekDayInTime = strtotime(date('Y-m-d', strtotime($weekDays[$currentWeekDay])) . ' ' . $scheduledTime);

              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 "first day of next month" 3 times.
              Open

                                  $firstDayNextMonth = new DateTime('first day of next month');

              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 "entity_id" 3 times.
              Open

                      $isExistsActivateDonce = (new \App\Db\Query())->from('com_vtiger_workflow_activatedonce')->where(['entity_id' => $recordId, 'workflow_id' => $this->id])->exists();

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

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

              Noncompliant Code Example

              With the default threshold of 3:

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

              Compliant Solution

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

              Exceptions

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

              Reference to undeclared property \Workflow->test
              Open

                      $this->test = $row['test'] ?? '';

              Reference to undeclared property \Workflow->filtersavedinnew
              Open

                      $this->filtersavedinnew = $row['filtersavedinnew'] ?? '';

              Reference to undeclared property \Workflow->nexttrigger_time
              Open

                      $this->nexttrigger_time = $row['nexttrigger_time'] ?? '';

              Argument 1 (annualDates) is bool but \Workflow::getNextTriggerTimeForAnnualDates() takes \json defined at /code/modules/com_vtiger_workflow/Workflow.php:568
              Open

                                  $nextTime = $this->getNextTriggerTimeForAnnualDates($this->getWFScheduleAnnualDates(), $this->getWFScheduleTime());

              Parameter $scheduledTime has undeclared type \time
              Open

                  public function getNextTriggerTimeForWeekly($scheduledDaysOfWeek, $scheduledTime)

              Suspicious type \timestamp of a variable or expression used to build a string. (Expected type to be able to cast to a string)
              Open

                              $nextTime = date('Y:m:d H:i:s', strtotime($nextTriggerDay . ' ' . $scheduledTime . '+1 year'));

              Reference to undeclared property \Workflow->executionCondition
              Open

                      $this->executionCondition = $row['execution_condition'] ?? '';

              Reference to undeclared property \Workflow->schdayofweek
              Open

                      $this->schdayofweek = $row['schdayofweek'] ?? '';

              Return type of getNextTriggerTimeForWeekly() is undeclared type \time
              Open

                  public function getNextTriggerTimeForWeekly($scheduledDaysOfWeek, $scheduledTime)

              Assigning array{10:'LBL_5_MINUTES',9:'LBL_15_MINUTES',8:'LBL_30_MINUTES',1:'LBL_HOURLY',2:'LBL_DAILY',3:'LBL_WEEKLY',4:'LBL_SPECIFIC_DATE',5:'LBL_MONTHLY_BY_DATE',6:'LBL_MONTHLY_BY_WEEKDAY',7:'LBL_YEARLY',11:'LBL_WORKINGDAY_DAY',12:'LBL_WORKINGDAY_WEEK',13:'LBL_WORKINGDAY_MONTH'} to property but \Workflow::$SCHEDULED_LIST is int[]
              Open

                  public static $SCHEDULED_LIST = [

              Reference to undeclared property \Workflow->description
              Open

                      $this->description = $row['summary'] ?? '';

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

                          \App\Db::getInstance()->createCommand()->update('com_vtiger_workflows', ['nexttrigger_time' => $time], ['workflow_id' => $this->id])->execute();
              Severity: Critical
              Found in modules/com_vtiger_workflow/Workflow.php by phan

              Reference to undeclared property \Workflow->id
              Open

                          \App\Db::getInstance()->createCommand()->update('com_vtiger_workflows', ['nexttrigger_time' => $time], ['workflow_id' => $this->id])->execute();

              Argument 1 (time) is \time but \DateTime::__construct() takes ?string
              Open

                                  $firstWorkingDay = new DateTime($nextTime);

              Suspicious type \time of a variable or expression used to build a string. (Expected type to be able to cast to a string)
              Open

                                      $nextTime = date('Y-m-d H:i:s', strtotime($weekDays[$nextTriggerWeekDay] . ' ' . $scheduledTime));

              Reference to undeclared property \Workflow->id
              Open

                      foreach ($tm->getTasksForWorkflow($this->id) as $task) {

              Parameter $time has undeclared type \timestamp
              Open

                  public function setNextTriggerTime($time)

              Reference to undeclared property \Workflow->schtime
              Open

                      return $this->schtime;

              Suspicious type \timestamp of a variable or expression used to build a string. (Expected type to be able to cast to a string)
              Open

                          $nextTime = date('Y-m-d H:i:s', strtotime('+1 month ' . $scheduledTime));

              Reference to undeclared property \Workflow->schtypeid
              Open

                      $this->schtypeid = $row['schtypeid'] ?? '';

              Reference to undeclared property \Workflow->schtypeid
              Open

                      return 6 == $this->executionCondition ? $this->schtypeid : 0;

              Argument 1 (encodedValue) is \json but \App\Json::decode() takes string defined at /code/app/Json.php:37
              Open

                          $scheduledDaysOfWeek = \App\Json::decode($scheduledDaysOfWeek);

              Suspicious type \time of a variable or expression used to build a string. (Expected type to be able to cast to a string)
              Open

                                              $nextTime = date('Y-m-d', strtotime('next ' . $weekDays[$weekDay])) . ' ' . $scheduledTime;

              Returning type null|string but getNextTriggerTimeForWeekly() is declared to return \time
              Open

                      return $nextTime;

              Parameter $scheduledTime has undeclared type \timestamp
              Open

                  public function getNextTriggerTimeForAnnualDates($annualDates, $scheduledTime)

              Return type of getNextTriggerTimeForAnnualDates() is undeclared type \time
              Open

                  public function getNextTriggerTimeForAnnualDates($annualDates, $scheduledTime)

              Reference to undeclared property \Workflow->id
              Open

                      $isExistsActivateDonce = (new \App\Db\Query())->from('com_vtiger_workflow_activatedonce')->where(['entity_id' => $recordId, 'workflow_id' => $this->id])->exists();

              Argument 2 (scheduledTime) is \timestamp but \Workflow::getNextTriggerTimeForMonthlyByDate() takes int defined at /code/modules/com_vtiger_workflow/Workflow.php:492
              Open

                                  $nextTime = $this->getNextTriggerTimeForMonthlyByDate($this->getWFScheduleDay(), $this->getWFScheduleTime());

              Suspicious type \timestamp of a variable or expression used to build a string. (Expected type to be able to cast to a string)
              Open

                                  $nextTime = \App\Fields\Date::getWorkingDayFromDate($firstWorkingDay, '+0 day') . ' ' . $this->getWFScheduleTime();

              Suspicious type \timestamp of a variable or expression used to build a string. (Expected type to be able to cast to a string)
              Open

                                  $nextTime = \App\Fields\Date::getWorkingDayFromDate($firstDayNextMonth, '+0 day') . ' ' . $this->getWFScheduleTime();

              Argument 1 (encodedValue) is \json but \App\Json::decode() takes string defined at /code/app/Json.php:37
              Open

                          $annualDates = \App\Json::decode($annualDates);

              Return type of getWFScheduleTime() is undeclared type \timestamp
              Open

                  public function getWFScheduleTime()

              Return type of getNextTriggerTime() is undeclared type \timestamp
              Open

                  public function getNextTriggerTime()

              Reference to undeclared property \Workflow->conditionStrategy
              Open

                      $this->conditionStrategy = new VTJsonCondition();

              Reference to undeclared property \Workflow->defaultworkflow
              Open

                          $this->defaultworkflow = $row['defaultworkflow'];

              Reference to undeclared property \Workflow->test
              Open

                      return $this->conditionStrategy->evaluate($this->test, $recordModel);

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

                      $queryWorkflowTasks = (new \App\Db\Query())->from('com_vtiger_workflowtasks')
              Severity: Critical
              Found in modules/com_vtiger_workflow/Workflow.php by phan

              Returning type ?\time|?string but getNextTriggerTime() is declared to return \timestamp
              Open

                      return $nextTime;

              Reference to undeclared property \Workflow->schdayofweek
              Open

                      return $this->schdayofweek;

              Returning type null|string but getNextTriggerTimeForAnnualDates() is declared to return \time
              Open

                      return $nextTime;

              Reference to undeclared property \Workflow->moduleName
              Open

                      $this->moduleName = $row['module_name'] ?? '';

              Reference to undeclared property \Workflow->executionCondition
              Open

                          return $arr[$this->executionCondition - 1];

              Return type of getNextTriggerTimeValue() is undeclared type \timestamp
              Open

                  public function getNextTriggerTimeValue()

              Reference to undeclared property \Users->time_zone
              Open

                      $adminTimeZone = $admin->time_zone;

              Suspicious type \time of a variable or expression used to build a string. (Expected type to be able to cast to a string)
              Open

                                      $nextTime = date('Y-m-d H:i:s', strtotime($weekDays[$scheduledDaysOfWeek[0]] . ' ' . $scheduledTime));

              Returning type string but getNextTriggerTimeForMonthlyByWeekDay() is declared to return \time
              Open

                      return $nextTime;

              Reference to undeclared property \Workflow->schdayofmonth
              Open

                      $this->schdayofmonth = $row['schdayofmonth'] ?? '';

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

                      \App\Db::getInstance()->createCommand()
              Severity: Critical
              Found in modules/com_vtiger_workflow/Workflow.php by phan

              Reference to undeclared property \Workflow->schtime
              Open

                      return (new DateTimeField($this->schtime))->getDisplayTime();

              Saw an @param annotation for schTime, but it was not found in the param list of function getNextTriggerTimeForDaily(mixed $scheduledTime) : \time
              Open

                   * @param type  $schTime

              Parameter $scheduledDaysOfWeek has undeclared type \json
              Open

                  public function getNextTriggerTimeForWeekly($scheduledDaysOfWeek, $scheduledTime)

              Suspicious type \time of a variable or expression used to build a string. (Expected type to be able to cast to a string)
              Open

                                      $scheduleWeekDayInTime = strtotime(date('Y-m-d', strtotime($weekDays[$currentWeekDay])) . ' ' . $scheduledTime);

              Reference to undeclared property \Workflow->id
              Open

                      $this->id = $row['workflow_id'] ?? '';

              Reference to undeclared property \Workflow->test
              Open

                      if ('' == $this->test) {

              Reference to undeclared property \Workflow->conditionStrategy
              Open

                      return $this->conditionStrategy->evaluate($this->test, $recordModel);

              Reference to undeclared property \Workflow->executionCondition
              Open

                      $this->executionCondition = $arr[$label];

              Reference to undeclared property \Workflow->nexttrigger_time
              Open

                          $this->nexttrigger_time = $time;

              Reference to undeclared property \Workflow->executionCondition
              Open

                      return 6 == $this->executionCondition ? $this->schtypeid : 0;

              Return type of getNextTriggerTimeForDaily() is undeclared type \time
              Open

                  public function getNextTriggerTimeForDaily($scheduledTime)

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

                      $isExistsActivateDonce = (new \App\Db\Query())->from('com_vtiger_workflow_activatedonce')->where(['entity_id' => $recordId, 'workflow_id' => $this->id])->exists();
              Severity: Critical
              Found in modules/com_vtiger_workflow/Workflow.php by phan

              Reference to undeclared property \Workflow->nexttrigger_time
              Open

                      return $this->nexttrigger_time;

              Return type of getNextTriggerTimeForMonthlyByDate() is undeclared type \time
              Open

                  public function getNextTriggerTimeForMonthlyByDate($scheduledDayOfMonth, $scheduledTime)

              Parameter $annualDates has undeclared type \json
              Open

                  public function getNextTriggerTimeForAnnualDates($annualDates, $scheduledTime)

              Suspicious type \timestamp of a variable or expression used to build a string. (Expected type to be able to cast to a string)
              Open

                                  $schTime = strtotime($day . ' ' . $scheduledTime);

              Suspicious type \timestamp of a variable or expression used to build a string. (Expected type to be able to cast to a string)
              Open

                              $nextTime = date('Y:m:d H:i:s', strtotime($nextTriggerDay . ' ' . $scheduledTime));

              Reference to undeclared property \Workflow->schannualdates
              Open

                      $this->schannualdates = $row['schannualdates'] ?? '';

              Reference to undeclared property \Workflow->id
              Open

                          ->where(['entity_id' => $recordId, 'workflow_id' => $this->id]);

              Argument 1 (scheduledDaysOfWeek) is int but \Workflow::getNextTriggerTimeForWeekly() takes \json defined at /code/modules/com_vtiger_workflow/Workflow.php:433
              Open

                                  $nextTime = $this->getNextTriggerTimeForWeekly($this->getWFScheduleWeek(), $this->getWFScheduleTime());

              Argument 2 (scheduledTime) is \timestamp but \Workflow::getNextTriggerTimeForWeekly() takes \time defined at /code/modules/com_vtiger_workflow/Workflow.php:433
              Open

                                  $nextTime = $this->getNextTriggerTimeForWeekly($this->getWFScheduleWeek(), $this->getWFScheduleTime());

              Returning type string but getNextTriggerTimeForDaily() is declared to return \time
              Open

                      return $nextTime;

              Suspicious type \timestamp of a variable or expression used to build a string. (Expected type to be able to cast to a string)
              Open

                          $nextTime = date('Y-m-d H:i:s', strtotime($scheduledWeekDayOfMonth . ' ' . $monthInFullText . ' ' . $yearFullNumberic . ' ' . $scheduledTime));

              Reference to undeclared property \Workflow->schtime
              Open

                      $this->schtime = $row['schtime'] ?? '';

              Reference to undeclared property \Workflow->params
              Open

                      $this->params = $row['params'] ?? '';

              Reference to undeclared property \Workflow->id
              Open

                              'workflow_id' => $this->id,

              Reference to undeclared property \Workflow->schdayofmonth
              Open

                      return $this->schdayofmonth;

              Reference to undeclared property \Workflow->schannualdates
              Open

                      return $this->schannualdates;

              Suspicious type \timestamp of a variable or expression used to build a string. (Expected type to be able to cast to a string)
              Open

                                  $nextTime = \App\Fields\Date::getWorkingDayFromDate($firstDayNextWeek, '+0 day') . ' ' . $this->getWFScheduleTime();

              Suspicious type \time of a variable or expression used to build a string. (Expected type to be able to cast to a string)
              Open

                                              $nextTime = date('Y-m-d', strtotime('next ' . $weekDays[$nextWeekDay])) . ' ' . $scheduledTime;

              Parameter $scheduledTime has undeclared type \timestamp
              Open

                  public function getNextTriggerTimeForMonthlyByWeekDay($scheduledWeekDayOfMonth, $scheduledTime)

              When fetching an array index from a value of type array{1:'Monday',2:'Tuesday',3:'Wednesday',4:'Thursday',5:'Friday',6:'Saturday',7:'Sunday'}, found an array index of type string, but expected the index to be of type int
              Open

                                      $scheduleWeekDayInTime = strtotime(date('Y-m-d', strtotime($weekDays[$currentWeekDay])) . ' ' . $scheduledTime);

              Argument 1 (encodedValue) is int but \App\Json::decode() takes string defined at /code/app/Json.php:37
              Open

                          $scheduledDaysOfMonth = \App\Json::decode($scheduledDayOfMonth);

              Returning type null|string but getNextTriggerTimeForMonthlyByDate() is declared to return \time
              Open

                      return $nextTime;

              Return type of getNextTriggerTimeForMonthlyByWeekDay() is undeclared type \time
              Open

                  public function getNextTriggerTimeForMonthlyByWeekDay($scheduledWeekDayOfMonth, $scheduledTime)

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

                  public static $SCHEDULED_MONTHLY_BY_DATE = 5;

              LongVariable

              Since: 0.2

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

              Example

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

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

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

                      $isExistsActivateDonce = (new \App\Db\Query())->from('com_vtiger_workflow_activatedonce')->where(['entity_id' => $recordId, 'workflow_id' => $this->id])->exists();

              LongVariable

              Since: 0.2

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

              Example

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

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

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

                  public static $SCHEDULED_WORKINGDAY_DAY = 11;

              LongVariable

              Since: 0.2

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

              Example

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

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

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

                  public static $SCHEDULED_WORKINGDAY_WEEK = 12;

              LongVariable

              Since: 0.2

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

              Example

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

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

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

                  public static $SCHEDULED_WORKINGDAY_MONTH = 13;

              LongVariable

              Since: 0.2

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

              Example

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

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

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

                  public static $SCHEDULED_ON_SPECIFIC_DATE = 4;

              LongVariable

              Since: 0.2

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

              Example

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

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

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

                  public static $SCHEDULED_MONTHLY_BY_WEEKDAY = 6;

              LongVariable

              Since: 0.2

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

              Example

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

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

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

                                      $scheduleWeekDayInTime = strtotime(date('Y-m-d', strtotime($weekDays[$currentWeekDay])) . ' ' . $scheduledTime);

              LongVariable

              Since: 0.2

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

              Example

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

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

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

                  public function getNextTriggerTimeForMonthlyByWeekDay($scheduledWeekDayOfMonth, $scheduledTime)

              LongVariable

              Since: 0.2

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

              Example

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

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

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

              class Workflow

              The property $SCHEDULED_WEEKLY is not named in camelCase.
              Open

              class Workflow
              {
                  /**
                   * Scheduled hourly.
                   *

              CamelCasePropertyName

              Since: 0.2

              It is considered best practice to use the camelCase notation to name attributes.

              Example

              class ClassName {
                  protected $property_name;
              }

              Source

              The property $SCHEDULED_MONTHLY_BY_WEEKDAY is not named in camelCase.
              Open

              class Workflow
              {
                  /**
                   * Scheduled hourly.
                   *

              CamelCasePropertyName

              Since: 0.2

              It is considered best practice to use the camelCase notation to name attributes.

              Example

              class ClassName {
                  protected $property_name;
              }

              Source

              The property $SCHEDULED_ANNUALLY is not named in camelCase.
              Open

              class Workflow
              {
                  /**
                   * Scheduled hourly.
                   *

              CamelCasePropertyName

              Since: 0.2

              It is considered best practice to use the camelCase notation to name attributes.

              Example

              class ClassName {
                  protected $property_name;
              }

              Source

              The property $SCHEDULED_HOURLY is not named in camelCase.
              Open

              class Workflow
              {
                  /**
                   * Scheduled hourly.
                   *

              CamelCasePropertyName

              Since: 0.2

              It is considered best practice to use the camelCase notation to name attributes.

              Example

              class ClassName {
                  protected $property_name;
              }

              Source

              The property $SCHEDULED_15_MINUTES is not named in camelCase.
              Open

              class Workflow
              {
                  /**
                   * Scheduled hourly.
                   *

              CamelCasePropertyName

              Since: 0.2

              It is considered best practice to use the camelCase notation to name attributes.

              Example

              class ClassName {
                  protected $property_name;
              }

              Source

              The property $SCHEDULED_WORKINGDAY_DAY is not named in camelCase.
              Open

              class Workflow
              {
                  /**
                   * Scheduled hourly.
                   *

              CamelCasePropertyName

              Since: 0.2

              It is considered best practice to use the camelCase notation to name attributes.

              Example

              class ClassName {
                  protected $property_name;
              }

              Source

              The property $SCHEDULED_WORKINGDAY_MONTH is not named in camelCase.
              Open

              class Workflow
              {
                  /**
                   * Scheduled hourly.
                   *

              CamelCasePropertyName

              Since: 0.2

              It is considered best practice to use the camelCase notation to name attributes.

              Example

              class ClassName {
                  protected $property_name;
              }

              Source

              The property $SCHEDULED_MONTHLY_BY_DATE is not named in camelCase.
              Open

              class Workflow
              {
                  /**
                   * Scheduled hourly.
                   *

              CamelCasePropertyName

              Since: 0.2

              It is considered best practice to use the camelCase notation to name attributes.

              Example

              class ClassName {
                  protected $property_name;
              }

              Source

              The property $SCHEDULED_WORKINGDAY_WEEK is not named in camelCase.
              Open

              class Workflow
              {
                  /**
                   * Scheduled hourly.
                   *

              CamelCasePropertyName

              Since: 0.2

              It is considered best practice to use the camelCase notation to name attributes.

              Example

              class ClassName {
                  protected $property_name;
              }

              Source

              The property $SCHEDULED_ON_SPECIFIC_DATE is not named in camelCase.
              Open

              class Workflow
              {
                  /**
                   * Scheduled hourly.
                   *

              CamelCasePropertyName

              Since: 0.2

              It is considered best practice to use the camelCase notation to name attributes.

              Example

              class ClassName {
                  protected $property_name;
              }

              Source

              The property $SCHEDULED_LIST is not named in camelCase.
              Open

              class Workflow
              {
                  /**
                   * Scheduled hourly.
                   *

              CamelCasePropertyName

              Since: 0.2

              It is considered best practice to use the camelCase notation to name attributes.

              Example

              class ClassName {
                  protected $property_name;
              }

              Source

              The property $SCHEDULED_30_MINUTES is not named in camelCase.
              Open

              class Workflow
              {
                  /**
                   * Scheduled hourly.
                   *

              CamelCasePropertyName

              Since: 0.2

              It is considered best practice to use the camelCase notation to name attributes.

              Example

              class ClassName {
                  protected $property_name;
              }

              Source

              The property $SCHEDULED_5_MINUTES is not named in camelCase.
              Open

              class Workflow
              {
                  /**
                   * Scheduled hourly.
                   *

              CamelCasePropertyName

              Since: 0.2

              It is considered best practice to use the camelCase notation to name attributes.

              Example

              class ClassName {
                  protected $property_name;
              }

              Source

              The property $SCHEDULED_DAILY is not named in camelCase.
              Open

              class Workflow
              {
                  /**
                   * Scheduled hourly.
                   *

              CamelCasePropertyName

              Since: 0.2

              It is considered best practice to use the camelCase notation to name attributes.

              Example

              class ClassName {
                  protected $property_name;
              }

              Source

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

                      $tm = new VTTaskManager();

              ShortVariable

              Since: 0.2

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

              Example

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

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

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

                          break;

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

                          break;

              The 'getWFScheduleAnnualDates()' method which returns a boolean should be named 'is...()' or 'has...()'
              Open

                  public function getWFScheduleAnnualDates()
                  {
                      return $this->schannualdates;
                  }

              BooleanGetMethodName

              Since: 0.2

              Looks for methods named 'getX()' with 'boolean' as the return type. The convention is to name these methods 'isX()' or 'hasX()'.

              Example

              class Foo {
                  /**
                   * @return boolean
                   */
                  public function getFoo() {} // bad
                  /**
                   * @return bool
                   */
                  public function isFoo(); // ok
                  /**
                   * @return boolean
                   */
                  public function getFoo($bar); // ok, unless checkParameterizedMethods=true
              }

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

              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

                   * Scheduled annually.

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

                   * Scheduled weekly.

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

                   */

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

                   * Scheduled on specific date.

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

                   * @var int

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

                   * @var int

              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 $SCHEDULED_30_MINUTES = 8;

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

                  public static $SCHEDULED_WORKINGDAY_DAY = 11;

              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

                  /**

              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 $SCHEDULED_WEEKLY = 3;

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

                  /**

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

                   * Scheduled monthly by weekday.

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

                   * Scheduled first working day in week.

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

                   *

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

                   * Scheduled first working day in 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

                   * Scheduled hourly.

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

                   */

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

                   * @var int

              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 $SCHEDULED_ON_SPECIFIC_DATE = 4;

              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

                   * Scheduled closest working day.

              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 $SCHEDULED_DAILY = 2;

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

                   * @var int

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

                  /**

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

                   * @var int

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

                  /**

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

                   * Scheduled list.

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

                   * Scheduled hourly.

              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 $SCHEDULED_MONTHLY_BY_DATE = 5;

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

                   * Scheduled hourly.

              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 $SCHEDULED_15_MINUTES = 9;

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

                   * @var int

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

                  /**

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

                   * @var int

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

                   *

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

                  public static $SCHEDULED_WORKINGDAY_WEEK = 12;

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

                  public static $SCHEDULED_WORKINGDAY_MONTH = 13;

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

                   *

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

                   * Scheduled monthly by date.

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

                   *

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

                   */

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

                  public static $SCHEDULED_ANNUALLY = 7;

              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

                   * Scheduled daily.

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

                   *

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

                   * @var int

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

                  /**

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

                   * @var int

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

                  /**

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

                   * Scheduled hourly.

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

                   * @var int

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

                  public static $SCHEDULED_HOURLY = 1;

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

                   * @var int

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

                  /**

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

                   * @var int

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

                   *

              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 $SCHEDULED_MONTHLY_BY_WEEKDAY = 6;

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

                  /**

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

                   *

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

                   * @var int

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

                  public static $SCHEDULED_5_MINUTES = 10;

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

                   *

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

                      11 => 'LBL_WORKINGDAY_DAY',

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

                      13 => 'LBL_WORKINGDAY_MONTH',

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

                   * Constructor.

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

                      $this->schtime = $row['schtime'] ?? '';

              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 !(!$isExistsActivateDonce && !$queryWorkflowTasks->exists());

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

                   *

              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

                          return $arr[$this->executionCondition - 1];

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

                   *

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

                  public static $SCHEDULED_LIST = [

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

                      $this->params = $row['params'] ?? '';

              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

                   * Setup workflow.

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

                      if (isset($row['defaultworkflow'])) {

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

                  public function isCompletedForRecord($recordId)

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

                          ])->execute();

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

                      }

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

                      $this->executionCondition = $arr[$label];

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

                      9 => 'LBL_15_MINUTES',

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

                      $this->conditionStrategy = new VTJsonCondition();

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

                      $this->schannualdates = $row['schannualdates'] ?? '';

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

                      $this->nexttrigger_time = $row['nexttrigger_time'] ?? '';

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

                   * @return bool

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

                  /**

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

                  public function performTasks(Vtiger_Record_Model $recordModel, ?array $tasks = null)

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

                      foreach ($tm->getTasksForWorkflow($this->id) as $task) {

              Line exceeds 120 characters; contains 122 characters
              Open

                                      $taskQueue->queueTask($task->id, $recordModel->getId(), $delay, $task->getContents($recordModel));

              Line exceeds 120 characters; contains 152 characters
              Open

                          $arr = ['ON_FIRST_SAVE', 'ONCE', 'ON_EVERY_SAVE', 'ON_MODIFY', 'ON_DELETE', 'ON_SCHEDULE', 'MANUAL', 'TRIGGER', 'BLOCK_EDIT', 'ON_RELATED'];

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

                  /**

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

                      $this->schtypeid = $row['schtypeid'] ?? '';

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

                      if ('' == $this->test) {

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

                      $isExistsActivateDonce = (new \App\Db\Query())->from('com_vtiger_workflow_activatedonce')->where(['entity_id' => $recordId, 'workflow_id' => $this->id])->exists();

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

                   */

              Line exceeds 120 characters; contains 122 characters
              Open

                          'ON_DELETE' => 5, 'ON_SCHEDULE' => 6, 'MANUAL' => 7, 'TRIGGER' => 8, 'BLOCK_EDIT' => 9, 'ON_RELATED' => 10, ];

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

                      $tm = new VTTaskManager();

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

                                  if ($hasContents) {

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

                          $arr = ['ON_FIRST_SAVE', 'ONCE', 'ON_EVERY_SAVE', 'ON_MODIFY', 'ON_DELETE', 'ON_SCHEDULE', 'MANUAL', 'TRIGGER', 'BLOCK_EDIT', 'ON_RELATED'];

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

                  public function __construct()

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

                  }

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

                      $this->id = $row['workflow_id'] ?? '';

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

                   * Evaluate.

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

                   */

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

                  public function markAsCompletedForRecord($recordId)

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

                              } else {

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

                                  }

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

                          }

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

                   * @return string

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

                  public function executionConditionAsLabel($label = null)

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

                   * @var int[]

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

                  ];

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

                  public function setup($row)

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

                      }

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

                  public function evaluate($recordModel)

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

                   * @return bool

              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

                              'entity_id' => $recordId,

              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

                      8 => 'LBL_30_MINUTES',

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

                      2 => 'LBL_DAILY',

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

                      12 => 'LBL_WORKINGDAY_WEEK',

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

                  /**

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

                      $this->test = $row['test'] ?? '';

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

                   * Check if workfow is completed for record.

              Line exceeds 120 characters; contains 131 characters
              Open

                          ->innerJoin('com_vtiger_workflowtask_queue', 'com_vtiger_workflowtasks.task_id= com_vtiger_workflowtask_queue.task_id')

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

                   *

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

                      $taskQueue = new VTTaskQueue();

              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 (null === $label) {

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

                   */

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

                      5 => 'LBL_MONTHLY_BY_DATE',

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

                      4 => 'LBL_SPECIFIC_DATE',

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

                   */

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

                  /**

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

                  {

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

                   *

              Line exceeds 120 characters; contains 171 characters
              Open

                      $isExistsActivateDonce = (new \App\Db\Query())->from('com_vtiger_workflow_activatedonce')->where(['entity_id' => $recordId, 'workflow_id' => $this->id])->exists();

              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 $recordId

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

                      \App\Db::getInstance()->createCommand()

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

                          ->where(['entity_id' => $recordId, 'workflow_id' => $this->id]);

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

                      require_once 'modules/com_vtiger_workflow/VTTaskQueue.php';

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

                                  $hasContents = $task->hasContents($recordModel);

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

                          ->insert('com_vtiger_workflow_activatedonce', [

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

                  }

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

                   * Execution condition as label.

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

                   * @param Vtiger_Record_Model $recordModel

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

                   * @param string $label

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

                   * @param timestamp $time

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

                          if ($task->active && (null === $tasks || \in_array($task->id, $tasks))) {

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

                                  $delay = 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

                      1 => 'LBL_HOURLY',

              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 array $row

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

                      $this->moduleName = $row['module_name'] ?? '';

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

                      $this->schdayofmonth = $row['schdayofmonth'] ?? '';

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

                      $this->schdayofweek = $row['schdayofweek'] ?? '';

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

                      return $this->conditionStrategy->evaluate($this->test, $recordModel);

              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 array|null          $tasks

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

                      require_once 'modules/com_vtiger_workflow/VTTaskManager.php';

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

                                      $taskQueue->queueTask($task->id, $recordModel->getId(), $delay, $task->getContents($recordModel));

              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

                      $arr = ['ON_FIRST_SAVE' => 1, 'ONCE' => 2, 'ON_EVERY_SAVE' => 3, 'ON_MODIFY' => 4,

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

                          'ON_DELETE' => 5, 'ON_SCHEDULE' => 6, 'MANUAL' => 7, 'TRIGGER' => 8, 'BLOCK_EDIT' => 9, 'ON_RELATED' => 10, ];

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

                  {

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

                      $this->description = $row['summary'] ?? '';

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

                          $this->defaultworkflow = $row['defaultworkflow'];

              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

                      $queryWorkflowTasks = (new \App\Db\Query())->from('com_vtiger_workflowtasks')

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

                          ->innerJoin('com_vtiger_workflowtask_queue', 'com_vtiger_workflowtasks.task_id= com_vtiger_workflowtask_queue.task_id')

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

                              if (true === (bool) $task->executeImmediately && 0 === $delay) {

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

                                  $task->doTask($recordModel);

              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

                   */

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

                      10 => 'LBL_5_MINUTES',

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

                      3 => 'LBL_WEEKLY',

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

                   */

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

                      6 => 'LBL_MONTHLY_BY_WEEKDAY',

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

                      $this->filtersavedinnew = $row['filtersavedinnew'] ?? '';

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

                  /**

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

                   * Perform tasks.

              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 (null !== $trigger) {

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

                  {

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

                                  $delay = strtotime($recordModel->get($trigger['field'])) + $trigger['days'] * 86400;

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

                      $this->executionCondition = $row['execution_condition'] ?? '';

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

                   * Sets next trigger time.

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

                   * @param Vtiger_Record_Model $recordModel

              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 true;

              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

                              'workflow_id' => $this->id,

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

                      7 => 'LBL_YEARLY',

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

                   * Mark workflow as completed for record.

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

                   * @param int $recordId

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

                              $trigger = $task->trigger;

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

                  }

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

                  public function setNextTriggerTime($time)

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

                      return $this->schtime;

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

                      return $this->schannualdates;

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

                   */

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

                      switch ($this->getWFScheduleType()) {

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

                          case self::$SCHEDULED_WEEKLY:

              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

                   *

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

                  /**

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

                      $admin = Users::getActiveAdminUser();

              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

                  }

              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 function getWFScheduleWeek()

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

                  {

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

                          case self::$SCHEDULED_WORKINGDAY_WEEK:

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

                          $this->nexttrigger_time = $time;

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

                      return $this->nexttrigger_time;

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

                   * @return int

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

                   * Return workflow schedule timestamp.

              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

                   * Return workflow schedule week.

              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 function getNextTriggerTime()

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

                          case self::$SCHEDULED_DAILY:

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

                                  $nextTime = date('Y-m-d H:i:s', strtotime('+10 year'));

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

                                  $nextTime = $this->getNextTriggerTimeForAnnualDates($this->getWFScheduleAnnualDates(), $this->getWFScheduleTime());

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

                   * @return timestamp

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

                      return $this->schdayofmonth;

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

                   * @return timestamp

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

                      $adminTimeZone = $admin->time_zone;

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

                      date_default_timezone_set($adminTimeZone);

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

                                  $nextTime = date('Y-m-d H:i:s', strtotime('+1 hour'));

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

                      }

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

                          \App\Db::getInstance()->createCommand()->update('com_vtiger_workflows', ['nexttrigger_time' => $time], ['workflow_id' => $this->id])->execute();

              Line exceeds 120 characters; contains 156 characters
              Open

                          \App\Db::getInstance()->createCommand()->update('com_vtiger_workflows', ['nexttrigger_time' => $time], ['workflow_id' => $this->id])->execute();

              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

                      $nextTime = null;

              Line exceeds 120 characters; contains 129 characters
              Open

                                  $nextTime = $this->getNextTriggerTimeForMonthlyByDate($this->getWFScheduleDay(), $this->getWFScheduleTime());

              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

                   * Return workflow schedule timestamp in user format.

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

                   * @return int

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

                  }

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

                              $nextTime = date('Y-m-d H:i:s', strtotime('+5 minutes'));

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

                          case self::$SCHEDULED_HOURLY:

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

                                  $nextTime = $this->getNextTriggerTimeForDaily($this->getWFScheduleTime());

              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;

              Line exceeds 120 characters; contains 136 characters
              Open

                                  $nextTime = \App\Fields\Date::getWorkingDayFromDate($firstDayNextWeek, '+0 day') . ' ' . $this->getWFScheduleTime();

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

                      date_default_timezone_set($default_timezone);

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

                  /**

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

                   * get next trigger time for daily.

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

                   * @param mixed $scheduledTime

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

                   */

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

                  public function getNextTriggerTimeForDaily($scheduledTime)

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

                   * Return next trigger timestamp.

              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 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

                  public function getWFScheduleAnnualDates()

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

                   * Function gets the next trigger for the workflows.

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

                          case self::$SCHEDULED_5_MINUTES:

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

                          case self::$SCHEDULED_MONTHLY_BY_WEEKDAY:

              Line exceeds 120 characters; contains 132 characters
              Open

                                  $nextTime = $this->getNextTriggerTimeForMonthlyByWeekDay($this->getWFScheduleDay(), $this->getWFScheduleTime());

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

                              break;

              Line exceeds 120 characters; contains 135 characters
              Open

                                  $nextTime = \App\Fields\Date::getWorkingDayFromDate($firstWorkingDay, '+0 day') . ' ' . $this->getWFScheduleTime();

              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 function getNextTriggerTimeValue()

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

                   */

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

                  public function getWFScheduleTimeUserFormat()

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

                   * @return int

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

                   *

              Line exceeds 120 characters; contains 123 characters
              Open

                                  $nextTime = $this->getNextTriggerTimeForWeekly($this->getWFScheduleWeek(), $this->getWFScheduleTime());

              Line exceeds 120 characters; contains 135 characters
              Open

                                  $nextTime = $this->getNextTriggerTimeForAnnualDates($this->getWFScheduleAnnualDates(), $this->getWFScheduleTime());

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

                                  $nextTime = \App\Fields\Date::getWorkingDayFromDate($firstDayNextWeek, '+0 day') . ' ' . $this->getWFScheduleTime();

              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

                  /**

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

                      return $this->schdayofweek;

              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

                          case self::$SCHEDULED_30_MINUTES:

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

                                  $nextTime = $this->getNextTriggerTimeForMonthlyByWeekDay($this->getWFScheduleDay(), $this->getWFScheduleTime());

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

                          case self::$SCHEDULED_ANNUALLY:

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

                                  $firstDayNextWeek = new DateTime('monday next week');

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

                      return $nextTime;

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

                      return (new DateTimeField($this->schtime))->getDisplayTime();

              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 self::$SCHEDULED_ON_SPECIFIC_DATE:

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

                          case self::$SCHEDULED_MONTHLY_BY_DATE:

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

                                  $nextTime = $this->getNextTriggerTimeForMonthlyByDate($this->getWFScheduleDay(), $this->getWFScheduleTime());

              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

                   * @return timestamp

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

                   * Return schedule type.

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

                      return 6 == $this->executionCondition ? $this->schtypeid : 0;

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

                   * @return bool

              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

                   * @global string $default_timezone

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

                          case self::$SCHEDULED_15_MINUTES:

              Line exceeds 120 characters; contains 137 characters
              Open

                                  $nextTime = \App\Fields\Date::getWorkingDayFromDate($firstDayNextMonth, '+0 day') . ' ' . $this->getWFScheduleTime();

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

                   * @return time

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

                      if ($time) {

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

                  {

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

                   * Return workflow schedule day.

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

                   *

              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 self::$SCHEDULED_WORKINGDAY_DAY:

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

                                  $firstDayNextMonth = new DateTime('first day of next 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

                   * Return workflow schedule annual dates.

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

                      $default_timezone = \App\Config::main('default_timezone');

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

                              $nextTime = date('Y-m-d H:i:s', strtotime('+30 minutes'));

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

                                  $firstWorkingDay = new DateTime($nextTime);

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

                                  $nextTime = \App\Fields\Date::getWorkingDayFromDate($firstDayNextMonth, '+0 day') . ' ' . $this->getWFScheduleTime();

              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

                                  $nextTime = date('Y-m-d H:i:s', strtotime('+15 minutes'));

              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

                                  $nextTime = $this->getNextTriggerTimeForWeekly($this->getWFScheduleWeek(), $this->getWFScheduleTime());

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

                          case self::$SCHEDULED_WORKINGDAY_MONTH:

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

                   * @param type  $schTime

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

                      $now = strtotime(date('Y-m-d H:i:s'));

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

                   * @param time $scheduledTime

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

                  public function getNextTriggerTimeForWeekly($scheduledDaysOfWeek, $scheduledTime)

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

                                          $nextTriggerWeekDay = $weekDay;

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

                                      $nextTime = date('Y-m-d H:i:s', strtotime($weekDays[$nextTriggerWeekDay] . ' ' . $scheduledTime));

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

                                      break;

              Line exceeds 120 characters; contains 121 characters
              Open

                                  $nextTime = date('Y:m:d', strtotime($firstDayofNextMonth . ' + ' . ($nextTriggerDay - 1) . ' days'));

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

                                  $firstDayofNextMonth = date('Y:m:d H:i:s', strtotime('first day of next 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

                      $currentTime = time();

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

                      $scheduledTime = $this->getWFScheduleTime();

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

                      return $nextTime;

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

                   *

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

                  public function getWFScheduleType()

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

                  public function getWFScheduleTime()

              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 function getWFScheduleDay()

              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

                                  $nextTime = $this->getNextTriggerTimeForDaily($this->getWFScheduleTime());

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

                                  $nextTime = \App\Fields\Date::getWorkingDayFromDate($firstWorkingDay, '+0 day') . ' ' . $this->getWFScheduleTime();

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

                   *

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

                                              $nextTime = date('Y-m-d', strtotime('next ' . $weekDays[$weekDay])) . ' ' . $scheduledTime;

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

                                          }

              Line exceeds 120 characters; contains 126 characters
              Open

                                      $nextTime = date('Y-m-d H:i:s', strtotime($weekDays[$scheduledDaysOfWeek[0]] . ' ' . $scheduledTime));

              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 (\is_array($scheduledDaysOfMonth)) {

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

                                  }

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

                                  $nextTime = date('Y:m:d', strtotime($firstDayofNextMonth . ' + ' . ($nextTriggerDay - 1) . ' days'));

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

                      if ($scheduledWeekDayOfMonth == $currentDayOfMonth) {

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

                                      if ($currentTime < $scheduleWeekDayInTime) { //if the scheduled time is greater than current time, selected today

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

                                              $nextTime = date('Y-m-d', strtotime('next ' . $weekDays[$nextWeekDay])) . ' ' . $scheduledTime;

              Line exceeds 120 characters; contains 127 characters
              Open

                                              $nextTime = date('Y-m-d', strtotime('next ' . $weekDays[$nextWeekDay])) . ' ' . $scheduledTime;

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

                                  } elseif ($weekDay > $currentWeekDay) {

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

                   *

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

                  public function getNextTriggerTimeForMonthlyByDate($scheduledDayOfMonth, $scheduledTime)

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

                                      $currentTime = time();

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

                                      if ($schTime > $currentTime) {

              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

                                  $nextTime = $nextTime . ' ' . $scheduledTime;

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

                          if ($scheduledWeekDayOfMonth < $currentDayOfMonth) {

              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 time

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

                              }

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

                   * @return time

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

                      $todayScheduledTime = strtotime(date('Y-m-d H:i:s', strtotime($scheduledTime)));

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

                   * get next trigger Time For weekly.

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

                      $currentWeekDay = date('N', $currentTime);

              Line exceeds 120 characters; contains 137 characters
              Open

                                      if ($currentTime < $scheduleWeekDayInTime) { //if the scheduled time is greater than current time, selected today

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

                                          break;

              Line exceeds 120 characters; contains 124 characters
              Open

                                              $nextWeekDay = $scheduledDaysOfWeek[$index + 1]; // its the last day of the week i.e. sunday

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

                                  }

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

                              sort($scheduledDaysOfMonth);

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

                                  if ($day == $currentDayOfMonth) {

              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

                                  $nextTime = date('Y:m:d', strtotime($firstDayofNextMonth . ' + ' . ($scheduledDaysOfMonth[0] - 1) . ' days'));

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

                          $nextTime = date('Y-m-d H:i:s', strtotime('+1 day ' . $scheduledTime));

              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

                                              $nextWeekDay = $scheduledDaysOfWeek[$index + 1]; // its the last day of the week i.e. sunday

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

                                                  $nextWeekDay = $scheduledDaysOfWeek[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

                   * get next triggertime for monthly.

              Line exceeds 120 characters; contains 130 characters
              Open

                                  $nextTime = date('Y:m:d', strtotime($firstDayofNextMonth . ' + ' . ($scheduledDaysOfMonth[0] - 1) . ' days'));

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

                          $nextTime = date('Y-m-d H:i:s', strtotime('+1 month ' . $scheduledTime));

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

                      return $nextTime;

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

                          $scheduledDaysOfWeek = \App\Json::decode($scheduledDaysOfWeek);

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

                                          if (1 == \count($scheduledDaysOfWeek)) { //if only one weekday selected, then get next week

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

                                              if (empty($nextWeekDay)) {

              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

                                          $nextTriggerDay = $day;

              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

                   * to get next trigger time.

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

                                      $nextTriggerWeekDay = $weekDay;

              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

                   * @return time

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

                      if ($scheduledDayOfMonth) {

              Line exceeds 120 characters; contains 128 characters
              Open

                                1. First sort all the days in ascending order and find the closest day which is greater than currentDayOfMonth

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

                              }

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

                          $monthInFullText = date('F', $currentTime);

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

                   */

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

                                      $nextTime = date('Y-m-d H:i:s', strtotime($weekDays[$scheduledDaysOfWeek[0]] . ' ' . $scheduledTime));

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

                      $currentDayOfMonth = date('j', time());

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

                                  $nextTime = $nextTime . ' ' . $scheduledTime;

              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

                      $weekDays = ['1' => 'Monday', '2' => 'Tuesday', '3' => 'Wednesday', '4' => 'Thursday', '5' => 'Friday', '6' => 'Saturday', '7' => 'Sunday'];

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

                      if ($scheduledDaysOfWeek) {

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

                                  }

              Line exceeds 120 characters; contains 122 characters
              Open

                                      $nextTime = date('Y-m-d H:i:s', strtotime($weekDays[$nextTriggerWeekDay] . ' ' . $scheduledTime));

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

                      return $nextTime;

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

                                      }

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

                                      $nextTriggerDay = $day;

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

                              if (!empty($nextTriggerDay)) {

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

                              $nextMonth = date('Y-m-d H:i:s', strtotime('first day of next month'));

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

                          $nextTime = date('Y-m-d H:i:s', strtotime($scheduledWeekDayOfMonth . ' ' . $monthInFullText . ' ' . $yearFullNumberic . ' ' . $scheduledTime));

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

                  {

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

                              $nextTriggerWeekDay = null;

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

                              foreach ($scheduledDaysOfWeek as $index => $weekDay) {

              Line exceeds 120 characters; contains 136 characters
              Open

                                      $scheduleWeekDayInTime = strtotime(date('Y-m-d', strtotime($weekDays[$currentWeekDay])) . ' ' . $scheduledTime);

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

                                      }

              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

                   * @param int $scheduledTime

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

                              foreach ($scheduledDaysOfMonth as $day) {

              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

                              $monthInFullText = date('F', strtotime($nextMonth));

              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

                      }

              Line exceeds 120 characters; contains 148 characters
              Open

                      $weekDays = ['1' => 'Monday', '2' => 'Tuesday', '3' => 'Wednesday', '4' => 'Thursday', '5' => 'Friday', '6' => 'Saturday', '7' => 'Sunday'];

              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 ($weekDay == $currentWeekDay) { //if today is the weekday selected

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

                              /*

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

                              $nextTriggerDay = null;

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

                                  $firstDayofNextMonth = date('Y:m:d H:i:s', strtotime('first day of this month'));

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

                   * @param int       $scheduledWeekDayOfMonth

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

                  public function getNextTriggerTimeForMonthlyByWeekDay($scheduledWeekDayOfMonth, $scheduledTime)

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

                          $yearFullNumberic = date('Y', $currentTime);

              Line exceeds 120 characters; contains 155 characters
              Open

                          $nextTime = date('Y-m-d H:i:s', strtotime($scheduledWeekDayOfMonth . ' ' . $monthInFullText . ' ' . $yearFullNumberic . ' ' . $scheduledTime));

              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 json $scheduledDaysOfWeek

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

                      $currentTime = time();

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

                          if (\is_array($scheduledDaysOfWeek)) {

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

                                      $scheduleWeekDayInTime = strtotime(date('Y-m-d', strtotime($weekDays[$currentWeekDay])) . ' ' . $scheduledTime);

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

                          $scheduledDaysOfMonth = \App\Json::decode($scheduledDayOfMonth);

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

                                  } elseif ($day > $currentDayOfMonth) {

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

                   * @param timestamp $scheduledTime

              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 ($now > $todayScheduledTime) {

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

                   *

              Line exceeds 120 characters; contains 143 characters
              Open

                                1. First sort all the weekdays(stored as 0,1,2,3 etc in db) and find the closest weekday which is greater than currentWeekDay

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

                                      //current time greater than scheduled time, get the next weekday

              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

                                  if (!empty($nextTriggerWeekDay)) {

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

                  /**

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

                   * to get next trigger time for weekday of the month.

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

                          $nextTime = date('Y-m-d H:i:s', $todayScheduledTime);

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

                              sort($scheduledDaysOfWeek);

              Line exceeds 120 characters; contains 123 characters
              Open

                                              $nextTime = date('Y-m-d', strtotime('next ' . $weekDays[$weekDay])) . ' ' . $scheduledTime;

              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

                              if (!isset($nextTime)) {

              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 $scheduledDayOfMonth

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

                                      $schTime = strtotime(date('Y') . '-' . date('m') . '-' . $day . ' ' . $scheduledTime);

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

                      return $nextTime;

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

                  /**

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

                      $currentDayOfMonth = date('j', $currentTime);

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

                      } else {

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

                      }

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

                      if ($annualDates) {

              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

                              $nextTriggerDay = $annualDates[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

                          foreach ($annualDates as $day) {

              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

                   * @param json      $annualDates

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

                          $currentTime = time();

              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

                          $annualDates = \App\Json::decode($annualDates);

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

                          // sort the dates

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

                                  $schTime = strtotime($day . ' ' . $scheduledTime);

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

                   * @param timestamp $scheduledTime

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

                                      $nextTriggerDay = $day;

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

                          $currentDayOfMonth = date('Y-m-d', $currentTime);

              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

                  {

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

                                  if ($schTime > $currentTime) {

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

                                  $nextTriggerDay = $day;

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

                      return $nextTime;

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

                          $nextTriggerDay = null;

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

                          if (!empty($nextTriggerDay)) {

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

                              $nextTime = date('Y:m:d H:i:s', strtotime($nextTriggerDay . ' ' . $scheduledTime . '+1 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

                              if ($day == $currentDayOfMonth) {

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

                              } elseif ($day > $today) {

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

                  }

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

                          $today = date('Y-m-d');

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

                   * @return time

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

                  public function getNextTriggerTimeForAnnualDates($annualDates, $scheduledTime)

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

                          sort($annualDates);

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

                                  }

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

                              $nextTime = date('Y:m:d H:i:s', strtotime($nextTriggerDay . ' ' . $scheduledTime));

              Line indented incorrectly; expected 28 spaces, found 32
              Open

                                              }

              Line indented incorrectly; expected 24 spaces, found 28
              Open

                                          }

              Line indented incorrectly; expected 28 spaces, found 32
              Open

                                              if (empty($nextWeekDay)) {

              Line indented incorrectly; expected 24 spaces, found 28
              Open

                                          if (1 == \count($scheduledDaysOfWeek)) { //if only one weekday selected, then get next week

              Line indented incorrectly; expected 24 spaces, found 28
              Open

                                          } else {

              The variable $default_timezone is not named in camelCase.
              Open

                  public function getNextTriggerTime()
                  {
                      $default_timezone = \App\Config::main('default_timezone');
                      $admin = Users::getActiveAdminUser();
                      $adminTimeZone = $admin->time_zone;

              CamelCaseVariableName

              Since: 0.2

              It is considered best practice to use the camelCase notation to name variables.

              Example

              class ClassName {
                  public function doSomething() {
                      $data_module = new DataModule();
                  }
              }

              Source

              The variable $default_timezone is not named in camelCase.
              Open

                  public function getNextTriggerTime()
                  {
                      $default_timezone = \App\Config::main('default_timezone');
                      $admin = Users::getActiveAdminUser();
                      $adminTimeZone = $admin->time_zone;

              CamelCaseVariableName

              Since: 0.2

              It is considered best practice to use the camelCase notation to name variables.

              Example

              class ClassName {
                  public function doSomething() {
                      $data_module = new DataModule();
                  }
              }

              Source

              There are no issues that match your filters.

              Category
              Status