YetiForceCompany/YetiForceCRM

View on GitHub
modules/Calendar/models/Module.php

Summary

Maintainability
D
1 day
Test Coverage
F
54%

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

class Calendar_Module_Model extends Vtiger_Module_Model
{
    /** {@inheritdoc} */
    public $allowTypeChange = false;

Severity: Minor
Found in modules/Calendar/models/Module.php by phpmd

File Module.php has 282 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
Severity: Minor
Found in modules/Calendar/models/Module.php - About 2 hrs to fix

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

        public static function getCalendarState($data = [])
        {
            if ($data) {
                $activityStatus = $data['activitystatus'];
                if (\in_array($activityStatus, self::getComponentActivityStateLabel('history'))) {
    Severity: Minor
    Found in modules/Calendar/models/Module.php - About 1 hr to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function getComponentActivityStateLabel has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function getComponentActivityStateLabel($key = '')
        {
            $pickListValues = App\Fields\Picklist::getValuesName('activitystatus');
            if (!\is_array($pickListValues)) {
                return [];
    Severity: Minor
    Found in modules/Calendar/models/Module.php - About 1 hr to fix

    Cognitive Complexity

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

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

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

    Further reading

    Method getComponentActivityStateLabel has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function getComponentActivityStateLabel($key = '')
        {
            $pickListValues = App\Fields\Picklist::getValuesName('activitystatus');
            if (!\is_array($pickListValues)) {
                return [];
    Severity: Minor
    Found in modules/Calendar/models/Module.php - About 1 hr to fix

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

          public static function getCalendarState($data = [])
          {
              if ($data) {
                  $activityStatus = $data['activitystatus'];
                  if (\in_array($activityStatus, self::getComponentActivityStateLabel('history'))) {
      Severity: Minor
      Found in modules/Calendar/models/Module.php - About 1 hr to fix

        Method getSideBarLinks has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getSideBarLinks($linkParams)
            {
                $links = Vtiger_Link_Model::getAllByType($this->getId(), ['SIDEBARLINK', 'SIDEBARWIDGET'], $linkParams);
                $links['SIDEBARLINK'][] = Vtiger_Link_Model::getInstanceFromValues([
                    'linktype' => 'SIDEBARLINK',
        Severity: Minor
        Found in modules/Calendar/models/Module.php - About 1 hr to fix

          Method importICS has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function importICS(string $filePath)
              {
                  $userId = \App\User::getCurrentUserRealId();
                  $lastImport = new ICalLastImport();
                  $lastImport->clearRecords($userId);
          Severity: Minor
          Found in modules/Calendar/models/Module.php - About 1 hr to fix

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

                public function getFieldsByType($type, bool $active = false): array
                {
                    $restrictedField = ['picklist' => ['activitystatus', 'visibility', 'duration_minutes']];
                    if (!\is_array($type)) {
                        $type = [$type];
            Severity: Minor
            Found in modules/Calendar/models/Module.php - About 55 mins to fix

            Cognitive Complexity

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

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

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

            Further reading

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

                public function setEventFieldsForExport()
                {
                    $keysToReplace = ['taskpriority'];
                    $keysValuesToReplace = ['taskpriority' => 'priority'];
                    foreach ($this->getFields() as $fieldName => $fieldModel) {
            Severity: Minor
            Found in modules/Calendar/models/Module.php - About 35 mins to fix

            Cognitive Complexity

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

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

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

            Further reading

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

                public function setTodoFieldsForExport()
                {
                    $keysToReplace = ['taskpriority', 'activitystatus'];
                    $keysValuesToReplace = ['taskpriority' => 'priority', 'activitystatus' => 'status'];
                    foreach ($this->getFields() as $fieldName => $fieldModel) {
            Severity: Minor
            Found in modules/Calendar/models/Module.php - About 35 mins to fix

            Cognitive Complexity

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

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

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

            Further reading

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

                public function importICS(string $filePath)
                {
                    $userId = \App\User::getCurrentUserRealId();
                    $lastImport = new ICalLastImport();
                    $lastImport->clearRecords($userId);
            Severity: Minor
            Found in modules/Calendar/models/Module.php - About 35 mins to fix

            Cognitive Complexity

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

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

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

            Further reading

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

                public static function getCalendarState($data = [])
                {
                    if ($data) {
                        $activityStatus = $data['activitystatus'];
                        if (\in_array($activityStatus, self::getComponentActivityStateLabel('history'))) {
            Severity: Minor
            Found in modules/Calendar/models/Module.php by phpmd

            CyclomaticComplexity

            Since: 0.1

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

            Example

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

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

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

                public static function getComponentActivityStateLabel($key = '')
                {
                    $pickListValues = App\Fields\Picklist::getValuesName('activitystatus');
                    if (!\is_array($pickListValues)) {
                        return [];
            Severity: Minor
            Found in modules/Calendar/models/Module.php by phpmd

            CyclomaticComplexity

            Since: 0.1

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

            Example

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

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

            Avoid using undefined variables such as '$todoFields' which will lead to PHP notices.
            Open

                                $todoFields[$fieldName] = 'yes';
            Severity: Minor
            Found in modules/Calendar/models/Module.php by phpmd

            UndefinedVariable

            Since: 2.8.0

            Detects when a variable is used that has not been defined before.

            Example

            class Foo
            {
                private function bar()
                {
                    // $message is undefined
                    echo $message;
                }
            }

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

            Avoid using undefined variables such as '$eventFields' which will lead to PHP notices.
            Open

                                $eventFields[$fieldName] = 'yes';
            Severity: Minor
            Found in modules/Calendar/models/Module.php by phpmd

            UndefinedVariable

            Since: 2.8.0

            Detects when a variable is used that has not been defined before.

            Example

            class Foo
            {
                private function bar()
                {
                    // $message is undefined
                    echo $message;
                }
            }

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

            Avoid using undefined variables such as '$todoFields' which will lead to PHP notices.
            Open

                    $this->set('todoFields', $todoFields);
            Severity: Minor
            Found in modules/Calendar/models/Module.php by phpmd

            UndefinedVariable

            Since: 2.8.0

            Detects when a variable is used that has not been defined before.

            Example

            class Foo
            {
                private function bar()
                {
                    // $message is undefined
                    echo $message;
                }
            }

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

            Avoid using undefined variables such as '$eventFields' which will lead to PHP notices.
            Open

                    $this->set('eventFields', $eventFields);
            Severity: Minor
            Found in modules/Calendar/models/Module.php by phpmd

            UndefinedVariable

            Since: 2.8.0

            Detects when a variable is used that has not been defined before.

            Example

            class Foo
            {
                private function bar()
                {
                    // $message is undefined
                    echo $message;
                }
            }

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

            Avoid using undefined variables such as '$todoFields' which will lead to PHP notices.
            Open

                                $todoFields[$keysValuesToReplace[$fieldName]] = 'yes';
            Severity: Minor
            Found in modules/Calendar/models/Module.php by phpmd

            UndefinedVariable

            Since: 2.8.0

            Detects when a variable is used that has not been defined before.

            Example

            class Foo
            {
                private function bar()
                {
                    // $message is undefined
                    echo $message;
                }
            }

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

            Avoid using undefined variables such as '$eventFields' which will lead to PHP notices.
            Open

                                $eventFields[$keysValuesToReplace[$fieldName]] = 'yes';
            Severity: Minor
            Found in modules/Calendar/models/Module.php by phpmd

            UndefinedVariable

            Since: 2.8.0

            Detects when a variable is used that has not been defined before.

            Example

            class Foo
            {
                private function bar()
                {
                    // $message is undefined
                    echo $message;
                }
            }

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

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

            class Calendar_Module_Model extends Vtiger_Module_Model
            {
                /** {@inheritdoc} */
                public $allowTypeChange = false;
            
            
            Severity: Minor
            Found in modules/Calendar/models/Module.php by phpmd

            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 '375', column '23').
            Open

                            $lastImport = new ICalLastImport();
            Severity: Minor
            Found in modules/Calendar/models/Module.php by phpmd

            MissingImport

            Since: 2.7.0

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

            Example

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

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

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

                    return (new App\Db\Query())->select(['vtiger_activity.*', 'vtiger_crmentity.description', 'assigned_user_id' => 'vtiger_crmentity.smownerid', 'vtiger_activity_reminder.reminder_time'])
            Severity: Minor
            Found in modules/Calendar/models/Module.php by phpmd

            MissingImport

            Since: 2.7.0

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

            Example

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

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

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

                public function getFieldsByType($type, bool $active = false): array
            Severity: Minor
            Found in modules/Calendar/models/Module.php by phpmd

            BooleanArgumentFlag

            Since: 1.4.0

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

            Example

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

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

            Missing class import via use statement (line '183', column '18').
            Open

                        $query = (new \App\Db\Query())
            Severity: Minor
            Found in modules/Calendar/models/Module.php by phpmd

            MissingImport

            Since: 2.7.0

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

            Example

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

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

            Missing class import via use statement (line '358', column '21').
            Open

                    $lastImport = new ICalLastImport();
            Severity: Minor
            Found in modules/Calendar/models/Module.php by phpmd

            MissingImport

            Since: 2.7.0

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

            Example

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

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

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

                            $date = new DateTimeField($date);
            Severity: Minor
            Found in modules/Calendar/models/Module.php by phpmd

            MissingImport

            Since: 2.7.0

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

            Example

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

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

            Avoid using static access to class 'Vtiger_Link_Model' in method 'getSideBarLinks'.
            Open

                    $links['SIDEBARLINK'][] = Vtiger_Link_Model::getInstanceFromValues([
                        'linktype' => 'SIDEBARLINK',
                        'linklabel' => 'LBL_CALENDAR_VIEW',
                        'linkurl' => $this->getCalendarViewUrl(),
                        'linkicon' => 'fas fa-calendar-alt',
            Severity: Minor
            Found in modules/Calendar/models/Module.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                    if (isset($linkParams['ACTION']) && 'Calendar' === $linkParams['ACTION'] && App\Config::module('Calendar', 'SHOW_LIST_BUTTON')) {
            Severity: Minor
            Found in modules/Calendar/models/Module.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                        ->where(['vtiger_crmentity.deleted' => 0, 'vtiger_crmentity.smownerid' => App\User::getCurrentUserId()]);
            Severity: Minor
            Found in modules/Calendar/models/Module.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                        } else {
                            $module = $todoModule;
                        }
            Severity: Minor
            Found in modules/Calendar/models/Module.php by phpmd

            ElseExpression

            Since: 1.4.0

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

            Example

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

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

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

                            } else {
                                $eventFields[$keysValuesToReplace[$fieldName]] = 'yes';
                            }
            Severity: Minor
            Found in modules/Calendar/models/Module.php by phpmd

            ElseExpression

            Since: 1.4.0

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

            Example

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

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

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

                            $recordModels[] = Vtiger_Record_Model::getInstanceById($recordId, 'Calendar');
            Severity: Minor
            Found in modules/Calendar/models/Module.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                            } else {
                                $fieldList[$fieldName] = $field;
                            }
            Severity: Minor
            Found in modules/Calendar/models/Module.php by phpmd

            ElseExpression

            Since: 1.4.0

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

            Example

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

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

            Avoid using static access to class 'DateTimeField' in method 'getCalendarState'.
            Open

                            $dBFomatedDate = DateTimeField::convertToDBFormat($userFormatedString);
            Severity: Minor
            Found in modules/Calendar/models/Module.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                        } else {
                            ++$skipCount[$module];
                        }
            Severity: Minor
            Found in modules/Calendar/models/Module.php by phpmd

            ElseExpression

            Since: 1.4.0

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

            Example

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

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

            Avoid using static access to class 'Vtiger_Link_Model' in method 'getSideBarLinks'.
            Open

                    $links['SIDEBARLINK'][] = Vtiger_Link_Model::getInstanceFromValues([
                        'linktype' => 'SIDEBARLINK',
                        'linklabel' => 'LBL_RECORDS_LIST',
                        'linkurl' => $this->getListViewUrl(),
                        'linkicon' => 'fas fa-list',
            Severity: Minor
            Found in modules/Calendar/models/Module.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                        } else {
                            $state = $activityStatusLabels['not_started'];
                            if ($dates['end'] > $dates['current'] && $dates['start'] < $dates['current']) {
                                $state = $activityStatusLabels['in_realization'];
                            } elseif ($dates['end'] > $dates['current']) {
            Severity: Minor
            Found in modules/Calendar/models/Module.php by phpmd

            ElseExpression

            Since: 1.4.0

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

            Example

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

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

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

                            ->limit(\App\Config::module('Calendar', 'maxNumberCalendarNotifications', 20));
            Severity: Minor
            Found in modules/Calendar/models/Module.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

            Avoid using static access to class '\App\Utils\Kanban' in method 'getSideBarLinks'.
            Open

                    if ($this->isPermitted('Kanban') && \App\Utils\Kanban::getBoards($this->getName(), true)) {
            Severity: Minor
            Found in modules/Calendar/models/Module.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

            Avoid using static access to class 'Vtiger_Link_Model' in method 'getSideBarLinks'.
            Open

                        $links['SIDEBARLINK'][] = Vtiger_Link_Model::getInstanceFromValues([
                            'linktype' => 'SIDEBARLINK',
                            'linklabel' => 'LBL_VIEW_KANBAN',
                            'linkurl' => 'index.php?module=' . $this->getName() . '&view=Kanban',
                            'linkicon' => 'yfi yfi-kanban',
            Severity: Minor
            Found in modules/Calendar/models/Module.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

            Avoid using static access to class 'Users_Record_Model' in method 'getSettingLinks'.
            Open

                    $currentUserModel = Users_Record_Model::getCurrentUserModel();
            Severity: Minor
            Found in modules/Calendar/models/Module.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

            Avoid using static access to class '\App\Integrations\Dav\Calendar' in method 'importICS'.
            Open

                    $calendar = \App\Integrations\Dav\Calendar::loadFromContent(file_get_contents($filePath));
            Severity: Minor
            Found in modules/Calendar/models/Module.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                            } else {
                                $todoFields[$keysValuesToReplace[$fieldName]] = 'yes';
                            }
            Severity: Minor
            Found in modules/Calendar/models/Module.php by phpmd

            ElseExpression

            Since: 1.4.0

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

            Example

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

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

            Avoid using static access to class 'App\Fields\Picklist' in method 'getCalendarTypes'.
            Open

                    return App\Fields\Picklist::getValuesName('activitytype');
            Severity: Minor
            Found in modules/Calendar/models/Module.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

            Avoid using static access to class 'Users_Record_Model' in method 'getCalendarReminder'.
            Open

                    $currentUserModel = Users_Record_Model::getCurrentUserModel();
            Severity: Minor
            Found in modules/Calendar/models/Module.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                    $userId = \App\User::getCurrentUserRealId();
            Severity: Minor
            Found in modules/Calendar/models/Module.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

            Avoid using static access to class 'Vtiger_Link_Model' in method 'getSideBarLinks'.
            Open

                    $links = Vtiger_Link_Model::getAllByType($this->getId(), ['SIDEBARLINK', 'SIDEBARWIDGET'], $linkParams);
            Severity: Minor
            Found in modules/Calendar/models/Module.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

            Avoid using static access to class 'Vtiger_Link_Model' in method 'getSideBarLinks'.
            Open

                        $links['SIDEBARLINK'][] = Vtiger_Link_Model::getInstanceFromValues([
                            'linktype' => 'SIDEBARLINK',
                            'linklabel' => 'LBL_CALENDAR_LIST',
                            'linkurl' => 'javascript:Calendar_Calendar_Js.goToRecordsList("' . $this->getListViewUrl() . '");',
                            'linkicon' => 'far fa-calendar-minus',
            Severity: Minor
            Found in modules/Calendar/models/Module.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

            Avoid using static access to class 'App\Fields\Picklist' in method 'getComponentActivityStateLabel'.
            Open

                    $pickListValues = App\Fields\Picklist::getValuesName('activitystatus');
            Severity: Minor
            Found in modules/Calendar/models/Module.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

            Define a constant instead of duplicating this literal "Calendar" 6 times.
            Open

                    return 'Calendar';
            Severity: Critical
            Found in modules/Calendar/models/Module.php by sonar-php

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

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

            Noncompliant Code Example

            With the default threshold of 3:

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

            Compliant Solution

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

            Exceptions

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

            Define a constant instead of duplicating this literal "not_started" 3 times.
            Open

                            $state = $activityStatusLabels['not_started'];
            Severity: Critical
            Found in modules/Calendar/models/Module.php by sonar-php

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

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

            Noncompliant Code Example

            With the default threshold of 3:

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

            Compliant Solution

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

            Exceptions

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

            Define a constant instead of duplicating this literal "linkurl" 6 times.
            Open

                        'linkurl' => $this->getCalendarViewUrl(),
            Severity: Critical
            Found in modules/Calendar/models/Module.php by sonar-php

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

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

            Noncompliant Code Example

            With the default threshold of 3:

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

            Compliant Solution

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

            Exceptions

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

            Define a constant instead of duplicating this literal "vtiger_activity_reminder_popup.datetime" 4 times.
            Open

                            ->select(['recordid', 'vtiger_activity_reminder_popup.datetime'])
            Severity: Critical
            Found in modules/Calendar/models/Module.php by sonar-php

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

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

            Noncompliant Code Example

            With the default threshold of 3:

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

            Compliant Solution

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

            Exceptions

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

            Define a constant instead of duplicating this literal "current" 7 times.
            Open

                            ->where(['vtiger_crmentity.smownerid' => $currentUserModel->getId(), 'vtiger_crmentity.deleted' => 0, 'vtiger_activity.status' => self::getComponentActivityStateLabel('current')])
            Severity: Critical
            Found in modules/Calendar/models/Module.php by sonar-php

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

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

            Noncompliant Code Example

            With the default threshold of 3:

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

            Compliant Solution

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

            Exceptions

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

            Define a constant instead of duplicating this literal "linkicon" 6 times.
            Open

                        'linkicon' => 'fas fa-calendar-alt',
            Severity: Critical
            Found in modules/Calendar/models/Module.php by sonar-php

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

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

            Noncompliant Code Example

            With the default threshold of 3:

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

            Compliant Solution

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

            Exceptions

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

            Define a constant instead of duplicating this literal "linktype" 6 times.
            Open

                        'linktype' => 'SIDEBARLINK',
            Severity: Critical
            Found in modules/Calendar/models/Module.php by sonar-php

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

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

            Noncompliant Code Example

            With the default threshold of 3:

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

            Compliant Solution

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

            Exceptions

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

            Define a constant instead of duplicating this literal "linklabel" 6 times.
            Open

                        'linklabel' => 'LBL_CALENDAR_VIEW',
            Severity: Critical
            Found in modules/Calendar/models/Module.php by sonar-php

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

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

            Noncompliant Code Example

            With the default threshold of 3:

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

            Compliant Solution

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

            Exceptions

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

            Define a constant instead of duplicating this literal "activitystatus" 8 times.
            Open

                    $keysToReplace = ['taskpriority', 'activitystatus'];
            Severity: Critical
            Found in modules/Calendar/models/Module.php by sonar-php

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

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

            Noncompliant Code Example

            With the default threshold of 3:

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

            Compliant Solution

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

            Exceptions

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

            Define a constant instead of duplicating this literal "vtiger_crmentity.smownerid" 3 times.
            Open

                    return (new App\Db\Query())->select(['vtiger_activity.*', 'vtiger_crmentity.description', 'assigned_user_id' => 'vtiger_crmentity.smownerid', 'vtiger_activity_reminder.reminder_time'])
            Severity: Critical
            Found in modules/Calendar/models/Module.php by sonar-php

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

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

            Noncompliant Code Example

            With the default threshold of 3:

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

            Compliant Solution

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

            Exceptions

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

            Define a constant instead of duplicating this literal "index.php?module=" 3 times.
            Open

                    return 'index.php?module=' . $this->get('name') . '&view=' . $this->getDefaultViewName();
            Severity: Critical
            Found in modules/Calendar/models/Module.php by sonar-php

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

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

            Noncompliant Code Example

            With the default threshold of 3:

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

            Compliant Solution

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

            Exceptions

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

            Define a constant instead of duplicating this literal "taskpriority" 4 times.
            Open

                    $keysToReplace = ['taskpriority'];
            Severity: Critical
            Found in modules/Calendar/models/Module.php by sonar-php

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

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

            Noncompliant Code Example

            With the default threshold of 3:

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

            Compliant Solution

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

            Exceptions

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

            Define a constant instead of duplicating this literal "SIDEBARLINK" 9 times.
            Open

                    $links = Vtiger_Link_Model::getAllByType($this->getId(), ['SIDEBARLINK', 'SIDEBARWIDGET'], $linkParams);
            Severity: Critical
            Found in modules/Calendar/models/Module.php by sonar-php

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

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

            Noncompliant Code Example

            With the default threshold of 3:

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

            Compliant Solution

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

            Exceptions

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

            Avoid unused parameters such as '$where'.
            Open

                public function getExportQuery($focus = '', $where = '')
            Severity: Minor
            Found in modules/Calendar/models/Module.php by phpmd

            UnusedFormalParameter

            Since: 0.2

            Avoid passing parameters to methods or constructors and then not using those parameters.

            Example

            class Foo
            {
                private function bar($howdy)
                {
                    // $howdy is not used
                }
            }

            Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

            Avoid unused parameters such as '$focus'.
            Open

                public function getExportQuery($focus = '', $where = '')
            Severity: Minor
            Found in modules/Calendar/models/Module.php by phpmd

            UnusedFormalParameter

            Since: 0.2

            Avoid passing parameters to methods or constructors and then not using those parameters.

            Example

            class Foo
            {
                private function bar($howdy)
                {
                    // $howdy is not used
                }
            }

            Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

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

                        ->where(['vtiger_crmentity.deleted' => 0, 'vtiger_crmentity.smownerid' => App\User::getCurrentUserId()]);
            Severity: Critical
            Found in modules/Calendar/models/Module.php by phan

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

                            $date = new DateTimeField($date);
            Severity: Minor
            Found in modules/Calendar/models/Module.php by phan

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

                    return (new App\Db\Query())->select(['vtiger_activity.*', 'vtiger_crmentity.description', 'assigned_user_id' => 'vtiger_crmentity.smownerid', 'vtiger_activity_reminder.reminder_time'])
            Severity: Critical
            Found in modules/Calendar/models/Module.php by phan

            Reference to instance property name from undeclared class \Sabre\VObject\Component
            Open

                        if ('VEVENT' === (string) $calendar->getComponent()->name) {
            Severity: Minor
            Found in modules/Calendar/models/Module.php by phan

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

                                $todoFields[$keysValuesToReplace[$fieldName]] = 'yes';
            Severity: Info
            Found in modules/Calendar/models/Module.php by phan

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

                                $eventFields[$fieldName] = 'yes';
            Severity: Info
            Found in modules/Calendar/models/Module.php by phan

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

                                $todoFields[$fieldName] = 'yes';
            Severity: Info
            Found in modules/Calendar/models/Module.php by phan

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

                        $query = (new \App\Db\Query())
            Severity: Critical
            Found in modules/Calendar/models/Module.php by phan

            Saw unextractable annotation for comment '* @return <array>'</array>
            Open

                 * @return <Array>
            Severity: Info
            Found in modules/Calendar/models/Module.php by phan

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

                                $eventFields[$keysValuesToReplace[$fieldName]] = 'yes';
            Severity: Info
            Found in modules/Calendar/models/Module.php by phan

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

                    $userId = \App\User::getCurrentUserRealId();
            Severity: Critical
            Found in modules/Calendar/models/Module.php by phan

            Either remove or fill this block of code.
            Open

                            if ('picklist' == $fieldType && \in_array($fieldName, $restrictedField[$fieldType])) {
                            } else {

            Most of the time a block of code is empty when a piece of code is really missing. So such empty block must be either filled or removed.

            Noncompliant Code Example

            for ($i = 0; $i < 42; $i++){}  // Empty on purpose or missing piece of code ?
            

            Exceptions

            When a block contains a comment, this block is not considered to be empty.

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

                    $componentsActivityState = [];
            Severity: Minor
            Found in modules/Calendar/models/Module.php by phpmd

            LongVariable

            Since: 0.2

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

            Example

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

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

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

            class Calendar_Module_Model extends Vtiger_Module_Model

            The class Calendar_Module_Model is not named in CamelCase.
            Open

            class Calendar_Module_Model extends Vtiger_Module_Model
            {
                /** {@inheritdoc} */
                public $allowTypeChange = false;
            
            
            Severity: Minor
            Found in modules/Calendar/models/Module.php by phpmd

            CamelCaseClassName

            Since: 0.2

            It is considered best practice to use the CamelCase notation to name classes.

            Example

            class class_name {
            }

            Source

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

                public function getDetailViewUrl($id)
            Severity: Minor
            Found in modules/Calendar/models/Module.php by phpmd

            ShortVariable

            Since: 0.2

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

            Example

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

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

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

                /** {@inheritdoc} */

            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 string

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

                    $links['SIDEBARLINK'][] = Vtiger_Link_Model::getInstanceFromValues([

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

                 * @param mixed $focus

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

                /**

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

                                $todoFields[$fieldName] = 'yes';

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

                 * Function to get the url to view Details for the module.

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

                 *

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

                 */

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

                public function getDefaultViewName()

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

                public function getSideBarLinks($linkParams)

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

                    }

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

                            'linklabel' => 'LBL_VIEW_KANBAN',

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

                 *

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

                 */

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

                 *

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

                public function setEventFieldsForExport()

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

                 * @param mixed $id

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

                    return 'Calendar';

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

                /**

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

                 * Function to check whether the module is summary view supported.

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

                    return 'index.php?module=' . $this->getName() . '&view=ImportResult';

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

                    $this->set('eventFields', $eventFields);

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

                            if (!\in_array($fieldName, $keysToReplace)) {

            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

                    $links['SIDEBARLINK'][] = Vtiger_Link_Model::getInstanceFromValues([

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

                        'linktype' => 'SIDEBARLINK',

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

                    ]);

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

                 * @return string query;

            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

                            } else {

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

                        }

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

                {

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

                {

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

                    ]);

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

                        'linkurl' => $this->getListViewUrl(),

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

                            'linkicon' => 'yfi yfi-kanban',

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

                public function getImportResultUrl()

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

                 * @param mixed $where

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

                        ->where(['vtiger_crmentity.deleted' => 0, 'vtiger_crmentity.smownerid' => App\User::getCurrentUserId()]);

            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

                            } 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

                 * @return string - url

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

                 * Function returns the default view for the Calendar module.

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

                 *  Function returns the url for Calendar view.

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

                }

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

                /** {@inheritdoc} */

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

                        'linklabel' => 'LBL_CALENDAR_VIEW',

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

                        'linkurl' => $this->getCalendarViewUrl(),

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

                            'linktype' => 'SIDEBARLINK',

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

                            'linkurl' => 'index.php?module=' . $this->getName() . '&view=Kanban',

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

                    return $links;

            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

                            'linkicon' => 'far fa-calendar-minus',

            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

                        ->from('vtiger_activity')

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

                                $eventFields[$fieldName] = 'yes';

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

                                $eventFields[$keysValuesToReplace[$fieldName]] = 'yes';

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

                    $keysValuesToReplace = ['taskpriority' => 'priority', 'activitystatus' => 'status'];

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

                        if ($fieldModel->getPermissions()) {

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

                    $keysToReplace = ['taskpriority'];

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

                public function getDetailViewUrl($id)

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

                }

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

                        'linkicon' => 'fas fa-list',

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

                    if (isset($linkParams['ACTION']) && 'Calendar' === $linkParams['ACTION'] && App\Config::module('Calendar', 'SHOW_LIST_BUTTON')) {

            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 getExportQuery($focus = '', $where = '')

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

                    $keysValuesToReplace = ['taskpriority' => 'priority'];

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

                    foreach ($this->getFields() as $fieldName => $fieldModel) {

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

                        }

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

                 * Function to set todo fields for export.

            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 'index.php?module=' . $this->get('name') . '&view=' . $this->getDefaultViewName();

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

                 */

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

                    $links = Vtiger_Link_Model::getAllByType($this->getId(), ['SIDEBARLINK', 'SIDEBARWIDGET'], $linkParams);

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

                        'linklabel' => 'LBL_RECORDS_LIST',

            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

                            'linkurl' => 'javascript:Calendar_Calendar_Js.goToRecordsList("' . $this->getListViewUrl() . '");',

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

                }

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

                        ->innerJoin('vtiger_crmentity', 'vtiger_activity.activityid = vtiger_crmentity.crmid')

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

                    $this->set('todoFields', $todoFields);

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

                public function isSummaryViewSupported()

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

                        $links['SIDEBARLINK'][] = Vtiger_Link_Model::getInstanceFromValues([

            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

                 * Function returns the url that shows Calendar Import 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

                {

            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

                    $keysToReplace = ['taskpriority', 'activitystatus'];

            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 'index.php?module=Calendar&view=' . $this->getDetailViewName() . '&record=' . $id;

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

                public $allowTypeChange = false;

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

                 * @return string url

            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 (new App\Db\Query())->select(['vtiger_activity.*', 'vtiger_crmentity.description', 'assigned_user_id' => 'vtiger_crmentity.smownerid', 'vtiger_activity_reminder.reminder_time'])

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

                    foreach ($this->getFields() as $fieldName => $fieldModel) {

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

                            }

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

                        'linkicon' => 'fas fa-calendar-alt',

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

                        $links['SIDEBARLINK'][] = Vtiger_Link_Model::getInstanceFromValues([

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

                public function setTodoFieldsForExport()

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

                    }

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

                }

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

                 * @return string

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

                public function getCalendarViewUrl()

            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

                            'linklabel' => 'LBL_CALENDAR_LIST',

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

                    if ($this->isPermitted('Kanban') && \App\Utils\Kanban::getBoards($this->getName(), 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

                 * Function to get export query.

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

                        if ($fieldModel->getPermissions()) {

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

                            if (!\in_array($fieldName, $keysToReplace)) {

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

                                $todoFields[$keysValuesToReplace[$fieldName]] = 'yes';

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

                /**

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

                 * Function to get Alphabet Search Field.

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

                 * @return \Calendar_Record_Model[]

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

                    if (!empty($activityReminder)) {

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

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

                {

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

                    $fieldList = [];

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

            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

                        $startDateTime = $data['date_start'] . ' ' . $data['time_start'];

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

                        $activityStatusLabels = self::getComponentActivityStateLabel();

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

                                $state = $activityStatusLabels['in_realization'];

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

                        }

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

                    }

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

                 *

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

                    if (!\is_array($pickListValues)) {

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

                        return [];

            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

                        'linktype' => 'SIDEBARLINK',

            Line exceeds 120 characters; contains 137 characters
            Open

                    if (isset($linkParams['ACTION']) && 'Calendar' === $linkParams['ACTION'] && App\Config::module('Calendar', 'SHOW_LIST_BUTTON')) {

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

                            'linktype' => 'SIDEBARLINK',

            Line exceeds 120 characters; contains 192 characters
            Open

                    return (new App\Db\Query())->select(['vtiger_activity.*', 'vtiger_crmentity.description', 'assigned_user_id' => 'vtiger_crmentity.smownerid', 'vtiger_activity_reminder.reminder_time'])

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

                        ->leftJoin('vtiger_activity_reminder', 'vtiger_activity_reminder.activity_id = vtiger_activity.activityid')

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

                 * Function to set event fields for export.

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

                            }

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

                            'linkicon' => 'adminIcon-modules-fields',

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

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

                    foreach ($pickListValues as $value) {

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

                            ->limit(\App\Config::module('Calendar', 'maxNumberCalendarNotifications', 20));

            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

                /** {@inheritdoc} */

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

                    return $settingLinks;

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

                 * Function to get orderby sql from orderby field.

            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($data['activitystatus']) && isset($activityStatusLabels[$data['activitystatus']])) {

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

                }

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

                 * The function gets the labels for a given status field.

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

                    return $componentsActivityState;

            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 ($calendar->getRecordInstance() as $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

                    $activityReminder = $currentUserModel->getCurrentUserActivityReminderInSeconds();

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

                        $type = [$type];

            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

                    $settingLinks = [];

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

                        if (\in_array($activityStatus, self::getComponentActivityStateLabel('history'))) {

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

                        $dates = ['start' => $startDateTime, 'end' => $dueDateTime, 'current' => null];

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

                        foreach ($dates as $key => $date) {

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

                            $state = $activityStatusLabels['not_started'];

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

                                break;

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

                 * @param string $filePath

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

                    $lastImport->clearRecords($userId);

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

                    $calendar = \App\Integrations\Dav\Calendar::loadFromContent(file_get_contents($filePath));

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

                            ++$skipCount[$module];

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

                public function getAlphabetSearchField()

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

                        $query = (new \App\Db\Query())

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

                            ->from('vtiger_activity_reminder_popup')

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

                            ->innerJoin('vtiger_activity', 'vtiger_activity_reminder_popup.recordid = vtiger_activity.activityid')

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

                public function getSettingLinks(): array

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

                    $currentUserModel = Users_Record_Model::getCurrentUserModel();

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

                        $settingLinks[] = [

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

                            'linklabel' => 'LBL_EDIT_FIELDS',

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

                public function getOrderBySql($orderBy)

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

                            $userFormatedString = $date->getDisplayDate();

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

                                $componentsActivityState['not_started'] = $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

                        $componentsActivityState = ['PLL_COMPLETED', 'PLL_POSTPONED', 'PLL_CANCELLED'];

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

                /**

            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

                        if ('VEVENT' === (string) $calendar->getComponent()->name) {

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

                            ++$totalCount[$module];

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

                    return 'subject';

            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 ('status' == $orderBy) {

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

                    if ($data) {

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

                            $date = new DateTimeField($date);

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

                            $dates[$key] = strtotime($dBFomatedDate . ' ' . $timeFormatedString);

            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

                                $componentsActivityState['postponed'] = $value;

            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

                    } elseif ('history' == $key) {

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

                }

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

                    $todoModule = 'Calendar';

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

                        } else {

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

                    }

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

                {

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

                            'linktype' => 'LISTVIEWSETTING',

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

                            'linkicon' => 'adminIcon-fields-picklists',

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

                /**

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

                public static function getComponentActivityStateLabel($key = '')

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

                    }

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

                                $componentsActivityState['in_realization'] = $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

                        $componentsActivityState = ['PLL_PLANNED', 'PLL_IN_REALIZATION', 'PLL_OVERDUE'];

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

                 * Import calendar rekords from ICS.

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

                 *

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

                    $userId = \App\User::getCurrentUserRealId();

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

                        $recordModel->set('assigned_user_id', $userId);

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

                            $module = $todoModule;

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

                        $time = date('Y-m-d H:i:s', strtotime("+$activityReminder seconds"));

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

                            ->andWhere(['or', ['and', ['vtiger_activity_reminder_popup.status' => Calendar_Record_Model::REMNDER_POPUP_ACTIVE], ['<=', 'vtiger_activity_reminder_popup.datetime', $time]], ['and', ['vtiger_activity_reminder_popup.status' => Calendar_Record_Model::REMNDER_POPUP_WAIT], ['<=', 'vtiger_activity_reminder_popup.datetime', date('Y-m-d H:i:s')]]])

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

                            ->orderBy(['vtiger_activity_reminder_popup.datetime' => SORT_DESC])

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

                /** {@inheritdoc} */

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

                        if (\in_array($fieldType, $type)) {

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

                            $fieldName = $field->getName();

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

                            'linktype' => 'LISTVIEWSETTING',

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

                            'linkurl' => 'index.php?parent=Settings&module=LayoutEditor&sourceModule=' . $this->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

                    $pickListValues = App\Fields\Picklist::getValuesName('activitystatus');

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

                    $eventModule = 'Events';

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

                            $lastImport->setFields(['userid' => $userId, 'entitytype' => $this->getName(), 'crmid' => $recordModel->getId()]);

            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

                            'linklabel' => 'LBL_EDIT_PICKLIST_VALUES',

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

                 * @param mixed $orderBy

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

                {

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

                public static function getCalendarState($data = [])

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

                            $dBFomatedDate = DateTimeField::convertToDBFormat($userFormatedString);

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

                            $state = $activityStatusLabels[$data['activitystatus']];

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

                            case 'PLL_PLANNED':

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

                                $componentsActivityState['overdue'] = $value;

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

                            case 'PLL_CANCELLED':

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

                                break;

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

                 *

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

                    return ['events' => $totalCount[$eventModule] - $skipCount[$eventModule], 'skipped_events' => $skipCount[$eventModule], 'task' => $totalCount[$todoModule] - $skipCount[$todoModule], 'skipped_task' => $skipCount[$todoModule]];

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

                }

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

                 * Function returns Calendar Reminder record models.

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

                    $recordModels = [];

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

                    if ($currentUserModel->isAdminUser()) {

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

                        $settingLinks[] = [

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

                            'linkurl' => 'index.php?parent=Settings&module=Picklist&view=Index&source_module=' . $this->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 $orderBy;

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

                            if ($dates['end'] > $dates['current'] && $dates['start'] < $dates['current']) {

            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 array

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

                {

            Line exceeds 120 characters; contains 130 characters
            Open

                            $lastImport->setFields(['userid' => $userId, 'entitytype' => $this->getName(), 'crmid' => $recordModel->getId()]);

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

                            $lastImport->save();

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

                            ->innerJoin('vtiger_crmentity', 'vtiger_activity_reminder_popup.recordid = vtiger_crmentity.crmid')

            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 App\Fields\Picklist::getValuesName('activitytype');

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

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

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

                    return 'standard';

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

                }

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

                            ->select(['recordid', 'vtiger_activity_reminder_popup.datetime'])

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

                public function getFieldsByType($type, bool $active = false): array

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

                    $fields = $this->getFields();

            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 parent::getOrderBySql($orderBy);

            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 ($dates['end'] > $dates['current']) {

            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

                    $componentsActivityState = [];

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

                public function importICS(string $filePath)

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

                 */

            Line exceeds 120 characters; contains 195 characters
            Open

                            ->where(['vtiger_crmentity.smownerid' => $currentUserModel->getId(), 'vtiger_crmentity.deleted' => 0, 'vtiger_activity.status' => self::getComponentActivityStateLabel('current')])

            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

                 * @param string $key

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

                        switch ($value) {

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

                                $componentsActivityState['completed'] = $value;

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

                                $componentsActivityState['cancelled'] = $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

                            $lastImport = new ICalLastImport();

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

                 */

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

                public static function getCalendarReminder()

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

                    $currentUserModel = Users_Record_Model::getCurrentUserModel();

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

                            ->where(['vtiger_crmentity.smownerid' => $currentUserModel->getId(), 'vtiger_crmentity.deleted' => 0, 'vtiger_activity.status' => self::getComponentActivityStateLabel('current')])

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

                        while ($recordId = $dataReader->readColumn(0)) {

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

                            $recordModels[] = Vtiger_Record_Model::getInstanceById($recordId, 'Calendar');

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

                    }

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

                                $fieldList[$fieldName] = $field;

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

                {

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

                public static function getCalendarTypes()

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

                        $activityStatus = $data['activitystatus'];

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

                            $timeFormatedString = $date->getDisplayTime();

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

                        return $state;

            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 $componentsActivityState[$key];

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

                        $recordModel->save();

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

                        $calendar->recordSaveAttendee($recordModel);

            Line exceeds 120 characters; contains 233 characters
            Open

                    return ['events' => $totalCount[$eventModule] - $skipCount[$eventModule], 'skipped_events' => $skipCount[$eventModule], 'task' => $totalCount[$todoModule] - $skipCount[$todoModule], 'skipped_task' => $skipCount[$todoModule]];

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

                /**

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

                            ->distinct()

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

                    $restrictedField = ['picklist' => ['activitystatus', 'visibility', 'duration_minutes']];

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

                    if (!\is_array($type)) {

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

                        ];

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

                        $dueDateTime = $data['due_date'] . ' ' . $data['time_end'];

            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

                        } 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

                {

            Line exceeds 120 characters; contains 360 characters
            Open

                            ->andWhere(['or', ['and', ['vtiger_activity_reminder_popup.status' => Calendar_Record_Model::REMNDER_POPUP_ACTIVE], ['<=', 'vtiger_activity_reminder_popup.datetime', $time]], ['and', ['vtiger_activity_reminder_popup.status' => Calendar_Record_Model::REMNDER_POPUP_WAIT], ['<=', 'vtiger_activity_reminder_popup.datetime', date('Y-m-d H:i:s')]]])

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

                        $dataReader = $query->createCommand()->query();

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

                    foreach ($fields as $field) {

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

                        $fieldType = $field->getFieldDataType();

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

                            if ('picklist' == $fieldType && \in_array($fieldName, $restrictedField[$fieldType])) {

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

                        }

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

                                $state = $activityStatusLabels['not_started'];

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

                            } elseif ($dates['end'] < $dates['current']) {

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

                                $state = $activityStatusLabels['overdue'];

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

                            case 'PLL_COMPLETED':

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

                            case 'PLL_POSTPONED':

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

                    $totalCount = $skipCount = [$eventModule => 0, $todoModule => 0];

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

                /** {@inheritdoc} */

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

                            case 'PLL_OVERDUE':

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

                public function getLayoutTypeForQuickCreate(): string

            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 ('current' == $key) {

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

                    $lastImport = new ICalLastImport();

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

                            $module = $eventModule;

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

                        if ($recordModel->getId()) {

            Class name "Calendar_Module_Model" is not in camel caps format
            Open

            class Calendar_Module_Model extends Vtiger_Module_Model

            There are no issues that match your filters.

            Category
            Status