YetiForceCompany/YetiForceCRM

View on GitHub
modules/com_vtiger_workflow/VTJsonCondition.php

Summary

Maintainability
F
1 wk
Test Coverage
F
25%

Function checkCondition has a Cognitive Complexity of 110 (exceeds 5 allowed). Consider refactoring.
Open

    public function checkCondition(Vtiger_Record_Model $recordModel, $cond, Vtiger_Record_Model $referredRecordModel = null)
    {
        $condition = $cond['operation'];
        $fieldInstance = $recordModel->getModule()->getFieldByName($cond['fieldname']);
        if (empty($condition) || false === $fieldInstance) {
Severity: Minor
Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 2 days 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 checkCondition has 377 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function checkCondition(Vtiger_Record_Model $recordModel, $cond, Vtiger_Record_Model $referredRecordModel = null)
    {
        $condition = $cond['operation'];
        $fieldInstance = $recordModel->getModule()->getFieldByName($cond['fieldname']);
        if (empty($condition) || false === $fieldInstance) {
Severity: Major
Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 1 day to fix

    Function evaluate has a Cognitive Complexity of 72 (exceeds 5 allowed). Consider refactoring.
    Open

        public function evaluate($condition, Vtiger_Record_Model $recordModel)
        {
            $expr = \App\Json::decode($condition);
            $finalResult = true;
            if (\is_array($expr)) {
    Severity: Minor
    Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 1 day 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 VTJsonCondition.php has 494 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/VTJsonCondition.php - About 7 hrs to fix

      Method evaluate has 89 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function evaluate($condition, Vtiger_Record_Model $recordModel)
          {
              $expr = \App\Json::decode($condition);
              $finalResult = true;
              if (\is_array($expr)) {
      Severity: Major
      Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 3 hrs to fix

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

        class VTJsonCondition
        {
            /**
             * Evaluate.
             *

        Avoid too many return statements within this method.
        Open

                                        return $result;
        Severity: Major
        Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                                  return 'on' === $fieldValue || 1 === $fieldValue || '1' === $fieldValue;
          Severity: Major
          Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                            return preg_match($value, $fieldValue);
            Severity: Major
            Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                              return false;
              Severity: Major
              Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                                return true;
                Severity: Major
                Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                                  return false;
                  Severity: Major
                  Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                        return true;
                    Severity: Major
                    Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                                      return empty(array_diff($value, $fieldValue));
                      Severity: Major
                      Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                            return !\in_array($fieldValue, $value);
                        Severity: Major
                        Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                          return $fieldValue != $hasChanged;
                          Severity: Major
                          Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                                return false;
                            Severity: Major
                            Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                                  return true;
                              Severity: Major
                              Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                                return false;
                                Severity: Major
                                Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                                  return $recordModel->get($fieldInstance->getName()) !== $recordModel->get('created_user_id');
                                  Severity: Major
                                  Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                    Avoid too many return statements within this method.
                                    Open

                                                        return false;
                                    Severity: Major
                                    Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                      Avoid too many return statements within this method.
                                      Open

                                                          return false;
                                      Severity: Major
                                      Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                        Avoid too many return statements within this method.
                                        Open

                                                        return true;
                                        Severity: Major
                                        Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                          Avoid too many return statements within this method.
                                          Open

                                                              return false;
                                          Severity: Major
                                          Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                            Avoid too many return statements within this method.
                                            Open

                                                                return true;
                                            Severity: Major
                                            Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                              Avoid too many return statements within this method.
                                              Open

                                                              return false;
                                              Severity: Major
                                              Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                Avoid too many return statements within this method.
                                                Open

                                                                    return true;
                                                Severity: Major
                                                Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                  Avoid too many return statements within this method.
                                                  Open

                                                                      return false;
                                                  Severity: Major
                                                  Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                    Avoid too many return statements within this method.
                                                    Open

                                                                    return $fieldValue > $value;
                                                    Severity: Major
                                                    Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                      Avoid too many return statements within this method.
                                                      Open

                                                                      return $fieldValue != $value;
                                                      Severity: Major
                                                      Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                        Avoid too many return statements within this method.
                                                        Open

                                                                            return $fieldValue != $value;
                                                        Severity: Major
                                                        Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                          Avoid too many return statements within this method.
                                                          Open

                                                                              return \in_array($fieldValue, $value);
                                                          Severity: Major
                                                          Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                            Avoid too many return statements within this method.
                                                            Open

                                                                            return $fieldValue < $value;
                                                            Severity: Major
                                                            Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                              Avoid too many return statements within this method.
                                                              Open

                                                                              return false;
                                                              Severity: Major
                                                              Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                Avoid too many return statements within this method.
                                                                Open

                                                                                return false;
                                                                Severity: Major
                                                                Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                  Avoid too many return statements within this method.
                                                                  Open

                                                                                      return false;
                                                                  Severity: Major
                                                                  Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                    Avoid too many return statements within this method.
                                                                    Open

                                                                                    return false;
                                                                    Severity: Major
                                                                    Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                      Avoid too many return statements within this method.
                                                                      Open

                                                                                                      return !empty(array_diff($value, $fieldValue));
                                                                      Severity: Major
                                                                      Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                        Avoid too many return statements within this method.
                                                                        Open

                                                                                        return $this->startsWith($fieldValue, $value);
                                                                        Severity: Major
                                                                        Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                          Avoid too many return statements within this method.
                                                                          Open

                                                                                              return false;
                                                                          Severity: Major
                                                                          Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                            Avoid too many return statements within this method.
                                                                            Open

                                                                                                return true;
                                                                            Severity: Major
                                                                            Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                              Avoid too many return statements within this method.
                                                                              Open

                                                                                                  return false;
                                                                              Severity: Major
                                                                              Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                                Avoid too many return statements within this method.
                                                                                Open

                                                                                                    return false;
                                                                                Severity: Major
                                                                                Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                                  Avoid too many return statements within this method.
                                                                                  Open

                                                                                                                  return $result;
                                                                                  Severity: Major
                                                                                  Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                                    Avoid too many return statements within this method.
                                                                                    Open

                                                                                                        return true;
                                                                                    Severity: Major
                                                                                    Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                                      Avoid too many return statements within this method.
                                                                                      Open

                                                                                                      return false;
                                                                                      Severity: Major
                                                                                      Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                                        Avoid too many return statements within this method.
                                                                                        Open

                                                                                                        return ($recordModel->isNew() || false !== $oldValue) && $recordModel->get($cond['fieldname']) == $value;
                                                                                        Severity: Major
                                                                                        Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                                          Avoid too many return statements within this method.
                                                                                          Open

                                                                                                          return $fieldValue == $value;
                                                                                          Severity: Major
                                                                                          Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                                            Avoid too many return statements within this method.
                                                                                            Open

                                                                                                                    return 'off' === $fieldValue || 0 === $fieldValue || '0' === $fieldValue || '' === $fieldValue;
                                                                                            Severity: Major
                                                                                            Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                                              Avoid too many return statements within this method.
                                                                                              Open

                                                                                                              return false === $recordModel->getPreviousValue($cond['fieldname']);
                                                                                              Severity: Major
                                                                                              Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                                                Avoid too many return statements within this method.
                                                                                                Open

                                                                                                                    return false;
                                                                                                Severity: Major
                                                                                                Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                                                  Avoid too many return statements within this method.
                                                                                                  Open

                                                                                                                      return true;
                                                                                                  Severity: Major
                                                                                                  Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                                                    Avoid too many return statements within this method.
                                                                                                    Open

                                                                                                                        return false;
                                                                                                    Severity: Major
                                                                                                    Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                                                      Avoid too many return statements within this method.
                                                                                                      Open

                                                                                                                          return true;
                                                                                                      Severity: Major
                                                                                                      Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                                                        Avoid too many return statements within this method.
                                                                                                        Open

                                                                                                                            return true;
                                                                                                        Severity: Major
                                                                                                        Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                                                          Avoid too many return statements within this method.
                                                                                                          Open

                                                                                                                              return false;
                                                                                                          Severity: Major
                                                                                                          Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                                                            Avoid too many return statements within this method.
                                                                                                            Open

                                                                                                                            return (int) $value !== \App\User::getCurrentUserId() ? false : true;
                                                                                                            Severity: Major
                                                                                                            Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                                                              Avoid too many return statements within this method.
                                                                                                              Open

                                                                                                                                  return false;
                                                                                                              Severity: Major
                                                                                                              Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                                                                Avoid too many return statements within this method.
                                                                                                                Open

                                                                                                                                    return 'on' === $fieldValue || 1 === $fieldValue || '1' === $fieldValue;
                                                                                                                Severity: Major
                                                                                                                Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                                                                  Avoid too many return statements within this method.
                                                                                                                  Open

                                                                                                                                      return true;
                                                                                                                  Severity: Major
                                                                                                                  Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                                                                    Avoid too many return statements within this method.
                                                                                                                    Open

                                                                                                                                    return (int) $value === \App\User::getCurrentUserId() ? false : true;
                                                                                                                    Severity: Major
                                                                                                                    Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                                                                      Avoid too many return statements within this method.
                                                                                                                      Open

                                                                                                                                      return $fieldValue > $value;
                                                                                                                      Severity: Major
                                                                                                                      Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                                                                        Avoid too many return statements within this method.
                                                                                                                        Open

                                                                                                                                        return $fieldValue <= $value;
                                                                                                                        Severity: Major
                                                                                                                        Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                                                                          Avoid too many return statements within this method.
                                                                                                                          Open

                                                                                                                                          return $fieldValue >= $value;
                                                                                                                          Severity: Major
                                                                                                                          Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                                                                            Avoid too many return statements within this method.
                                                                                                                            Open

                                                                                                                                                return 'off' === $fieldValue || 0 === $fieldValue || '0' === $fieldValue || '' === $fieldValue;
                                                                                                                            Severity: Major
                                                                                                                            Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                                                                              Avoid too many return statements within this method.
                                                                                                                              Open

                                                                                                                                                  return $fieldValue == $value;
                                                                                                                              Severity: Major
                                                                                                                              Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                                                                                Avoid too many return statements within this method.
                                                                                                                                Open

                                                                                                                                                return false === strpos($fieldValue, $value);
                                                                                                                                Severity: Major
                                                                                                                                Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                                                                                  Avoid too many return statements within this method.
                                                                                                                                  Open

                                                                                                                                                      return false;
                                                                                                                                  Severity: Major
                                                                                                                                  Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                                                                                    Avoid too many return statements within this method.
                                                                                                                                    Open

                                                                                                                                                    return false;
                                                                                                                                    Severity: Major
                                                                                                                                    Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                                                                                      Avoid too many return statements within this method.
                                                                                                                                      Open

                                                                                                                                                          return true;
                                                                                                                                      Severity: Major
                                                                                                                                      Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                                                                                        Avoid too many return statements within this method.
                                                                                                                                        Open

                                                                                                                                                            return false;
                                                                                                                                        Severity: Major
                                                                                                                                        Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                                                                                          Avoid too many return statements within this method.
                                                                                                                                          Open

                                                                                                                                                          return false;
                                                                                                                                          Severity: Major
                                                                                                                                          Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                                                                                            Avoid too many return statements within this method.
                                                                                                                                            Open

                                                                                                                                                            return false;
                                                                                                                                            Severity: Major
                                                                                                                                            Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                                                                                              Avoid too many return statements within this method.
                                                                                                                                              Open

                                                                                                                                                              return true;
                                                                                                                                              Severity: Major
                                                                                                                                              Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                                                                                                Avoid too many return statements within this method.
                                                                                                                                                Open

                                                                                                                                                                return $fieldValue < $value;
                                                                                                                                                Severity: Major
                                                                                                                                                Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                                                                                                  Avoid too many return statements within this method.
                                                                                                                                                  Open

                                                                                                                                                                  return $this->endsWith($fieldValue, $value);
                                                                                                                                                  Severity: Major
                                                                                                                                                  Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                                                                                                    Avoid too many return statements within this method.
                                                                                                                                                    Open

                                                                                                                                                                    return false;
                                                                                                                                                    Severity: Major
                                                                                                                                                    Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                                                                                                      Avoid too many return statements within this method.
                                                                                                                                                      Open

                                                                                                                                                                          return false;
                                                                                                                                                      Severity: Major
                                                                                                                                                      Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                                                                                                        Avoid too many return statements within this method.
                                                                                                                                                        Open

                                                                                                                                                                            return false;
                                                                                                                                                        Severity: Major
                                                                                                                                                        Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                                                                                                          Avoid too many return statements within this method.
                                                                                                                                                          Open

                                                                                                                                                                              return true;
                                                                                                                                                          Severity: Major
                                                                                                                                                          Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                                                                                                            Avoid too many return statements within this method.
                                                                                                                                                            Open

                                                                                                                                                                            return false !== strpos($fieldValue, $value);
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                                                                                                              Avoid too many return statements within this method.
                                                                                                                                                              Open

                                                                                                                                                                              return false;
                                                                                                                                                              Severity: Major
                                                                                                                                                              Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                                                                                                                Avoid too many return statements within this method.
                                                                                                                                                                Open

                                                                                                                                                                                    return true;
                                                                                                                                                                Severity: Major
                                                                                                                                                                Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                                                                                                                  Avoid too many return statements within this method.
                                                                                                                                                                  Open

                                                                                                                                                                                      return true;
                                                                                                                                                                  Severity: Major
                                                                                                                                                                  Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                                                                                                                    Avoid too many return statements within this method.
                                                                                                                                                                    Open

                                                                                                                                                                                        return true;
                                                                                                                                                                    Severity: Major
                                                                                                                                                                    Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                                                                                                                      Avoid too many return statements within this method.
                                                                                                                                                                      Open

                                                                                                                                                                                          return true;
                                                                                                                                                                      Severity: Major
                                                                                                                                                                      Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                                                                                                                        Avoid too many return statements within this method.
                                                                                                                                                                        Open

                                                                                                                                                                                            return true;
                                                                                                                                                                        Severity: Major
                                                                                                                                                                        Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                                                                                                                          Avoid too many return statements within this method.
                                                                                                                                                                          Open

                                                                                                                                                                                          return false;
                                                                                                                                                                          Severity: Major
                                                                                                                                                                          Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                                                                                                                            Avoid too many return statements within this method.
                                                                                                                                                                            Open

                                                                                                                                                                                            return false;
                                                                                                                                                                            Severity: Major
                                                                                                                                                                            Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                                                                                                                              Avoid too many return statements within this method.
                                                                                                                                                                              Open

                                                                                                                                                                                              return false;
                                                                                                                                                                              Severity: Major
                                                                                                                                                                              Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

                                                                                                                                                                                Avoid too many return statements within this method.
                                                                                                                                                                                Open

                                                                                                                                                                                                return false;
                                                                                                                                                                                Severity: Major
                                                                                                                                                                                Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 30 mins to fix

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

                                                                                                                                                                                      public function checkCondition(Vtiger_Record_Model $recordModel, $cond, Vtiger_Record_Model $referredRecordModel = null)
                                                                                                                                                                                      {
                                                                                                                                                                                          $condition = $cond['operation'];
                                                                                                                                                                                          $fieldInstance = $recordModel->getModule()->getFieldByName($cond['fieldname']);
                                                                                                                                                                                          if (empty($condition) || false === $fieldInstance) {

                                                                                                                                                                                  The method checkCondition() has an NPath complexity of 453000. The configured NPath complexity threshold is 200.
                                                                                                                                                                                  Open

                                                                                                                                                                                      public function checkCondition(Vtiger_Record_Model $recordModel, $cond, Vtiger_Record_Model $referredRecordModel = null)
                                                                                                                                                                                      {
                                                                                                                                                                                          $condition = $cond['operation'];
                                                                                                                                                                                          $fieldInstance = $recordModel->getModule()->getFieldByName($cond['fieldname']);
                                                                                                                                                                                          if (empty($condition) || false === $fieldInstance) {

                                                                                                                                                                                  NPathComplexity

                                                                                                                                                                                  Since: 0.1

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

                                                                                                                                                                                  Example

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

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

                                                                                                                                                                                  The method evaluate() has an NPath complexity of 7525. The configured NPath complexity threshold is 200.
                                                                                                                                                                                  Open

                                                                                                                                                                                      public function evaluate($condition, Vtiger_Record_Model $recordModel)
                                                                                                                                                                                      {
                                                                                                                                                                                          $expr = \App\Json::decode($condition);
                                                                                                                                                                                          $finalResult = true;
                                                                                                                                                                                          if (\is_array($expr)) {

                                                                                                                                                                                  NPathComplexity

                                                                                                                                                                                  Since: 0.1

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

                                                                                                                                                                                  Example

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

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

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

                                                                                                                                                                                      public function checkCondition(Vtiger_Record_Model $recordModel, $cond, Vtiger_Record_Model $referredRecordModel = null)
                                                                                                                                                                                      {
                                                                                                                                                                                          $condition = $cond['operation'];
                                                                                                                                                                                          $fieldInstance = $recordModel->getModule()->getFieldByName($cond['fieldname']);
                                                                                                                                                                                          if (empty($condition) || false === $fieldInstance) {

                                                                                                                                                                                  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 evaluate() has a Cyclomatic Complexity of 29. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                                  Open

                                                                                                                                                                                      public function evaluate($condition, Vtiger_Record_Model $recordModel)
                                                                                                                                                                                      {
                                                                                                                                                                                          $expr = \App\Json::decode($condition);
                                                                                                                                                                                          $finalResult = true;
                                                                                                                                                                                          if (\is_array($expr)) {

                                                                                                                                                                                  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

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

                                                                                                                                                                                      public function checkCondition(Vtiger_Record_Model $recordModel, $cond, Vtiger_Record_Model $referredRecordModel = null)

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

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

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

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

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

                                                                                                                                                                                          switch ($condition) {

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

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

                                                                                                                                                                                      public function evaluate($condition, Vtiger_Record_Model $recordModel)

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

                                                                                                                                                                                  See

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

                                                                                                                                                                                      public function checkCondition(Vtiger_Record_Model $recordModel, $cond, Vtiger_Record_Model $referredRecordModel = null)

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

                                                                                                                                                                                  Noncompliant Code Example

                                                                                                                                                                                  With the default threshold of 3:

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

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

                                                                                                                                                                                      public function checkCondition(Vtiger_Record_Model $recordModel, $cond, Vtiger_Record_Model $referredRecordModel = 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

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

                                                                                                                                                                                  class VTJsonCondition
                                                                                                                                                                                  {
                                                                                                                                                                                      /**
                                                                                                                                                                                       * Evaluate.
                                                                                                                                                                                       *

                                                                                                                                                                                  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 '176', column '18').
                                                                                                                                                                                  Open

                                                                                                                                                                                              $parser = new VTExpressionParser(new VTExpressionSpaceFilter(new VTExpressionTokenizer($value)));

                                                                                                                                                                                  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 '176', column '69').
                                                                                                                                                                                  Open

                                                                                                                                                                                              $parser = new VTExpressionParser(new VTExpressionSpaceFilter(new VTExpressionTokenizer($value)));

                                                                                                                                                                                  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 '176', column '41').
                                                                                                                                                                                  Open

                                                                                                                                                                                              $parser = new VTExpressionParser(new VTExpressionSpaceFilter(new VTExpressionTokenizer($value)));

                                                                                                                                                                                  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 '178', column '25').
                                                                                                                                                                                  Open

                                                                                                                                                                                              $exprEvaluater = new VTFieldExpressionEvaluater($expression);

                                                                                                                                                                                  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 '541', column '15').
                                                                                                                                                                                  Open

                                                                                                                                                                                                  throw new \App\Exceptions\AppException('Found an unexpected condition: ' . $condition);

                                                                                                                                                                                  MissingImport

                                                                                                                                                                                  Since: 2.7.0

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

                                                                                                                                                                                  Example

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

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

                                                                                                                                                                                  Avoid assigning values to variables in if clauses and the like (line '531', column '7').
                                                                                                                                                                                  Open

                                                                                                                                                                                      public function checkCondition(Vtiger_Record_Model $recordModel, $cond, Vtiger_Record_Model $referredRecordModel = null)
                                                                                                                                                                                      {
                                                                                                                                                                                          $condition = $cond['operation'];
                                                                                                                                                                                          $fieldInstance = $recordModel->getModule()->getFieldByName($cond['fieldname']);
                                                                                                                                                                                          if (empty($condition) || false === $fieldInstance) {

                                                                                                                                                                                  IfStatementAssignment

                                                                                                                                                                                  Since: 2.7.0

                                                                                                                                                                                  Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

                                                                                                                                                                                  Example

                                                                                                                                                                                  class Foo
                                                                                                                                                                                  {
                                                                                                                                                                                      public function bar($flag)
                                                                                                                                                                                      {
                                                                                                                                                                                          if ($foo = 'bar') { // possible typo
                                                                                                                                                                                              // ...
                                                                                                                                                                                          }
                                                                                                                                                                                          if ($baz = 0) { // always false
                                                                                                                                                                                              // ...
                                                                                                                                                                                          }
                                                                                                                                                                                      }
                                                                                                                                                                                  }

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

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

                                                                                                                                                                                              } else {
                                                                                                                                                                                                  $fieldValue = $recordModel->get($fieldName);
                                                                                                                                                                                              }

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

                                                                                                                                                                                          $expr = \App\Json::decode($condition);

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

                                                                                                                                                                                              } else {
                                                                                                                                                                                                  $value = $recordModel->get($value);
                                                                                                                                                                                              }

                                                                                                                                                                                  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 'Vtiger_Watchdog_Model' in method 'checkCondition'.
                                                                                                                                                                                  Open

                                                                                                                                                                                                  $watchdog = Vtiger_Watchdog_Model::getInstanceById($recordModel->getId(), $recordModel->getModuleName());

                                                                                                                                                                                  StaticAccess

                                                                                                                                                                                  Since: 1.4.0

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

                                                                                                                                                                                  Example

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

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

                                                                                                                                                                                  Avoid using static access to class '\App\User' in method 'checkCondition'.
                                                                                                                                                                                  Open

                                                                                                                                                                                                  return (int) $value !== \App\User::getCurrentUserId() ? false : true;

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

                                                                                                                                                                                                          } else { // Case for the first condition
                                                                                                                                                                                                              $groupResult = $result;
                                                                                                                                                                                                          }

                                                                                                                                                                                  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 assigning values to variables in if clauses and the like (line '523', column '7').
                                                                                                                                                                                  Open

                                                                                                                                                                                      public function checkCondition(Vtiger_Record_Model $recordModel, $cond, Vtiger_Record_Model $referredRecordModel = null)
                                                                                                                                                                                      {
                                                                                                                                                                                          $condition = $cond['operation'];
                                                                                                                                                                                          $fieldInstance = $recordModel->getModule()->getFieldByName($cond['fieldname']);
                                                                                                                                                                                          if (empty($condition) || false === $fieldInstance) {

                                                                                                                                                                                  IfStatementAssignment

                                                                                                                                                                                  Since: 2.7.0

                                                                                                                                                                                  Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

                                                                                                                                                                                  Example

                                                                                                                                                                                  class Foo
                                                                                                                                                                                  {
                                                                                                                                                                                      public function bar($flag)
                                                                                                                                                                                      {
                                                                                                                                                                                          if ($foo = 'bar') { // possible typo
                                                                                                                                                                                              // ...
                                                                                                                                                                                          }
                                                                                                                                                                                          if ($baz = 0) { // always false
                                                                                                                                                                                              // ...
                                                                                                                                                                                          }
                                                                                                                                                                                      }
                                                                                                                                                                                  }

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

                                                                                                                                                                                  Avoid using static access to class '\Settings_TreesManager_Record_Model' in method 'checkCondition'.
                                                                                                                                                                                  Open

                                                                                                                                                                                                                  $value = \Settings_TreesManager_Record_Model::getChildren(implode('##', $value), $fieldInstance->getColumnName(), \Vtiger_Module_Model::getInstance($recordModel->getModule()->getName()));

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

                                                                                                                                                                                          } else {
                                                                                                                                                                                              $fieldValue = $recordModel->get($cond['fieldname']);
                                                                                                                                                                                          }

                                                                                                                                                                                  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 '\Settings_TreesManager_Record_Model' in method 'checkCondition'.
                                                                                                                                                                                  Open

                                                                                                                                                                                                                  $value = \Settings_TreesManager_Record_Model::getChildren(implode('##', $value), $fieldInstance->getColumnName(), \Vtiger_Module_Model::getInstance($recordModel->getModule()->getName()));

                                                                                                                                                                                  StaticAccess

                                                                                                                                                                                  Since: 1.4.0

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

                                                                                                                                                                                  Example

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

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

                                                                                                                                                                                  Avoid using static access to class 'Vtiger_Watchdog_Model' in method 'checkCondition'.
                                                                                                                                                                                  Open

                                                                                                                                                                                                  $watchdog = Vtiger_Watchdog_Model::getInstanceById($recordModel->getId(), $recordModel->getModuleName());

                                                                                                                                                                                  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\Record' in method 'evaluate'.
                                                                                                                                                                                  Open

                                                                                                                                                                                                              if (\App\Record::isExists($referenceFieldId)) {

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

                                                                                                                                                                                                      } else { // Case for the first condition
                                                                                                                                                                                                          $finalResult = $result;
                                                                                                                                                                                                      }

                                                                                                                                                                                  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\User' in method 'checkCondition'.
                                                                                                                                                                                  Open

                                                                                                                                                                                                  return (int) $value === \App\User::getCurrentUserId() ? false : true;

                                                                                                                                                                                  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\RecordStatus' in method 'checkCondition'.
                                                                                                                                                                                  Open

                                                                                                                                                                                                      ($fieldName = App\RecordStatus::getFieldName($recordModel->getModule()->getName()))

                                                                                                                                                                                  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\RecordStatus' in method 'checkCondition'.
                                                                                                                                                                                  Open

                                                                                                                                                                                                  && \in_array($recordModel->get($fieldName), App\RecordStatus::getStates($recordModel->getModule()->getName(), \App\RecordStatus::RECORD_STATE_CLOSED))

                                                                                                                                                                                  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\Owner' in method 'evaluate'.
                                                                                                                                                                                  Open

                                                                                                                                                                                                          } elseif ('Users' === \App\Fields\Owner::getType($referenceFieldId) && \App\User::getUserModel($referenceFieldId)->isActive()) {

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

                                                                                                                                                                                                          $value = \App\Fields\Date::formatToDb($value, true);

                                                                                                                                                                                  StaticAccess

                                                                                                                                                                                  Since: 1.4.0

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

                                                                                                                                                                                  Example

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

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

                                                                                                                                                                                  Avoid using static access to class 'Vtiger_Record_Model' in method 'evaluate'.
                                                                                                                                                                                  Open

                                                                                                                                                                                                                  $referenceRecordModel = Vtiger_Record_Model::getInstanceById($referenceFieldId);

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

                                                                                                                                                                                                          } else {
                                                                                                                                                                                                              $value = [];
                                                                                                                                                                                                          }

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

                                                                                                                                                                                                  } else {
                                                                                                                                                                                                      $referenceField = $matches[1];
                                                                                                                                                                                                      $referenceModule = $matches[2];
                                                                                                                                                                                                      $fieldname = $matches[3];
                                                                                                                                                                                                      $result = false;

                                                                                                                                                                                  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\RecordStatus' in method 'checkCondition'.
                                                                                                                                                                                  Open

                                                                                                                                                                                                      ($fieldName = App\RecordStatus::getFieldName($recordModel->getModule()->getName()))

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

                                                                                                                                                                                              } else {
                                                                                                                                                                                                  $value = $exprEvaluater->evaluate($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

                                                                                                                                                                                  Avoid using static access to class 'Vtiger_Record_Model' in method 'evaluate'.
                                                                                                                                                                                  Open

                                                                                                                                                                                                              $referenceRecordModel = Vtiger_Record_Model::getInstanceById($referenceFieldId, $referenceModule);

                                                                                                                                                                                  StaticAccess

                                                                                                                                                                                  Since: 1.4.0

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

                                                                                                                                                                                  Example

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

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

                                                                                                                                                                                  Avoid using static access to class '\Vtiger_Module_Model' in method 'checkCondition'.
                                                                                                                                                                                  Open

                                                                                                                                                                                                                  $value = \Settings_TreesManager_Record_Model::getChildren(implode('##', $value), $fieldInstance->getColumnName(), \Vtiger_Module_Model::getInstance($recordModel->getModule()->getName()));

                                                                                                                                                                                  StaticAccess

                                                                                                                                                                                  Since: 1.4.0

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

                                                                                                                                                                                  Example

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

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

                                                                                                                                                                                  Avoid using static access to class '\Vtiger_Module_Model' in method 'checkCondition'.
                                                                                                                                                                                  Open

                                                                                                                                                                                                                  $value = \Settings_TreesManager_Record_Model::getChildren(implode('##', $value), $fieldInstance->getColumnName(), \Vtiger_Module_Model::getInstance($recordModel->getModule()->getName()));

                                                                                                                                                                                  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\RecordStatus' in method 'checkCondition'.
                                                                                                                                                                                  Open

                                                                                                                                                                                                  && \in_array($recordModel->get($fieldName), App\RecordStatus::getStates($recordModel->getModule()->getName(), \App\RecordStatus::RECORD_STATE_OPEN))

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

                                                                                                                                                                                                      if (\in_array($condition, ['contains', 'contains hierarchy', 'does not contain', 'does not contain hierarchy', 'is', 'is not'])) {

                                                                                                                                                                                  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 " hours" 4 times.
                                                                                                                                                                                  Open

                                                                                                                                                                                                  $olderDateTime = date('Y-m-d H:i:s', strtotime('-' . $value . ' hours'));

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

                                                                                                                                                                                                      if (\in_array($condition, ['contains', 'contains hierarchy', 'does not contain', 'does not contain hierarchy', 'is', 'is not'])) {

                                                                                                                                                                                  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 "result" 6 times.
                                                                                                                                                                                  Open

                                                                                                                                                                                                      $expressionResults[$conditionGroup][$i]['result'] = $this->checkCondition($recordModel, $cond);

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

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

                                                                                                                                                                                  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 "does not contain" 5 times.
                                                                                                                                                                                  Open

                                                                                                                                                                                                      if (\in_array($condition, ['contains', 'contains hierarchy', 'does not contain', 'does not contain hierarchy', 'is', 'is not'])) {

                                                                                                                                                                                  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 " days" 6 times.
                                                                                                                                                                                  Open

                                                                                                                                                                                                  $olderDate = date('Y-m-d', strtotime('-' . $value . ' days'));

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

                                                                                                                                                                                                  $expressionResults[$conditionGroup][$i + 1]['logicaloperator'] = (!empty($cond['joincondition'])) ? $cond['joincondition'] : 'and';

                                                                                                                                                                                  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 "datetime" 4 times.
                                                                                                                                                                                  Open

                                                                                                                                                                                          if ('datetime' === $dataType || 'date' === $dataType) {

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

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

                                                                                                                                                                                  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 "fieldname" 10 times.
                                                                                                                                                                                  Open

                                                                                                                                                                                                  preg_match('/(\w+) : \((\w+)\) (\w+)/', $cond['fieldname'], $matches);

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

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

                                                                                                                                                                                  Noncompliant Code Example

                                                                                                                                                                                  With the default threshold of 3:

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

                                                                                                                                                                                  Compliant Solution

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

                                                                                                                                                                                  Exceptions

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

                                                                                                                                                                                  Argument 1 (moduleName) is false but \App\RecordStatus::getFieldName() takes string defined at /code/app/RecordStatus.php:406
                                                                                                                                                                                  Open

                                                                                                                                                                                                      ($fieldName = App\RecordStatus::getFieldName($recordModel->getModule()->getName()))

                                                                                                                                                                                  Argument 1 (moduleName) is false but \App\RecordStatus::getFieldName() takes string defined at /code/app/RecordStatus.php:406
                                                                                                                                                                                  Open

                                                                                                                                                                                                      ($fieldName = App\RecordStatus::getFieldName($recordModel->getModule()->getName()))

                                                                                                                                                                                  Argument 1 (mixed) is false but \Vtiger_Module_Model::getInstance() takes int|string defined at /code/modules/Vtiger/models/Module.php:197
                                                                                                                                                                                  Open

                                                                                                                                                                                                                  $value = \Settings_TreesManager_Record_Model::getChildren(implode('##', $value), $fieldInstance->getColumnName(), \Vtiger_Module_Model::getInstance($recordModel->getModule()->getName()));

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

                                                                                                                                                                                          $expr = \App\Json::decode($condition);

                                                                                                                                                                                  Argument 1 (mixed) is false but \Vtiger_Module_Model::getInstance() takes int|string defined at /code/modules/Vtiger/models/Module.php:197
                                                                                                                                                                                  Open

                                                                                                                                                                                                                  $value = \Settings_TreesManager_Record_Model::getChildren(implode('##', $value), $fieldInstance->getColumnName(), \Vtiger_Module_Model::getInstance($recordModel->getModule()->getName()));

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

                                                                                                                                                                                                  return (int) $value === \App\User::getCurrentUserId() ? false : true;

                                                                                                                                                                                  Returning type bool but evaluate() is declared to return string
                                                                                                                                                                                  Open

                                                                                                                                                                                          return $finalResult;

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

                                                                                                                                                                                                  return (int) $value !== \App\User::getCurrentUserId() ? false : true;

                                                                                                                                                                                  Argument 1 (moduleName) is false but \App\RecordStatus::getStates() takes string defined at /code/app/RecordStatus.php:113
                                                                                                                                                                                  Open

                                                                                                                                                                                                  && \in_array($recordModel->get($fieldName), App\RecordStatus::getStates($recordModel->getModule()->getName(), \App\RecordStatus::RECORD_STATE_CLOSED))

                                                                                                                                                                                  Call to method getType from undeclared class \App\Fields\Owner
                                                                                                                                                                                  Open

                                                                                                                                                                                                          } elseif ('Users' === \App\Fields\Owner::getType($referenceFieldId) && \App\User::getUserModel($referenceFieldId)->isActive()) {

                                                                                                                                                                                  Argument 1 (moduleName) is false but \App\RecordStatus::getStates() takes string defined at /code/app/RecordStatus.php:113
                                                                                                                                                                                  Open

                                                                                                                                                                                                  && \in_array($recordModel->get($fieldName), App\RecordStatus::getStates($recordModel->getModule()->getName(), \App\RecordStatus::RECORD_STATE_OPEN))

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

                                                                                                                                                                                                          } elseif ('Users' === \App\Fields\Owner::getType($referenceFieldId) && \App\User::getUserModel($referenceFieldId)->isActive()) {

                                                                                                                                                                                  Argument 1 (array_arg) is string but \sort() takes array
                                                                                                                                                                                  Open

                                                                                                                                                                                                                      sort($value);

                                                                                                                                                                                  Remove the code after this "return".
                                                                                                                                                                                  Open

                                                                                                                                                                                                      return $value === $fieldValue;

                                                                                                                                                                                  Jump statements (return, break, continue, and goto) and throw expressions move control flow out of the current code block. Typically, any statements in a block that come after a jump or throw are simply wasted keystrokes lying in wait to confuse the unwary.

                                                                                                                                                                                  Rarely, as illustrated below, code after a jump or throw is reachable. However, such code is difficult to understand, and should be refactored.

                                                                                                                                                                                  Noncompliant Code Example

                                                                                                                                                                                  function fun($a) {
                                                                                                                                                                                    $i = 10;
                                                                                                                                                                                    return $i + $a;
                                                                                                                                                                                    $i++;             // this is never executed
                                                                                                                                                                                  }
                                                                                                                                                                                  
                                                                                                                                                                                  function foo($a) {
                                                                                                                                                                                    if ($a == 5) {
                                                                                                                                                                                      goto error;
                                                                                                                                                                                    } else {
                                                                                                                                                                                      // do the job
                                                                                                                                                                                    }
                                                                                                                                                                                    return;
                                                                                                                                                                                  
                                                                                                                                                                                    error:
                                                                                                                                                                                      printf("don't use 5"); // this is reachable but unreadable
                                                                                                                                                                                  
                                                                                                                                                                                  }
                                                                                                                                                                                  

                                                                                                                                                                                  Compliant Solution

                                                                                                                                                                                  function fun($a) {
                                                                                                                                                                                    $i = 10;
                                                                                                                                                                                    return $i + $a;
                                                                                                                                                                                  }
                                                                                                                                                                                  
                                                                                                                                                                                  function foo($a) {
                                                                                                                                                                                    if ($a == 5) {
                                                                                                                                                                                      handleError();
                                                                                                                                                                                    } else {
                                                                                                                                                                                      // do the job
                                                                                                                                                                                    }
                                                                                                                                                                                    return;
                                                                                                                                                                                  }
                                                                                                                                                                                  

                                                                                                                                                                                  See

                                                                                                                                                                                  • MISRA C:2004, 14.1 - There shall be no unreachable code
                                                                                                                                                                                  • MISRA C++:2008, 0-1-1 - A project shall not contain unreachable code
                                                                                                                                                                                  • MISRA C++:2008, 0-1-9 - There shall be no dead code
                                                                                                                                                                                  • MISRA C:2012, 2.1 - A project shall not contain unreachable code
                                                                                                                                                                                  • MISRA C:2012, 2.2 - There shall be no dead code
                                                                                                                                                                                  • MITRE, CWE-561 - Dead Code
                                                                                                                                                                                  • CERT, MSC56-J. - Detect and remove superfluous code and values
                                                                                                                                                                                  • CERT, MSC12-C. - Detect and remove code that has no effect or is never executed
                                                                                                                                                                                  • CERT, MSC07-CPP. - Detect and remove dead code

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

                                                                                                                                                                                              case 'less than hours later':
                                                                                                                                                                                                  if (empty($rawFieldValue) || empty($value)) {
                                                                                                                                                                                                      return false;
                                                                                                                                                                                                  }
                                                                                                                                                                                                  $currentTime = date('Y-m-d H:i:s');
                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                  Found in modules/com_vtiger_workflow/VTJsonCondition.php and 2 other locations - About 55 mins to fix
                                                                                                                                                                                  modules/com_vtiger_workflow/VTJsonCondition.php on lines 421..431
                                                                                                                                                                                  modules/com_vtiger_workflow/VTJsonCondition.php on lines 462..472

                                                                                                                                                                                  Duplicated Code

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

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

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

                                                                                                                                                                                  Tuning

                                                                                                                                                                                  This issue has a mass of 98.

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

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

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

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

                                                                                                                                                                                  Refactorings

                                                                                                                                                                                  Further Reading

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

                                                                                                                                                                                              case 'less than hours before':
                                                                                                                                                                                                  if (empty($rawFieldValue) || empty($value)) {
                                                                                                                                                                                                      return false;
                                                                                                                                                                                                  }
                                                                                                                                                                                                  $currentTime = date('Y-m-d H:i:s');
                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                  Found in modules/com_vtiger_workflow/VTJsonCondition.php and 2 other locations - About 55 mins to fix
                                                                                                                                                                                  modules/com_vtiger_workflow/VTJsonCondition.php on lines 421..431
                                                                                                                                                                                  modules/com_vtiger_workflow/VTJsonCondition.php on lines 473..483

                                                                                                                                                                                  Duplicated Code

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

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

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

                                                                                                                                                                                  Tuning

                                                                                                                                                                                  This issue has a mass of 98.

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

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

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

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

                                                                                                                                                                                  Refactorings

                                                                                                                                                                                  Further Reading

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

                                                                                                                                                                                              case 'in less than':
                                                                                                                                                                                                  if (empty($fieldValue) || empty($value)) {
                                                                                                                                                                                                      return false;
                                                                                                                                                                                                  }
                                                                                                                                                                                                  $today = date('Y-m-d');
                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                  Found in modules/com_vtiger_workflow/VTJsonCondition.php and 2 other locations - About 55 mins to fix
                                                                                                                                                                                  modules/com_vtiger_workflow/VTJsonCondition.php on lines 462..472
                                                                                                                                                                                  modules/com_vtiger_workflow/VTJsonCondition.php on lines 473..483

                                                                                                                                                                                  Duplicated Code

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

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

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

                                                                                                                                                                                  Tuning

                                                                                                                                                                                  This issue has a mass of 98.

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

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

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

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

                                                                                                                                                                                  Refactorings

                                                                                                                                                                                  Further Reading

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

                                                                                                                                                                                  class VTJsonCondition

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

                                                                                                                                                                                          $sl = \strlen($str);

                                                                                                                                                                                  ShortVariable

                                                                                                                                                                                  Since: 0.2

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

                                                                                                                                                                                  Example

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

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

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

                                                                                                                                                                                          $sl = \strlen($str);

                                                                                                                                                                                  ShortVariable

                                                                                                                                                                                  Since: 0.2

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

                                                                                                                                                                                  Example

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

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

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

                                                                                                                                                                                              $i = 0;

                                                                                                                                                                                  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

                                                                                                                                                                                                      return $value === $fieldValue;

                                                                                                                                                                                  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;

                                                                                                                                                                                  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;

                                                                                                                                                                                  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;

                                                                                                                                                                                  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;

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

                                                                                                                                                                                                      return $fieldValue != $value;

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

                                                                                                                                                                                                      return $fieldValue == $value;

                                                                                                                                                                                  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 (\App\Record::isExists($referenceFieldId)) {

                                                                                                                                                                                  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

                                                                                                                                                                                              $i = 0;

                                                                                                                                                                                  Line exceeds 120 characters; contains 152 characters
                                                                                                                                                                                  Open

                                                                                                                                                                                                          } elseif ('Users' === \App\Fields\Owner::getType($referenceFieldId) && \App\User::getUserModel($referenceFieldId)->isActive()) {

                                                                                                                                                                                  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

                                                                                                                                                                                                                  $result = $this->checkCondition($referenceRecordModel, $cond, $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

                                                                                                                                                                                      public function evaluate($condition, Vtiger_Record_Model $recordModel)

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

                                                                                                                                                                                                                  $referenceRecordModel = Vtiger_Record_Model::getInstanceById($referenceFieldId);

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

                                                                                                                                                                                       * @param array               $condition

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

                                                                                                                                                                                              foreach ($expr as $cond) {

                                                                                                                                                                                  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

                                                                                                                                                                                                      $referenceField = $matches[1];

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

                                                                                                                                                                                                  $conditionGroup = $cond['groupid'];

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

                                                                                                                                                                                                  }

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

                                                                                                                                                                                                      $referenceModule = $matches[2];

                                                                                                                                                                                  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

                                                                                                                                                                                                  preg_match('/(\w+) : \((\w+)\) (\w+)/', $cond['fieldname'], $matches);

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

                                                                                                                                                                                                      if (!empty($referenceFieldId)) {

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

                                                                                                                                                                                              $groupResults = [];

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

                                                                                                                                                                                                              }

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

                                                                                                                                                                                                          } elseif ('Users' === \App\Fields\Owner::getType($referenceFieldId) && \App\User::getUserModel($referenceFieldId)->isActive()) {

                                                                                                                                                                                  Line exceeds 120 characters; contains 126 characters
                                                                                                                                                                                  Open

                                                                                                                                                                                                              $referenceRecordModel = Vtiger_Record_Model::getInstanceById($referenceFieldId, $referenceModule);

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

                                                                                                                                                                                          if (\is_array($expr)) {

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

                                                                                                                                                                                                  if (0 == \count($matches)) {

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

                                                                                                                                                                                              $expressionResults = [];

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

                                                                                                                                                                                                  if (empty($conditionGroup)) {

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

                                                                                                                                                                                                      $fieldname = $matches[3];

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

                                                                                                                                                                                                          $cond['fieldname'] = $fieldname;

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

                                                                                                                                                                                       */

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

                                                                                                                                                                                          $expr = \App\Json::decode($condition);

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

                                                                                                                                                                                                      $expressionResults[$conditionGroup][$i]['result'] = $this->checkCondition($recordModel, $cond);

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

                                                                                                                                                                                                      $result = false;

                                                                                                                                                                                  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

                                                                                                                                                                                                          if ('Users' !== $referenceModule) {

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

                                                                                                                                                                                                              $referenceRecordModel = Vtiger_Record_Model::getInstanceById($referenceFieldId, $referenceModule);

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

                                                                                                                                                                                                              $result = $this->checkCondition($referenceRecordModel, $cond, $recordModel);

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

                                                                                                                                                                                          $finalResult = true;

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

                                                                                                                                                                                                      $conditionGroup = 0;

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

                                                                                                                                                                                                      $referenceFieldId = $recordModel->get($referenceField);

                                                                                                                                                                                  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

                                                                                                                                                                                                  $logicalOperator = $groupResult['logicaloperator'];

                                                                                                                                                                                  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

                                                                                                                                                                                          $sl = \strlen($str);

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

                                                                                                                                                                                          if ($sl >= $ssl) {

                                                                                                                                                                                  Line exceeds 120 characters; contains 124 characters
                                                                                                                                                                                  Open

                                                                                                                                                                                      public function checkCondition(Vtiger_Record_Model $recordModel, $cond, Vtiger_Record_Model $referredRecordModel = null)

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

                                                                                                                                                                                          }

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

                                                                                                                                                                                              }

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

                                                                                                                                                                                              if (null !== $referredRecordModel) {

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

                                                                                                                                                                                              }

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

                                                                                                                                                                                                      $fieldValue = $recordModel->get($fieldInstance->getName());

                                                                                                                                                                                  Line exceeds 120 characters; contains 147 characters
                                                                                                                                                                                  Open

                                                                                                                                                                                                  $expressionResults[$conditionGroup][$i + 1]['logicaloperator'] = (!empty($cond['joincondition'])) ? $cond['joincondition'] : 'and';

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

                                                                                                                                                                                                          $logicalOperator = $exprResult['logicaloperator'];

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

                                                                                                                                                                                                              case 'and':

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

                                                                                                                                                                                                          $finalResult = $result;

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

                                                                                                                                                                                      /**

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

                                                                                                                                                                                       * @return bool

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

                                                                                                                                                                                          $fieldInstance = $recordModel->getModule()->getFieldByName($cond['fieldname']);

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

                                                                                                                                                                                          if ('fieldname' === $expressionType) {

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

                                                                                                                                                                                              $parser = new VTExpressionParser(new VTExpressionSpaceFilter(new VTExpressionTokenizer($value)));

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

                                                                                                                                                                                                      if (\count($recordData) > 1) {

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

                                                                                                                                                                                                  foreach ($groupExprResultSet as &$exprResult) {

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

                                                                                                                                                                                                      }

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

                                                                                                                                                                                                                      $groupResult = ($groupResult && $result);

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

                                                                                                                                                                                                  if (isset($result)) { // Condition to skip last condition

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

                                                                                                                                                                                      public function startsWith($str, $subStr)

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

                                                                                                                                                                                          $ssl = \strlen($subStr);

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

                                                                                                                                                                                          }

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

                                                                                                                                                                                          $expressionType = $cond['valuetype'];

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

                                                                                                                                                                                              $expression = $parser->expression();

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

                                                                                                                                                                                                                      $groupResult = ($groupResult || $result);

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

                                                                                                                                                                                                          switch ($logicalOperator) {

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

                                                                                                                                                                                      {

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

                                                                                                                                                                                          $dataType = $fieldInstance->getFieldDataType();

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

                                                                                                                                                                                                  case 'date':

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

                                                                                                                                                                                                      $result = null;

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

                                                                                                                                                                                                          if (isset($logicalOperator)) {

                                                                                                                                                                                  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

                                                                                                                                                                                          $sl = \strlen($str);

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

                                                                                                                                                                                              return 0 == substr_compare($str, $subStr, $sl - $ssl, $ssl);

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

                                                                                                                                                                                      }

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

                                                                                                                                                                                       * Check condition.

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

                                                                                                                                                                                       *

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

                                                                                                                                                                                                          $fieldValue = trim("$recordData[0] $recordData[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

                                                                                                                                                                                                  }

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

                                                                                                                                                                                                  $groupResults[$conditionGroup]['logicaloperator'] = (!empty($cond['groupjoin'])) ? $cond['groupjoin'] : 'and';

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

                                                                                                                                                                                                                  case 'and':

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

                                                                                                                                                                                                                  case 'or':

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

                                                                                                                                                                                                  }

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

                                                                                                                                                                                                              }

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

                                                                                                                                                                                              foreach ($groupResults as $groupId => &$groupResult) {

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

                                                                                                                                                                                                  $result = $groupResult['result'];

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

                                                                                                                                                                                                                  $finalResult = ($finalResult && $result);

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

                                                                                                                                                                                                  $expressionResults[$conditionGroup][$i + 1]['logicaloperator'] = (!empty($cond['joincondition'])) ? $cond['joincondition'] : 'and';

                                                                                                                                                                                  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 'or':

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

                                                                                                                                                                                              }

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

                                                                                                                                                                                          $ssl = \strlen($subStr);

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

                                                                                                                                                                                                                  break;

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

                                                                                                                                                                                          }

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

                                                                                                                                                                                          if ($sl >= $ssl) {

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

                                                                                                                                                                                      public function endsWith($str, $subStr)

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

                                                                                                                                                                                       * @param Vtiger_Record_Model|null $referredRecordModel

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

                                                                                                                                                                                                  $value = $recordModel->get($value);

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

                                                                                                                                                                                       * @throws Exception

                                                                                                                                                                                  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

                                                                                                                                                                                          switch ($dataType) {

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

                                                                                                                                                                                              return false;

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

                                                                                                                                                                                          $value = trim(html_entity_decode($cond['value'] ?? ''));

                                                                                                                                                                                  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

                                                                                                                                                                                                  $groupResult = true;

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

                                                                                                                                                                                                      if (isset($exprResult['result'])) {

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

                                                                                                                                                                                                          $result = $exprResult['result'];

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

                                                                                                                                                                                                      if (isset($result)) { // Condition to skip last condition

                                                                                                                                                                                  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

                                                                                                                                                                                                                  default:

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

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

                                                                                                                                                                                          $condition = $cond['operation'];

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

                                                                                                                                                                                          if ('datetime' === $dataType || 'date' === $dataType) {

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

                                                                                                                                                                                                  $value = $exprEvaluater->evaluate($referredRecordModel);

                                                                                                                                                                                  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 (isset($exprResult['logicaloperator'])) {

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

                                                                                                                                                                                                  $groupResults[$groupId]['result'] = $groupResult;

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

                                                                                                                                                                                                      } else { // Case for the first condition

                                                                                                                                                                                  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

                                                                                                                                                                                              $rawFieldValue = $fieldValue;

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

                                                                                                                                                                                                  ++$i;

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

                                                                                                                                                                                          } elseif ('expression' === $expressionType) {

                                                                                                                                                                                  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 'accountName':

                                                                                                                                                                                  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

                                                                                                                                                                                                                  $finalResult = ($finalResult || $result);

                                                                                                                                                                                  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

                                                                                                                                                                                                  case 'datetime':

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

                                                                                                                                                                                              if (null !== $referredRecordModel) {

                                                                                                                                                                                  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

                                                                                                                                                                                                              switch ($logicalOperator) {

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

                                                                                                                                                                                                          }

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

                                                                                                                                                                                              $dateTimePair = ['date_start' => 'time_start', 'due_date' => 'time_end'];

                                                                                                                                                                                  Line exceeds 120 characters; contains 126 characters
                                                                                                                                                                                  Open

                                                                                                                                                                                                  $groupResults[$conditionGroup]['logicaloperator'] = (!empty($cond['groupjoin'])) ? $cond['groupjoin'] : 'and';

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

                                                                                                                                                                                              foreach ($expressionResults as $groupId => &$groupExprResultSet) {

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

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

                                                                                                                                                                                              $fieldName = $cond['fieldname'];

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

                                                                                                                                                                                              if (isset($dateTimePair[$fieldName]) && !$recordModel->isEmpty($dateTimePair[$fieldName])) {

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

                                                                                                                                                                                                      return $value === $fieldValue;

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

                                                                                                                                                                                                      $expressionResults[$conditionGroup][$i]['result'] = $result;

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

                                                                                                                                                                                                      if (!empty($logicalOperator)) {

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

                                                                                                                                                                                                              default:

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

                                                                                                                                                                                                                  break;

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

                                                                                                                                                                                              return 0 == substr_compare($str, $subStr, 0, $ssl);

                                                                                                                                                                                  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 (empty($condition) || false === $fieldInstance) {

                                                                                                                                                                                  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

                                                                                                                                                                                              require_once 'modules/com_vtiger_workflow/expression_engine/include.php';

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

                                                                                                                                                                                              $exprEvaluater = new VTFieldExpressionEvaluater($expression);

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

                                                                                                                                                                                                  $value = $exprEvaluater->evaluate($recordModel);

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

                                                                                                                                                                                                      $fieldValue = $recordModel->get($fieldInstance->getName());

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

                                                                                                                                                                                                          } else { // Case for the first condition

                                                                                                                                                                                  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 $finalResult;

                                                                                                                                                                                  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

                                                                                                                                                                                                  $value = $referredRecordModel->get($value);

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

                                                                                                                                                                                                      }

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

                                                                                                                                                                                                              $groupResult = $result;

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

                                                                                                                                                                                                  }

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

                                                                                                                                                                                          return false;

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

                                                                                                                                                                                      public function checkCondition(Vtiger_Record_Model $recordModel, $cond, Vtiger_Record_Model $referredRecordModel = null)

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

                                                                                                                                                                                                  $fieldValue = $recordModel->get($fieldName) . ' ' . $recordModel->get($dateTimePair[$fieldName]);

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

                                                                                                                                                                                                  $fieldValue = $recordModel->get($fieldName);

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

                                                                                                                                                                                              $fieldValue = $recordModel->get($cond['fieldname']);

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

                                                                                                                                                                                                      $recordData = explode('|##|', $fieldValue);

                                                                                                                                                                                  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 $value !== $fieldValue;

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

                                                                                                                                                                                                                  if (!empty($value)) {

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

                                                                                                                                                                                                                      if (\in_array($val, $value)) {

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

                                                                                                                                                                                                              $value = [];

                                                                                                                                                                                  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

                                                                                                                                                                                                  return $fieldValue < $value;

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

                                                                                                                                                                                              case 'greaterthannow':

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

                                                                                                                                                                                                                  foreach ($fieldValue as $val) {

                                                                                                                                                                                  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

                                                                                                                                                                                                          } elseif ($value) {

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

                                                                                                                                                                                                  return $fieldValue == $value;

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

                                                                                                                                                                                                              case 'does not contain hierarchy':

                                                                                                                                                                                  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

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

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

                                                                                                                                                                                                              case 'is':

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

                                                                                                                                                                                                              case 'contains':

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

                                                                                                                                                                                                                  }

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

                                                                                                                                                                                                                          $result = false;

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

                                                                                                                                                                                                              case 'does not contain':

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

                                                                                                                                                                                                                  $value = \Settings_TreesManager_Record_Model::getChildren(implode('##', $value), $fieldInstance->getColumnName(), \Vtiger_Module_Model::getInstance($recordModel->getModule()->getName()));

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

                                                                                                                                                                                              case 'equal to':

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

                                                                                                                                                                                              case 'less than':

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

                                                                                                                                                                                                  return $fieldValue > $value;

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

                                                                                                                                                                                                      $value = Vtiger_MultiReferenceValue_UIType::COMMA . $value . Vtiger_MultiReferenceValue_UIType::COMMA;

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

                                                                                                                                                                                                                  $result = true;

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

                                                                                                                                                                                                              $value = [$value];

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

                                                                                                                                                                                                          sort($value);

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

                                                                                                                                                                                                  case 'time':

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

                                                                                                                                                                                                          sort($fieldValue);

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

                                                                                                                                                                                                                      }

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

                                                                                                                                                                                                                  $value = \Settings_TreesManager_Record_Model::getChildren(implode('##', $value), $fieldInstance->getColumnName(), \Vtiger_Module_Model::getInstance($recordModel->getModule()->getName()));

                                                                                                                                                                                  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 $result;

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

                                                                                                                                                                                                      }

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

                                                                                                                                                                                                              default:

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

                                                                                                                                                                                                          $fieldValueTemp = $value;

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

                                                                                                                                                                                                              $value = explode(',', $value);

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

                                                                                                                                                                                                      $fieldValue = $recordModel->getDisplayValue($fieldInstance->getName(), false, true);

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

                                                                                                                                                                                                          //strtotime condition is added for days before, days after where we give integer values, so strtotime will return 0 for such cases.

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

                                                                                                                                                                                                          $fieldValue = array_filter(explode(',', $fieldValue));

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

                                                                                                                                                                                                                  return $value === $fieldValue;

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

                                                                                                                                                                                                                  $result = true;

                                                                                                                                                                                  Line exceeds 120 characters; contains 219 characters
                                                                                                                                                                                  Open

                                                                                                                                                                                                                  $value = \Settings_TreesManager_Record_Model::getChildren(implode('##', $value), $fieldInstance->getColumnName(), \Vtiger_Module_Model::getInstance($recordModel->getModule()->getName()));

                                                                                                                                                                                  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 !empty(array_diff($value, $fieldValue));

                                                                                                                                                                                  Line exceeds 120 characters; contains 219 characters
                                                                                                                                                                                  Open

                                                                                                                                                                                                                  $value = \Settings_TreesManager_Record_Model::getChildren(implode('##', $value), $fieldInstance->getColumnName(), \Vtiger_Module_Model::getInstance($recordModel->getModule()->getName()));

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

                                                                                                                                                                                                          } else {

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

                                                                                                                                                                                              case 'greater than':

                                                                                                                                                                                  Line exceeds 120 characters; contains 155 characters
                                                                                                                                                                                  Open

                                                                                                                                                                                                          //strtotime condition is added for days before, days after where we give integer values, so strtotime will return 0 for such cases.

                                                                                                                                                                                  Line exceeds 120 characters; contains 122 characters
                                                                                                                                                                                  Open

                                                                                                                                                                                                      $value = Vtiger_MultiReferenceValue_UIType::COMMA . $value . Vtiger_MultiReferenceValue_UIType::COMMA;

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

                                                                                                                                                                                                  case 'multiReferenceValue':

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

                                                                                                                                                                                                  case 'categoryMultipicklist':

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

                                                                                                                                                                                                                  return empty(array_diff($value, $fieldValue));

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

                                                                                                                                                                                                                      sort($value);

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

                                                                                                                                                                                                                      if (!\in_array($val, $value)) {

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

                                                                                                                                                                                                          if (false !== strpos($value, ',')) {

                                                                                                                                                                                  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

                                                                                                                                                                                                          //To avoid again checking whether it is user or not

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

                                                                                                                                                                                                  case 'reference':

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

                                                                                                                                                                                              }

                                                                                                                                                                                  Line exceeds 120 characters; contains 150 characters
                                                                                                                                                                                  Open

                                                                                                                                                                                                      if (\in_array($condition, ['contains', 'contains hierarchy', 'does not contain', 'does not contain hierarchy', 'is', 'is not'])) {

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

                                                                                                                                                                                                          switch ($condition) {

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

                                                                                                                                                                                                                  if (!empty($value)) {

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

                                                                                                                                                                                                  case 'sharedOwner':

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

                                                                                                                                                                                                          $condition = ('is' == $condition) ? 'contains' : 'does not contain';

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

                                                                                                                                                                                                  default:

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

                                                                                                                                                                                          switch ($condition) {

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

                                                                                                                                                                                                      if ('between' !== $condition && strtotime($value)) {

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

                                                                                                                                                                                                              case 'is not':

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

                                                                                                                                                                                                              case 'contains hierarchy':

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

                                                                                                                                                                                                                      $value = explode('##', $value);

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

                                                                                                                                                                                                                  return $result;

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

                                                                                                                                                                                                                          $result = false;

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

                                                                                                                                                                                                          $fieldValue = $fieldValueTemp;

                                                                                                                                                                                  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

                                                                                                                                                                                                          $value = \App\Fields\Date::formatToDb($value, true);

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

                                                                                                                                                                                                      $value = $value . ':00'; // time fields will not have seconds appended to it, so we are adding

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

                                                                                                                                                                                                          $condition = ('is' == $condition) ? 'contains' : 'does not contain';

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

                                                                                                                                                                                                                  foreach ($fieldValue as $val) {

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

                                                                                                                                                                                                                  }

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

                                                                                                                                                                                                                      $value = explode('##', $value);

                                                                                                                                                                                  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

                                                                                                                                                                                                      if ('is' === $condition || 'is not' === $condition) {

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

                                                                                                                                                                                                      }

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

                                                                                                                                                                                                      $value = ",{$value},";

                                                                                                                                                                                  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 (\in_array($condition, ['contains', 'contains hierarchy', 'does not contain', 'does not contain hierarchy', 'is', 'is not'])) {

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

                                                                                                                                                                                                          $value = array_filter(explode(',', $value));

                                                                                                                                                                                  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

                                                                                                                                                                                                                      sort($value);

                                                                                                                                                                                  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 ('is' === $condition || 'is not' === $condition) {

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

                                                                                                                                                                                                          $value = explode(',', $fieldValue);

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

                                                                                                                                                                                                  case 'owner':

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

                                                                                                                                                                                                          }

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

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

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

                                                                                                                                                                                              case 'greater than or equal to':

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

                                                                                                                                                                                                      return $fieldValue == $value;

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

                                                                                                                                                                                                      return $fieldValue != $value;

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

                                                                                                                                                                                                      return !\in_array($fieldValue, $value);

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

                                                                                                                                                                                                  return $this->endsWith($fieldValue, $value);

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

                                                                                                                                                                                              case 'has changed':

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

                                                                                                                                                                                                  if (empty($fieldValue)) {

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

                                                                                                                                                                                                  if ($fieldValue < $value) {

                                                                                                                                                                                  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 (empty($fieldValue) || empty($value)) {

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

                                                                                                                                                                                                      return false;

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

                                                                                                                                                                                                  $olderDate = date('Y-m-d', strtotime('-' . $value . ' days'));

                                                                                                                                                                                  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 (empty($fieldValue) || empty($value)) {

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

                                                                                                                                                                                                  $olderDate = date('Y-m-d', strtotime('-' . $value . ' days'));

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

                                                                                                                                                                                              case 'does not equal':

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

                                                                                                                                                                                                  }

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

                                                                                                                                                                                                  $values = array_map('\App\Fields\Date::formatToDb', $values);

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

                                                                                                                                                                                                      return 'off' === $fieldValue || 0 === $fieldValue || '0' === $fieldValue || '' === $fieldValue;

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

                                                                                                                                                                                                  if (preg_match('/([^:]+):boolean$/', $value, $match)) {

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

                                                                                                                                                                                                      unset($value);

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

                                                                                                                                                                                                  return false === $recordModel->getPreviousValue($cond['fieldname']);

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

                                                                                                                                                                                              case 'is not empty':

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

                                                                                                                                                                                                  if ('datetime' === $dataType) {

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

                                                                                                                                                                                                  return $fieldValue >= $value;

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

                                                                                                                                                                                                  if (empty($value)) {

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

                                                                                                                                                                                              case 'more than days ago':

                                                                                                                                                                                  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

                                                                                                                                                                                                  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

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

                                                                                                                                                                                  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

                                                                                                                                                                                                  if (empty($fieldValue) || empty($value)) {

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

                                                                                                                                                                                                          return 'on' === $fieldValue || 1 === $fieldValue || '1' === $fieldValue;

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

                                                                                                                                                                                              case 'is not':

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

                                                                                                                                                                                              case 'does not contain':

                                                                                                                                                                                  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

                                                                                                                                                                                                  return $fieldValue != $value;

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

                                                                                                                                                                                                  return false;

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

                                                                                                                                                                                              case 'starts with':

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

                                                                                                                                                                                                  if ($fieldValue >= $futureDate) {

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

                                                                                                                                                                                              case 'not has changed':

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

                                                                                                                                                                                              case 'is empty':

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

                                                                                                                                                                                              case 'before':

                                                                                                                                                                                  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 'is today':

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

                                                                                                                                                                                                  $futureDate = date('Y-m-d', strtotime('+' . $value . ' days'));

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

                                                                                                                                                                                              case 'days ago':

                                                                                                                                                                                  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 ($fieldValue == $olderDate) {

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

                                                                                                                                                                                                  return $fieldValue <= $value;

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

                                                                                                                                                                                                  if (preg_match('/([^:]+):boolean$/', $value, $match)) {

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

                                                                                                                                                                                                  return $this->startsWith($fieldValue, $value);

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

                                                                                                                                                                                                  $hasChanged = $recordModel->getPreviousValue($cond['fieldname']);

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

                                                                                                                                                                                                  return $fieldValue != $hasChanged;

                                                                                                                                                                                  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

                                                                                                                                                                                                  return false;

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

                                                                                                                                                                                                      return false;

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

                                                                                                                                                                                              case 'matches':

                                                                                                                                                                                  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

                                                                                                                                                                                                  if (false === $hasChanged) {

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

                                                                                                                                                                                                  $values = explode(',', $value);

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

                                                                                                                                                                                                  if ($olderDate <= $fieldValue && $fieldValue <= date('Y-m-d')) {

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

                                                                                                                                                                                                  if ($fieldValue == date('Y-m-d')) {

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

                                                                                                                                                                                                  $olderDate = date('Y-m-d', strtotime('-' . $value . ' days'));

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

                                                                                                                                                                                                  return false;

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

                                                                                                                                                                                                  if ($today <= $fieldValue && $fieldValue <= $futureDate) {

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

                                                                                                                                                                                              case 'in less than':

                                                                                                                                                                                  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

                                                                                                                                                                                                      return false;

                                                                                                                                                                                  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 ('true' == $value) {

                                                                                                                                                                                  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 \in_array($fieldValue, $value);

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

                                                                                                                                                                                                      return false;

                                                                                                                                                                                  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 ($fieldValue > $values[0] && $fieldValue < $values[1]) {

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

                                                                                                                                                                                                  if (empty($fieldValue) || empty($value)) {

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

                                                                                                                                                                                                  }

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

                                                                                                                                                                                                      $value = $match[1];

                                                                                                                                                                                  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

                                                                                                                                                                                              case 'less than days ago':

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

                                                                                                                                                                                                  return false;

                                                                                                                                                                                  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

                                                                                                                                                                                                  if ('datetime' === $dataType) {

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

                                                                                                                                                                                                  return false !== strpos($fieldValue, $value);

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

                                                                                                                                                                                              case 'ends with':

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

                                                                                                                                                                                              case 'after':

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

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

                                                                                                                                                                                                  }

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

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

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

                                                                                                                                                                                              case 'is':

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

                                                                                                                                                                                                      if ('true' == $value) {

                                                                                                                                                                                  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

                                                                                                                                                                                                      return false;

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

                                                                                                                                                                                                  if (empty($fieldValue)) {

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

                                                                                                                                                                                                      return false;

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

                                                                                                                                                                                                  if ($fieldValue <= $olderDate) {

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

                                                                                                                                                                                                  if (empty($fieldValue) || empty($value)) {

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

                                                                                                                                                                                                  return $fieldValue < $value;

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

                                                                                                                                                                                                          return 'off' === $fieldValue || 0 === $fieldValue || '0' === $fieldValue || '' === $fieldValue;

                                                                                                                                                                                  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 (empty($fieldValue)) {

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

                                                                                                                                                                                                      return false;

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

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

                                                                                                                                                                                              case 'in more than':

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

                                                                                                                                                                                                  return $fieldValue > $value;

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

                                                                                                                                                                                              case 'smallerthannow':

                                                                                                                                                                                  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 'contains':

                                                                                                                                                                                  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 false === strpos($fieldValue, $value);

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

                                                                                                                                                                                                  return false;

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

                                                                                                                                                                                                  return false;

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

                                                                                                                                                                                                  return false;

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

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

                                                                                                                                                                                                  return false;

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

                                                                                                                                                                                                      $value = $match[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

                                                                                                                                                                                                      return 'on' === $fieldValue || 1 === $fieldValue || '1' === $fieldValue;

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

                                                                                                                                                                                                  if (\is_array($value)) {

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

                                                                                                                                                                                                  if (empty($fieldValue)) {

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

                                                                                                                                                                                              case 'between':

                                                                                                                                                                                  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 'less than or equal to':

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

                                                                                                                                                                                                  if (\is_array($value)) {

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

                                                                                                                                                                                                  return preg_match($value, $fieldValue);

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

                                                                                                                                                                                                  if (empty($fieldValue)) {

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

                                                                                                                                                                                                  if ($fieldValue > $value) {

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

                                                                                                                                                                                                  return false;

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

                                                                                                                                                                                                  }

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

                                                                                                                                                                                                  $futureDate = date('Y-m-d', strtotime('+' . $value . ' days'));

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

                                                                                                                                                                                                  return false;

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

                                                                                                                                                                                                      return false;

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

                                                                                                                                                                                                      return false;

                                                                                                                                                                                  Line exceeds 120 characters; contains 121 characters
                                                                                                                                                                                  Open

                                                                                                                                                                                                  return ($recordModel->isNew() || false !== $oldValue) && $recordModel->get($cond['fieldname']) == $value;

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

                                                                                                                                                                                              case 'is Not Watching Record':

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

                                                                                                                                                                                              case 'is record 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

                                                                                                                                                                                                  $futureDate = date('Y-m-d', strtotime('+' . $value . ' days'));

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

                                                                                                                                                                                                  if (empty($rawFieldValue) || empty($value)) {

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

                                                                                                                                                                                              case 'more than hours later':

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

                                                                                                                                                                                                  if ($watchdog->isWatchingRecord()) {

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

                                                                                                                                                                                                  if ($watchdog->isWatchingRecord()) {

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

                                                                                                                                                                                                  && \in_array($recordModel->get($fieldName), App\RecordStatus::getStates($recordModel->getModule()->getName(), \App\RecordStatus::RECORD_STATE_CLOSED))

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

                                                                                                                                                                                                      return false;

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

                                                                                                                                                                                                      return false;

                                                                                                                                                                                  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

                                                                                                                                                                                              case 'is Watching Record':

                                                                                                                                                                                  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 'days later':

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

                                                                                                                                                                                                  if (empty($fieldValue) || empty($value)) {

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

                                                                                                                                                                                              case 'less than hours later':

                                                                                                                                                                                  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

                                                                                                                                                                                                  }

                                                                                                                                                                                  Line exceeds 120 characters; contains 166 characters
                                                                                                                                                                                  Open

                                                                                                                                                                                                  && \in_array($recordModel->get($fieldName), App\RecordStatus::getStates($recordModel->getModule()->getName(), \App\RecordStatus::RECORD_STATE_CLOSED))

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

                                                                                                                                                                                                  //Unexpected condition

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

                                                                                                                                                                                                  if ($olderDateTime <= $rawFieldValue && $rawFieldValue <= $currentTime) {

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

                                                                                                                                                                                                  return false;

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

                                                                                                                                                                                                  $watchdog = Vtiger_Watchdog_Model::getInstanceById($recordModel->getId(), $recordModel->getModuleName());

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

                                                                                                                                                                                              default:

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

                                                                                                                                                                                              case 'less than hours before':

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

                                                                                                                                                                                  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 (int) $value === \App\User::getCurrentUserId() ? false : true;

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

                                                                                                                                                                                                  if (

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

                                                                                                                                                                                                      ($fieldName = App\RecordStatus::getFieldName($recordModel->getModule()->getName()))

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

                                                                                                                                                                                                  return $recordModel->get($fieldInstance->getName()) !== $recordModel->get('created_user_id');

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

                                                                                                                                                                                                  throw new \App\Exceptions\AppException('Found an unexpected condition: ' . $condition);

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

                                                                                                                                                                                                  }

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

                                                                                                                                                                                                  $futureDateTime = date('Y-m-d H:i:s', strtotime('+' . $value . ' hours'));

                                                                                                                                                                                  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 (empty($rawFieldValue) || empty($value)) {

                                                                                                                                                                                  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 'has changed to':

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

                                                                                                                                                                                                  }

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

                                                                                                                                                                                                  && \in_array($recordModel->get($fieldName), App\RecordStatus::getStates($recordModel->getModule()->getName(), \App\RecordStatus::RECORD_STATE_OPEN))

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

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

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

                                                                                                                                                                                                  $olderDateTime = date('Y-m-d H:i:s', strtotime('-' . $value . ' hours'));

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

                                                                                                                                                                                                  if ($currentTime <= $rawFieldValue && $rawFieldValue <= $futureDateTime) {

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

                                                                                                                                                                                                  }

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

                                                                                                                                                                                                  $watchdog = Vtiger_Watchdog_Model::getInstanceById($recordModel->getId(), $recordModel->getModuleName());

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

                                                                                                                                                                                              case 'nom':

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

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

                                                                                                                                                                                                  if (empty($rawFieldValue) || empty($value)) {

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

                                                                                                                                                                                                  if ($rawFieldValue >= $futureDateTime) {

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

                                                                                                                                                                                                  return false;

                                                                                                                                                                                  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 'not created by owner':

                                                                                                                                                                                  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

                                                                                                                                                                                                      return false;

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

                                                                                                                                                                                                  $olderDateTime = date('Y-m-d H:i:s', strtotime('-' . $value . ' hours'));

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

                                                                                                                                                                                                  return false;

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

                                                                                                                                                                                                      return false;

                                                                                                                                                                                  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 (

                                                                                                                                                                                  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

                                                                                                                                                                                                  $oldValue = $recordModel->getPreviousValue($cond['fieldname']);

                                                                                                                                                                                  Line exceeds 120 characters; contains 121 characters
                                                                                                                                                                                  Open

                                                                                                                                                                                                  $watchdog = Vtiger_Watchdog_Model::getInstanceById($recordModel->getId(), $recordModel->getModuleName());

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

                                                                                                                                                                                                  return false;

                                                                                                                                                                                  Line exceeds 120 characters; contains 121 characters
                                                                                                                                                                                  Open

                                                                                                                                                                                                  $watchdog = Vtiger_Watchdog_Model::getInstanceById($recordModel->getId(), $recordModel->getModuleName());

                                                                                                                                                                                  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

                                                                                                                                                                                                      ($fieldName = App\RecordStatus::getFieldName($recordModel->getModule()->getName()))

                                                                                                                                                                                  Line exceeds 120 characters; contains 164 characters
                                                                                                                                                                                  Open

                                                                                                                                                                                                  && \in_array($recordModel->get($fieldName), App\RecordStatus::getStates($recordModel->getModule()->getName(), \App\RecordStatus::RECORD_STATE_OPEN))

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

                                                                                                                                                                                                  if (empty($rawFieldValue) || empty($value)) {

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

                                                                                                                                                                                                      return false;

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

                                                                                                                                                                                                  if ($fieldValue == $futureDate) {

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

                                                                                                                                                                                                      return false;

                                                                                                                                                                                  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

                                                                                                                                                                                              case 'om':

                                                                                                                                                                                  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

                                                                                                                                                                                                      return true;

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

                                                                                                                                                                                                  return false;

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

                                                                                                                                                                                                  return (int) $value !== \App\User::getCurrentUserId() ? false : true;

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

                                                                                                                                                                                              case 'is record closed':

                                                                                                                                                                                  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

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

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

                                                                                                                                                                                              case 'more than hours before':

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

                                                                                                                                                                                                  if ($rawFieldValue <= $olderDateTime) {

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

                                                                                                                                                                                                  $futureDateTime = date('Y-m-d H:i:s', strtotime('+' . $value . ' hours'));

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

                                                                                                                                                                                                  return ($recordModel->isNew() || false !== $oldValue) && $recordModel->get($cond['fieldname']) == $value;

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

                                                                                                                                                                                                  }

                                                                                                                                                                                  Line indented incorrectly; expected 12 spaces, found 16
                                                                                                                                                                                  Open

                                                                                                                                                                                                  case 'accountName':

                                                                                                                                                                                  Line indented incorrectly; expected 12 spaces, found 16
                                                                                                                                                                                  Open

                                                                                                                                                                                                  case 'datetime':

                                                                                                                                                                                  Line indented incorrectly; expected 16 spaces, found 20
                                                                                                                                                                                  Open

                                                                                                                                                                                                      if (\count($recordData) > 1) {

                                                                                                                                                                                  Line indented incorrectly; expected 16 spaces, found 20
                                                                                                                                                                                  Open

                                                                                                                                                                                                      }

                                                                                                                                                                                  Line indented incorrectly; expected 24 spaces, found 28
                                                                                                                                                                                  Open

                                                                                                                                                                                                              case 'contains':

                                                                                                                                                                                  Line indented incorrectly; expected 8 spaces, found 12
                                                                                                                                                                                  Open

                                                                                                                                                                                              }

                                                                                                                                                                                  Line indented incorrectly; expected 16 spaces, found 20
                                                                                                                                                                                  Open

                                                                                                                                                                                                      if ('is' === $condition || 'is not' === $condition) {

                                                                                                                                                                                  Line indented incorrectly; expected 12 spaces, found 16
                                                                                                                                                                                  Open

                                                                                                                                                                                                  case 'owner':

                                                                                                                                                                                  Line indented incorrectly; expected 32 spaces, found 36
                                                                                                                                                                                  Open

                                                                                                                                                                                                                      if (!\in_array($val, $value)) {

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

                                                                                                                                                                                              }

                                                                                                                                                                                  Line indented incorrectly; expected 12 spaces, found 16
                                                                                                                                                                                  Open

                                                                                                                                                                                                  case 'date':

                                                                                                                                                                                  Line indented incorrectly; expected 24 spaces, found 28
                                                                                                                                                                                  Open

                                                                                                                                                                                                              case 'does not contain hierarchy':

                                                                                                                                                                                  Line indented incorrectly; expected 12 spaces, found 16
                                                                                                                                                                                  Open

                                                                                                                                                                                                  case 'sharedOwner':

                                                                                                                                                                                  Line indented incorrectly; expected 16 spaces, found 20
                                                                                                                                                                                  Open

                                                                                                                                                                                                      if (\in_array($condition, ['contains', 'contains hierarchy', 'does not contain', 'does not contain hierarchy', 'is', 'is not'])) {

                                                                                                                                                                                  Line indented incorrectly; expected 20 spaces, found 24
                                                                                                                                                                                  Open

                                                                                                                                                                                                          switch ($condition) {

                                                                                                                                                                                  Line indented incorrectly; expected 28 spaces, found 32
                                                                                                                                                                                  Open

                                                                                                                                                                                                                  }

                                                                                                                                                                                  Line indented incorrectly; expected 28 spaces, found 32
                                                                                                                                                                                  Open

                                                                                                                                                                                                                  foreach ($fieldValue as $val) {

                                                                                                                                                                                  Line indented incorrectly; expected 24 spaces, found 28
                                                                                                                                                                                  Open

                                                                                                                                                                                                              case 'does not contain':

                                                                                                                                                                                  Line indented incorrectly; expected 20 spaces, found 24
                                                                                                                                                                                  Open

                                                                                                                                                                                                          }

                                                                                                                                                                                  Line indented incorrectly; expected 28 spaces, found 32
                                                                                                                                                                                  Open

                                                                                                                                                                                                                  }

                                                                                                                                                                                  Line indented incorrectly; expected 16 spaces, found 20
                                                                                                                                                                                  Open

                                                                                                                                                                                                      if ('is' === $condition || 'is not' === $condition) {

                                                                                                                                                                                  Line indented incorrectly; expected 12 spaces, found 16
                                                                                                                                                                                  Open

                                                                                                                                                                                                  default:

                                                                                                                                                                                  Line indented incorrectly; expected 12 spaces, found 16
                                                                                                                                                                                  Open

                                                                                                                                                                                                  case 'time':

                                                                                                                                                                                  Line indented incorrectly; expected 24 spaces, found 28
                                                                                                                                                                                  Open

                                                                                                                                                                                                              case 'is':

                                                                                                                                                                                  Line indented incorrectly; expected 32 spaces, found 36
                                                                                                                                                                                  Open

                                                                                                                                                                                                                      }

                                                                                                                                                                                  Line indented incorrectly; expected 32 spaces, found 36
                                                                                                                                                                                  Open

                                                                                                                                                                                                                      }

                                                                                                                                                                                  Line indented incorrectly; expected 16 spaces, found 20
                                                                                                                                                                                  Open

                                                                                                                                                                                                      }

                                                                                                                                                                                  Line indented incorrectly; expected 24 spaces, found 28
                                                                                                                                                                                  Open

                                                                                                                                                                                                              default:

                                                                                                                                                                                  Line indented incorrectly; expected 20 spaces, found 24
                                                                                                                                                                                  Open

                                                                                                                                                                                                          if (false !== strpos($value, ',')) {

                                                                                                                                                                                  Line indented incorrectly; expected 20 spaces, found 24
                                                                                                                                                                                  Open

                                                                                                                                                                                                          } else {

                                                                                                                                                                                  Line indented incorrectly; expected 16 spaces, found 20
                                                                                                                                                                                  Open

                                                                                                                                                                                                      }

                                                                                                                                                                                  Line indented incorrectly; expected 12 spaces, found 16
                                                                                                                                                                                  Open

                                                                                                                                                                                                  case 'reference':

                                                                                                                                                                                  Line indented incorrectly; expected 28 spaces, found 32
                                                                                                                                                                                  Open

                                                                                                                                                                                                                  }

                                                                                                                                                                                  Line indented incorrectly; expected 16 spaces, found 20
                                                                                                                                                                                  Open

                                                                                                                                                                                                      }

                                                                                                                                                                                  Line indented incorrectly; expected 12 spaces, found 16
                                                                                                                                                                                  Open

                                                                                                                                                                                                  case 'multiReferenceValue':

                                                                                                                                                                                  Line indented incorrectly; expected 20 spaces, found 24
                                                                                                                                                                                  Open

                                                                                                                                                                                                          } elseif ($value) {

                                                                                                                                                                                  Line indented incorrectly; expected 24 spaces, found 28
                                                                                                                                                                                  Open

                                                                                                                                                                                                              case 'contains hierarchy':

                                                                                                                                                                                  Line indented incorrectly; expected 16 spaces, found 20
                                                                                                                                                                                  Open

                                                                                                                                                                                                      }

                                                                                                                                                                                  Line indented incorrectly; expected 28 spaces, found 32
                                                                                                                                                                                  Open

                                                                                                                                                                                                                  if (!empty($value)) {

                                                                                                                                                                                  Line indented incorrectly; expected 32 spaces, found 36
                                                                                                                                                                                  Open

                                                                                                                                                                                                                      if (\in_array($val, $value)) {

                                                                                                                                                                                  Line indented incorrectly; expected 20 spaces, found 24
                                                                                                                                                                                  Open

                                                                                                                                                                                                          }

                                                                                                                                                                                  Line indented incorrectly; expected 16 spaces, found 20
                                                                                                                                                                                  Open

                                                                                                                                                                                                      if ('between' !== $condition && strtotime($value)) {

                                                                                                                                                                                  Line indented incorrectly; expected 12 spaces, found 16
                                                                                                                                                                                  Open

                                                                                                                                                                                                  case 'categoryMultipicklist':

                                                                                                                                                                                  Line indented incorrectly; expected 28 spaces, found 32
                                                                                                                                                                                  Open

                                                                                                                                                                                                                  }

                                                                                                                                                                                  Line indented incorrectly; expected 24 spaces, found 28
                                                                                                                                                                                  Open

                                                                                                                                                                                                              case 'is not':

                                                                                                                                                                                  Line indented incorrectly; expected 28 spaces, found 32
                                                                                                                                                                                  Open

                                                                                                                                                                                                                  if (!empty($value)) {

                                                                                                                                                                                  Line indented incorrectly; expected 28 spaces, found 32
                                                                                                                                                                                  Open

                                                                                                                                                                                                                  foreach ($fieldValue as $val) {

                                                                                                                                                                                  Expected 0 spaces after opening bracket; newline found
                                                                                                                                                                                  Open

                                                                                                                                                                                                  if (

                                                                                                                                                                                  Expected 0 spaces after opening bracket; newline found
                                                                                                                                                                                  Open

                                                                                                                                                                                                  if (

                                                                                                                                                                                  There are no issues that match your filters.

                                                                                                                                                                                  Category
                                                                                                                                                                                  Status