YetiForceCompany/YetiForceCRM

View on GitHub
modules/Chat/actions/ChatAjax.php

Summary

Maintainability
D
1 day
Test Coverage
F
24%

File ChatAjax.php has 351 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * Action to get Chat data.
 *
Severity: Minor
Found in modules/Chat/actions/ChatAjax.php - About 4 hrs to fix

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

    class Chat_ChatAjax_Action extends \App\Controller\Action
    {
        use \App\Controller\ExposeMethod;
    
        /**
    Severity: Minor
    Found in modules/Chat/actions/ChatAjax.php by phpmd

    Method setMessagesResult has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function setMessagesResult(App\Request $request)
        {
            if ($request->has('roomType') && $request->has('recordId')) {
                $roomType = $request->getByType('roomType');
                $recordId = $request->getInteger('recordId');
    Severity: Minor
    Found in modules/Chat/actions/ChatAjax.php - About 1 hr to fix

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

          public function setMessagesResult(App\Request $request)
          {
              if ($request->has('roomType') && $request->has('recordId')) {
                  $roomType = $request->getByType('roomType');
                  $recordId = $request->getInteger('recordId');
      Severity: Minor
      Found in modules/Chat/actions/ChatAjax.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 getRoomsMessages has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getRoomsMessages(App\Request $request)
          {
              $result = [];
              $roomList = \App\Chat::getRoomsByUser();
              $areNewEntries = false;
      Severity: Minor
      Found in modules/Chat/actions/ChatAjax.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 getRoomsMessages has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getRoomsMessages(App\Request $request)
          {
              $result = [];
              $roomList = \App\Chat::getRoomsByUser();
              $areNewEntries = false;
      Severity: Minor
      Found in modules/Chat/actions/ChatAjax.php - About 1 hr to fix

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

            public function getChatConfig(App\Request $request)
            {
                $userRealID = \App\User::getCurrentUserRealId();
                $userRoomPin = \App\Config::module('Chat', 'userRoomPin');
                if (!$userRoomPin) {
        Severity: Minor
        Found in modules/Chat/actions/ChatAjax.php - About 1 hr to fix

          Method send has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function send(App\Request $request)
              {
                  $roomType = $request->getByType('roomType');
                  $recordId = $request->getInteger('recordId');
                  $chat = \App\Chat::getInstance($roomType, $recordId);
          Severity: Minor
          Found in modules/Chat/actions/ChatAjax.php - About 1 hr to fix

            Function send has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                public function send(App\Request $request)
                {
                    $roomType = $request->getByType('roomType');
                    $recordId = $request->getInteger('recordId');
                    $chat = \App\Chat::getInstance($roomType, $recordId);
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.php - About 25 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 setMessagesResult() has an NPath complexity of 448. The configured NPath complexity threshold is 200.
            Open

                public function setMessagesResult(App\Request $request)
                {
                    if ($request->has('roomType') && $request->has('recordId')) {
                        $roomType = $request->getByType('roomType');
                        $recordId = $request->getInteger('recordId');
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.php by phpmd

            NPathComplexity

            Since: 0.1

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

            Example

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

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

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

                public function getRoomsMessages(App\Request $request)
                {
                    $result = [];
                    $roomList = \App\Chat::getRoomsByUser();
                    $areNewEntries = false;
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 setMessagesResult() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10.
            Open

                public function setMessagesResult(App\Request $request)
                {
                    if ($request->has('roomType') && $request->has('recordId')) {
                        $roomType = $request->getByType('roomType');
                        $recordId = $request->getInteger('recordId');
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 class Chat_ChatAjax_Action has a coupling between objects value of 13. Consider to reduce the number of dependencies under 13.
            Open

            class Chat_ChatAjax_Action extends \App\Controller\Action
            {
                use \App\Controller\ExposeMethod;
            
                /**
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 '53', column '14').
            Open

                        throw new \App\Exceptions\NoPermitted('ERR_NOT_ACCESSIBLE', 406);
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 '94', column '19').
            Open

                    $response = new Vtiger_Response();
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 '312', column '19').
            Open

                    $response = new Vtiger_Response();
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 '205', column '19').
            Open

                    $response = new Vtiger_Response();
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 '329', column '14').
            Open

                        throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 '227', column '19').
            Open

                    $response = new Vtiger_Response();
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.php by phpmd

            MissingImport

            Since: 2.7.0

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

            Example

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

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

            Missing class import via use statement (line '253', column '44').
            Open

                            'data' => $this->setMessagesResult(new App\Request(['roomType' => $defaultRoom['roomType'], 'recordId' => $defaultRoom['recordId']]))
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 '295', column '19').
            Open

                    $response = new Vtiger_Response();
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 '19').
            Open

                    $response = new Vtiger_Response();
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 '247', column '14').
            Open

                        throw new \App\Exceptions\IllegalValue('ERR_NOT_ALLOWED_VALUE', 406);
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 '182', column '15').
            Open

                            throw new \App\Exceptions\IllegalValue('ERR_NOT_ALLOWED_VALUE', 406);
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 '335', column '19').
            Open

                    $response = new Vtiger_Response();
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 '268', column '19').
            Open

                    $response = new Vtiger_Response();
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 '440', column '19').
            Open

                    $response = new Vtiger_Response();
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 '378', column '19').
            Open

                    $response = new Vtiger_Response();
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 '457', column '14').
            Open

                        throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 '136', column '14').
            Open

                        throw new \App\Exceptions\IllegalValue('ERR_NOT_ALLOWED_VALUE', 406);
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 '422', column '19').
            Open

                    $response = new Vtiger_Response();
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 '360', column '19').
            Open

                    $response = new Vtiger_Response();
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 '461', column '19').
            Open

                    $response = new Vtiger_Response();
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 '396', column '14').
            Open

                        throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 '352', column '14').
            Open

                        throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 '407', column '19').
            Open

                    $response = new Vtiger_Response();
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 '487', column '19').
            Open

                    $response = new Vtiger_Response();
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 '\App\Chat' in method 'setMessagesResult'.
            Open

                        $defaultRoom = \App\Chat::setCurrentRoomDefault();
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 'getChatConfig'.
            Open

                            'isDefaultSoundNotification' => \App\Config::module('Chat', 'DEFAULT_SOUND_NOTIFICATION'),
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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\Chat' in method 'getChatConfig'.
            Open

                            'defaultRoom' => \App\Chat::getDefaultRoom(),
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 'getChatConfig'.
            Open

                            'refreshMessageTime' => \App\Config::module('Chat', 'REFRESH_MESSAGE_TIME'),
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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\Chat' in method 'setMessagesResult'.
            Open

                            \App\Chat::setCurrentRoom($roomType, $recordId);
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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\Chat' in method 'setMessagesResult'.
            Open

                    $chat = \App\Chat::getInstance($roomType, $recordId);
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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\Chat' in method 'setMessagesResult'.
            Open

                        $result['currentRoom'] = \App\Chat::getCurrentRoom();
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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\Chat' in method 'getChatConfig'.
            Open

                            'activeRoomTypes' => \App\Chat::getActiveRoomTypes(),
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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\Chat' in method 'getChatConfig'.
            Open

                        $result['config']['chatModules'] = \App\Chat::getChatModules();
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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\Chat' in method 'getRoomsMessages'.
            Open

                    $roomList = \App\Chat::getRoomsByUser();
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 'getRoomsMessages'.
            Open

                    if (App\Config::module('Chat', 'SHOW_NUMBER_OF_NEW_MESSAGES')) {
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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\Chat' in method 'addPrivateRoom'.
            Open

                    $chat = \App\Chat::getInstance();
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 'getChatConfig'.
            Open

                            'showNumberOfNewMessages' => \App\Config::module('Chat', 'SHOW_NUMBER_OF_NEW_MESSAGES'),
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 'setMessagesResult'.
            Open

                    if (App\Config::module('Chat', 'SHOW_NUMBER_OF_NEW_MESSAGES')) {
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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\Chat' in method 'getMoreMessages'.
            Open

                        'currentRoom' => \App\Chat::getCurrentRoom(),
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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\Chat' in method 'search'.
            Open

                    $chat = \App\Chat::getInstance($roomType, $recordId);
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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\Chat' in method 'getMoreMessages'.
            Open

                    $chat = \App\Chat::getInstance($request->getByType('roomType'), $request->getInteger('recordId'));
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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\Chat' in method 'send'.
            Open

                    $chat = \App\Chat::getInstance($roomType, $recordId);
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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\Chat' in method 'getChatConfig'.
            Open

                        'roomList' => \App\Chat::getRoomsByUser(),
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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\Chat' in method 'setMessagesResult'.
            Open

                        $currentRoom = \App\Chat::getCurrentRoom();
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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\Chat' in method 'send'.
            Open

                        $defaultRoom = \App\Chat::setCurrentRoomDefault();
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 send uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

                    } else {
                        $chat->addMessage(\App\Utils\Completions::encodeAll($request->getForHtml('message')));
                        $chatEntries = $chat->getEntries($request->isEmpty('mid') ? null : $request->getInteger('mid'));
                        $isNextPage = $this->isNextPage(\count($chatEntries));
                        if ($isNextPage) {
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.php by phpmd

            ElseExpression

            Since: 1.4.0

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

            Example

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

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

            Avoid using static access to class '\App\Utils\Completions' in method 'send'.
            Open

                        $chat->addMessage(\App\Utils\Completions::encodeAll($request->getForHtml('message')));
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 'getChatConfig'.
            Open

                            'maxLengthMessage' => \App\Config::module('Chat', 'MAX_LENGTH_MESSAGE'),
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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\Chat' in method 'getRoomsMessages'.
            Open

                        $chat = \App\Chat::getInstance($roomType, $recordId);
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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\Chat' in method 'archivePrivateRoom'.
            Open

                    $chat = \App\Chat::getInstance('private', $recordId);
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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\Chat' in method 'archivePrivateRoom'.
            Open

                        \App\Chat::setCurrentRoomDefault();
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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\Chat' in method 'setMessagesResult'.
            Open

                        $result['amountOfNewMessages'] = \App\Chat::getNumberOfNewMessages();
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 'getChatConfig'.
            Open

                    $userRealID = \App\User::getCurrentUserRealId();
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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\Chat' in method 'getChatConfig'.
            Open

                        \App\Chat::pinAllUsers($userRealID);
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 'getChatConfig'.
            Open

                            'showRoleName' => \App\Config::module('Users', 'SHOW_ROLE_NAME'),
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 setMessagesResult uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

                    } else {
                        $currentRoom = \App\Chat::getCurrentRoom();
                        if (!$currentRoom || !isset($currentRoom['roomType']) || !isset($currentRoom['recordId'])) {
                            return false;
                        }
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 '\Users_Privileges_Model' in method 'checkPermission'.
            Open

                    $userPrivileges = \Users_Privileges_Model::getCurrentUserPrivilegesModel();
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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\Chat' in method 'getRoomsMessages'.
            Open

                        $result['amountOfNewMessages'] = \App\Chat::getNumberOfNewMessages($roomList);
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 'getChatConfig'.
            Open

                    $userRoomPin = \App\Config::module('Chat', 'userRoomPin');
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 'getChatConfig'.
            Open

                            'isChatAllowed' => $userRealID === \App\User::getCurrentUserId(),
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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\Chat' in method 'archivePrivateRoom'.
            Open

            }
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 search uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

                    } else {
                        $chatEntries = $chat->getEntries(null, '>', $searchVal);
                    }
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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\Chat' in method 'addPrivateRoom'.
            Open

                    $response->setResult(\App\Chat::getRoomsByUser());
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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\Chat' in method 'getRooms'.
            Open

                        'roomList' => \App\Chat::getRoomsByUser()
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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\Chat' in method 'getUnread'.
            Open

                        $unreadMessages[$roomType] = \App\Chat::getUnreadByType($roomType);
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 'isNextPage'.
            Open

                    return $numberOfMessages >= \App\Config::module('Chat', 'CHAT_ROWS_LIMIT') + 1;
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 'getChatConfig'.
            Open

                            'refreshRoomTime' => \App\Config::module('Chat', 'REFRESH_ROOM_TIME'),
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 'getChatConfig'.
            Open

                            'dynamicAddingRooms' => \App\Config::module('Chat', 'dynamicAddingRooms'),
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 'getChatConfig'.
            Open

                            'refreshTimeGlobal' => \App\Config::module('Chat', 'REFRESH_TIME_GLOBAL'),
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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\Chat' in method 'getChatConfig'.
            Open

                        'currentRoom' => \App\Chat::getCurrentRoom()
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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\Chat' in method 'setMessagesResult'.
            Open

                    $roomList = \App\Chat::getRoomsByUser();
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 'getRecordRoom'.
            Open

                                    'showMoreButton' => \count($chatEntries) > \App\Config::module('Chat', 'CHAT_ROWS_LIMIT')
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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\Chat' in method 'getRoomPrivateUnpinnedUsers'.
            Open

                    $response->setResult(\App\Chat::getRoomPrivateUnpinnedUsers($request->getInteger('roomId')));
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 addParticipant uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

                    } else {
                        $result = $chat->getParticipants();
                    }
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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\Chat' in method 'getHistory'.
            Open

                    $chat = \App\Chat::getInstance();
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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\Chat' in method 'getUnread'.
            Open

                    foreach (\App\Chat::getActiveRoomTypes() as $roomType) {
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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\Chat' in method 'getRoomsUnpinned'.
            Open

                    $response->setResult(\App\Chat::{$methodName}());
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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\Chat' in method 'getRecordRoom'.
            Open

                    $chat = \App\Chat::getInstance('crm', $recordId);
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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\Chat' in method 'addParticipant'.
            Open

                    $chat = \App\Chat::getInstance('private', $recordId);
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 getHistory uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

                    } else {
                        $chatEntries = $chat->getHistoryByType($groupHistory, $request->getInteger('mid'));
                    }
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 'getRecordRoom'.
            Open

                    $recordModel = Vtiger_Record_Model::getInstanceById($recordId);
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 "roomType" 13 times.
            Open

                    if ($request->has('roomType') && $request->has('recordId')) {
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.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 "roomList" 5 times.
            Open

                        'roomList' => \App\Chat::getRoomsByUser(),
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.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 "ERR_NOT_ALLOWED_VALUE" 3 times.
            Open

                        throw new \App\Exceptions\IllegalValue('ERR_NOT_ALLOWED_VALUE', 406);
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.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 "chatEntries" 9 times.
            Open

                    $roomList[$roomType][$recordId]['chatEntries'] = $chatEntries;
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.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 "config" 3 times.
            Open

                        'config' => [
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.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 "currentRoom" 3 times.
            Open

                        'currentRoom' => \App\Chat::getCurrentRoom()
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.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 "message" 3 times.
            Open

                            'message' => 'JS_CHAT_ROOM_NOT_ALLOWED',
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.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 "participants" 4 times.
            Open

                    $roomList[$roomType][$recordId]['participants'] = $chat->getParticipants();
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.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 "showMoreButton" 7 times.
            Open

                        $roomList[$roomType][$recordId]['showMoreButton'] = $isNextPage;
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.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 "dynamicAddingRooms" 3 times.
            Open

                            'dynamicAddingRooms' => \App\Config::module('Chat', 'dynamicAddingRooms'),
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.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 "lastId" 4 times.
            Open

                    $chatEntries = $chat->getEntries($request->has('lastId') ? $request->getInteger('lastId') : 0);
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.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 "private" 4 times.
            Open

                        if ('private' === $roomType && !$chat->isPrivateRoomAllowed($recordId)) {
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.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 "SHOW_NUMBER_OF_NEW_MESSAGES" 3 times.
            Open

                            'showNumberOfNewMessages' => \App\Config::module('Chat', 'SHOW_NUMBER_OF_NEW_MESSAGES'),
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.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 "recordId" 13 times.
            Open

                    if ($request->has('roomType') && $request->has('recordId')) {
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.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 "ERR_NO_PERMISSIONS_FOR_THE_RECORD" 4 times.
            Open

                        throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.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 '$request'.
            Open

                public function getUnread(App\Request $request)
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 '$request'.
            Open

                public function getChatConfig(App\Request $request)
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 '$request'.
            Open

                public function getRooms(App\Request $request)
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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 getCurrentUserRealId from undeclared class \App\User (Did you mean class \Tests\App\User)
            Open

                    $userRealID = \App\User::getCurrentUserRealId();
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.php by phan

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

                            'isChatAllowed' => $userRealID === \App\User::getCurrentUserId(),
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.php by phan

            Call to method getInstance from undeclared class \App\Chat
            Open

                    $chat = \App\Chat::getInstance($roomType, $recordId);
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.php by phan

            Call to method getInstance from undeclared class \App\Chat
            Open

                        $chat = \App\Chat::getInstance($roomType, $recordId);
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.php by phan

            Call to method getRoomPrivateUnpinnedUsers from undeclared class \App\Chat
            Open

                    $response->setResult(\App\Chat::getRoomPrivateUnpinnedUsers($request->getInteger('roomId')));
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.php by phan

            Call to method getInstance from undeclared class \App\Chat
            Open

                    $chat = \App\Chat::getInstance('crm', $recordId);
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.php by phan

            Call to method getActiveRoomTypes from undeclared class \App\Chat
            Open

                            'activeRoomTypes' => \App\Chat::getActiveRoomTypes(),
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.php by phan

            Call to method getCurrentRoom from undeclared class \App\Chat
            Open

                        $currentRoom = \App\Chat::getCurrentRoom();
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.php by phan

            Call to method getRoomsByUser from undeclared class \App\Chat
            Open

                    $roomList = \App\Chat::getRoomsByUser();
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.php by phan

            Call to method getInstance from undeclared class \App\Chat
            Open

                    $chat = \App\Chat::getInstance();
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.php by phan

            Call to method getChatModules from undeclared class \App\Chat
            Open

                        $result['config']['chatModules'] = \App\Chat::getChatModules();
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.php by phan

            Call to method encodeAll from undeclared class \App\Utils\Completions
            Open

                        $chat->addMessage(\App\Utils\Completions::encodeAll($request->getForHtml('message')));
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.php by phan

            Call to method getInstance from undeclared class \App\Chat
            Open

                    $chat = \App\Chat::getInstance($roomType, $recordId);
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.php by phan

            Call to method getInstance from undeclared class \App\Chat
            Open

                    $chat = \App\Chat::getInstance();
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.php by phan

            Call to method setCurrentRoomDefault from undeclared class \App\Chat
            Open

                        \App\Chat::setCurrentRoomDefault();
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.php by phan

            Call to method getRoomsByUser from undeclared class \App\Chat
            Open

                    $roomList = \App\Chat::getRoomsByUser();
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.php by phan

            Call to method getCurrentRoom from undeclared class \App\Chat
            Open

                    if (\App\Chat::getCurrentRoom()['recordId'] === $recordId) {
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.php by phan

            Call to method getActiveRoomTypes from undeclared class \App\Chat
            Open

                    foreach (\App\Chat::getActiveRoomTypes() as $roomType) {
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.php by phan

            Reference to constant ALLOWED_ROOM_TYPES from undeclared class \App\Chat
            Open

                    if (!\in_array($groupHistory, \App\Chat::ALLOWED_ROOM_TYPES)) {
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.php by phan

            Call to method setCurrentRoom from undeclared class \App\Chat
            Open

                            \App\Chat::setCurrentRoom($roomType, $recordId);
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.php by phan

            @throws type of getMoreMessages has undeclared type \yii\db\Exception (Did you mean class \Exception)
            Open

                public function getMoreMessages(App\Request $request)
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.php by phan

            Call to method getInstance from undeclared class \App\Chat
            Open

                    $chat = \App\Chat::getInstance($request->getByType('roomType'), $request->getInteger('recordId'));
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.php by phan

            Call to method getNumberOfNewMessages from undeclared class \App\Chat
            Open

                        $result['amountOfNewMessages'] = \App\Chat::getNumberOfNewMessages();
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.php by phan

            Call to method setCurrentRoomDefault from undeclared class \App\Chat
            Open

                        $defaultRoom = \App\Chat::setCurrentRoomDefault();
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.php by phan

            Call to method getCurrentRoom from undeclared class \App\Chat
            Open

                        $result['currentRoom'] = \App\Chat::getCurrentRoom();
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.php by phan

            Argument 1 (mixed) is string but \Users_Privileges_Model::hasModulePermission() takes int defined at /code/modules/Users/models/Privileges.php:101
            Open

                    if (!$userPrivileges->hasModulePermission($request->getModule()) || $userPrivileges->getId() !== $userPrivileges->getRealId()) {
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.php by phan

            Call to method getNumberOfNewMessages from undeclared class \App\Chat
            Open

                        $result['amountOfNewMessages'] = \App\Chat::getNumberOfNewMessages($roomList);
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.php by phan

            Call to method setCurrentRoomDefault from undeclared class \App\Chat
            Open

                        $defaultRoom = \App\Chat::setCurrentRoomDefault();
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.php by phan

            Call to method getInstance from undeclared class \App\Chat
            Open

                    $chat = \App\Chat::getInstance('private', $recordId);
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.php by phan

            Call to method getCurrentRoom from undeclared class \App\Chat
            Open

                        'currentRoom' => \App\Chat::getCurrentRoom(),
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.php by phan

            Call to method getCurrentRoom from undeclared class \App\Chat
            Open

                        'currentRoom' => \App\Chat::getCurrentRoom()
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.php by phan

            Call to method getInstance from undeclared class \App\Chat
            Open

                    $chat = \App\Chat::getInstance($roomType, $recordId);
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.php by phan

            Call to method getInstance from undeclared class \App\Chat
            Open

                    $chat = \App\Chat::getInstance('private', $recordId);
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.php by phan

            Call to method getDefaultRoom from undeclared class \App\Chat
            Open

                            'defaultRoom' => \App\Chat::getDefaultRoom(),
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.php by phan

            Call to method getRoomsByUser from undeclared class \App\Chat
            Open

                        'roomList' => \App\Chat::getRoomsByUser(),
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.php by phan

            Call to method pinAllUsers from undeclared class \App\Chat
            Open

                        \App\Chat::pinAllUsers($userRealID);
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.php by phan

            Call to method getRoomsByUser from undeclared class \App\Chat
            Open

                    $response->setResult(\App\Chat::getRoomsByUser());
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.php by phan

            Call to method getUnreadByType from undeclared class \App\Chat
            Open

                        $unreadMessages[$roomType] = \App\Chat::getUnreadByType($roomType);
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.php by phan

            Call to method getRoomsByUser from undeclared class \App\Chat
            Open

                        'roomList' => \App\Chat::getRoomsByUser()
            Severity: Critical
            Found in modules/Chat/actions/ChatAjax.php by phan

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

            class Chat_ChatAjax_Action extends \App\Controller\Action

            The class Chat_ChatAjax_Action is not named in CamelCase.
            Open

            class Chat_ChatAjax_Action extends \App\Controller\Action
            {
                use \App\Controller\ExposeMethod;
            
                /**
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.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

            Spaces must be used for alignment; tabs are not allowed
            Open

                 *    Set messages result.

            Spaces must be used for alignment; tabs are not allowed
            Open

                {

            Spaces must be used for alignment; tabs are not allowed
            Open

                        $recordId = $request->getInteger('recordId');

            Spaces must be used for alignment; tabs are not allowed
            Open

                        if (!$request->getBoolean('recordRoom')) {

            Spaces must be used for alignment; tabs are not allowed
            Open

                    if ($request->has('roomType') && $request->has('recordId')) {

            Spaces must be used for alignment; tabs are not allowed
            Open

                 * @param \App\Request $request

            Spaces must be used for alignment; tabs are not allowed
            Open

                        $currentRoom = \App\Chat::getCurrentRoom();

            Spaces must be used for alignment; tabs are not allowed
            Open

                        $recordId = $currentRoom['recordId'];

            Spaces must be used for alignment; tabs are not allowed
            Open

                    }

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $areNewEntries = false;

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $result['areNewEntries'] = $areNewEntries;

            Spaces must be used for alignment; tabs are not allowed
            Open

                 * Search meassages.

            Spaces must be used for alignment; tabs are not allowed
            Open

                            return false;

            Spaces must be used for alignment; tabs are not allowed
            Open

                    if (!isset($roomList[$roomType][$recordId])) {

            Spaces must be used for alignment; tabs are not allowed
            Open

                        if ($isNextPage) {

            Spaces must be used for alignment; tabs are not allowed
            Open

                        $roomList[$roomType][$recordId]['participants'] = $chat->getParticipants();

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $response->emit();

            Spaces must be used for alignment; tabs are not allowed
            Open

                 * @param \App\Request $request

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $chat = \App\Chat::getInstance($request->getByType('roomType'), $request->getInteger('recordId'));

            Spaces must be used for alignment; tabs are not allowed
            Open

                public function send(App\Request $request)

            Spaces must be used for alignment; tabs are not allowed
            Open

                    }

            Spaces must be used for alignment; tabs are not allowed
            Open

                    return $result;

            Spaces must be used for alignment; tabs are not allowed
            Open

                }

            Spaces must be used for alignment; tabs are not allowed
            Open

                 * Get rooms messages from chat.

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $result = [];

            Spaces must be used for alignment; tabs are not allowed
            Open

                {

            Spaces must be used for alignment; tabs are not allowed
            Open

                    ]);

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $roomType = $request->getByType('roomType');

            Spaces must be used for alignment; tabs are not allowed
            Open

                    if ('private' === $roomType && !$chat->isPrivateRoomAllowed($recordId)) {

            Spaces must be used for alignment; tabs are not allowed
            Open

                        array_shift($chatEntries);

            Spaces must be used for alignment; tabs are not allowed
            Open

                        $defaultRoom = \App\Chat::setCurrentRoomDefault();

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $result['roomList'] = $roomList;

            Spaces must be used for alignment; tabs are not allowed
            Open

                        'currentRoom' => \App\Chat::getCurrentRoom(),

            Spaces must be used for alignment; tabs are not allowed
            Open

                 * Send message function.

            Spaces must be used for alignment; tabs are not allowed
            Open

                 * @param \App\Request $request

            Spaces must be used for alignment; tabs are not allowed
            Open

                 */

            Spaces must be used for alignment; tabs are not allowed
            Open

                 * @throws \App\Exceptions\IllegalValue

            Spaces must be used for alignment; tabs are not allowed
            Open

                 */

            Spaces must be used for alignment; tabs are not allowed
            Open

                public function setMessagesResult(App\Request $request)

            Spaces must be used for alignment; tabs are not allowed
            Open

                        $recordId = $defaultRoom['recordId'];

            Spaces must be used for alignment; tabs are not allowed
            Open

                    }

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $result['roomList'] = $roomList;

            Spaces must be used for alignment; tabs are not allowed
            Open

                 *

            Spaces must be used for alignment; tabs are not allowed
            Open

                            continue;

            Spaces must be used for alignment; tabs are not allowed
            Open

                        $roomList[$roomType][$recordId]['showMoreButton'] = $isNextPage;

            Spaces must be used for alignment; tabs are not allowed
            Open

                    if (App\Config::module('Chat', 'SHOW_NUMBER_OF_NEW_MESSAGES')) {

            Spaces must be used for alignment; tabs are not allowed
            Open

                        $result['amountOfNewMessages'] = \App\Chat::getNumberOfNewMessages($roomList);

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $isNextPage = $this->isNextPage(\count($chatEntries));

            Spaces must be used for alignment; tabs are not allowed
            Open

                        ];

            Spaces must be used for alignment; tabs are not allowed
            Open

                        ];

            Spaces must be used for alignment; tabs are not allowed
            Open

                    }

            Spaces must be used for alignment; tabs are not allowed
            Open

                 *

            Spaces must be used for alignment; tabs are not allowed
            Open

                        $roomType = $request->getByType('roomType');

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $roomList = \App\Chat::getRoomsByUser();

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $roomList[$roomType][$recordId]['chatEntries'] = $chatEntries;

            Spaces must be used for alignment; tabs are not allowed
            Open

                    }

            Spaces must be used for alignment; tabs are not allowed
            Open

                    foreach ($request->getArray('rooms') as $room) {

            Spaces must be used for alignment; tabs are not allowed
            Open

                        $chatEntries = $chat->getEntries($lastEntries ? $lastEntries['id'] : 0);

            Spaces must be used for alignment; tabs are not allowed
            Open

                        }

            Spaces must be used for alignment; tabs are not allowed
            Open

                {

            Spaces must be used for alignment; tabs are not allowed
            Open

                            array_shift($chatEntries);

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $response->setResult($result);

            Spaces must be used for alignment; tabs are not allowed
            Open

                 * @param \App\Request $request

            Spaces must be used for alignment; tabs are not allowed
            Open

                    }

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $roomList[$roomType][$recordId]['participants'] = $chat->getParticipants();

            Spaces must be used for alignment; tabs are not allowed
            Open

                        if (!$chat->isRoomExists()) {

            Spaces must be used for alignment; tabs are not allowed
            Open

                        if ('private' === $roomType && !$chat->isPrivateRoomAllowed($recordId)) {

            Spaces must be used for alignment; tabs are not allowed
            Open

                        $roomList[$roomType][$recordId]['chatEntries'] = $chatEntries;

            Spaces must be used for alignment; tabs are not allowed
            Open

                            $areNewEntries = \count($chatEntries) > 0;

            Spaces must be used for alignment; tabs are not allowed
            Open

                        'chatEntries' => $chatEntries,

            Spaces must be used for alignment; tabs are not allowed
            Open

                        $defaultRoom = \App\Chat::setCurrentRoomDefault();

            Spaces must be used for alignment; tabs are not allowed
            Open

                    } else {

            Spaces must be used for alignment; tabs are not allowed
            Open

                        $chatEntries = $chat->getEntries($request->isEmpty('mid') ? null : $request->getInteger('mid'));

            Spaces must be used for alignment; tabs are not allowed
            Open

                        }

            Spaces must be used for alignment; tabs are not allowed
            Open

                            \App\Chat::setCurrentRoom($roomType, $recordId);

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $chatEntries = $chat->getEntries($request->has('lastId') ? $request->getInteger('lastId') : 0);

            Spaces must be used for alignment; tabs are not allowed
            Open

                 * @throws \App\Exceptions\IllegalValue

            Spaces must be used for alignment; tabs are not allowed
            Open

                    }

            Spaces must be used for alignment; tabs are not allowed
            Open

                        $result = [

            Spaces must be used for alignment; tabs are not allowed
            Open

                        if (!$currentRoom || !isset($currentRoom['roomType']) || !isset($currentRoom['recordId'])) {

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $chat = \App\Chat::getInstance($roomType, $recordId);

            Spaces must be used for alignment; tabs are not allowed
            Open

                        throw new \App\Exceptions\IllegalValue('ERR_NOT_ALLOWED_VALUE', 406);

            Spaces must be used for alignment; tabs are not allowed
            Open

                    if (App\Config::module('Chat', 'SHOW_NUMBER_OF_NEW_MESSAGES')) {

            Spaces must be used for alignment; tabs are not allowed
            Open

                public function getRoomsMessages(App\Request $request)

            Spaces must be used for alignment; tabs are not allowed
            Open

                            throw new \App\Exceptions\IllegalValue('ERR_NOT_ALLOWED_VALUE', 406);

            Spaces must be used for alignment; tabs are not allowed
            Open

                        }

            Spaces must be used for alignment; tabs are not allowed
            Open

                        $lastEntries = !empty($room['chatEntries']) ? array_pop($room['chatEntries']) : false;

            Spaces must be used for alignment; tabs are not allowed
            Open

                        if (!$areNewEntries) {

            Spaces must be used for alignment; tabs are not allowed
            Open

                    }

            Spaces must be used for alignment; tabs are not allowed
            Open

                 *

            Spaces must be used for alignment; tabs are not allowed
            Open

                        $chat->addMessage(\App\Utils\Completions::encodeAll($request->getForHtml('message')));

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $response = new Vtiger_Response();

            Spaces must be used for alignment; tabs are not allowed
            Open

                 *

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $result = [];

            Spaces must be used for alignment; tabs are not allowed
            Open

                    if (!$request->has('lastId')) {

            Spaces must be used for alignment; tabs are not allowed
            Open

                            array_shift($chatEntries);

            Spaces must be used for alignment; tabs are not allowed
            Open

                 * @throws \App\Exceptions\AppException

            Spaces must be used for alignment; tabs are not allowed
            Open

                }

            Spaces must be used for alignment; tabs are not allowed
            Open

                        throw new \App\Exceptions\IllegalValue('ERR_NOT_ALLOWED_VALUE', 406);

            Spaces must be used for alignment; tabs are not allowed
            Open

                            'data' => $this->setMessagesResult(new App\Request(['roomType' => $defaultRoom['roomType'], 'recordId' => $defaultRoom['recordId']]))

            Spaces must be used for alignment; tabs are not allowed
            Open

                {

            Spaces must be used for alignment; tabs are not allowed
            Open

                        \App\Chat::setCurrentRoomDefault();

            Spaces must be used for alignment; tabs are not allowed
            Open

                    }

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $chat->archivePrivateRoom($recordId);

            Spaces must be used for alignment; tabs are not allowed
            Open

                        $result = $chat->getParticipants();

            Spaces must be used for alignment; tabs are not allowed
            Open

                }

            Spaces must be used for alignment; tabs are not allowed
            Open

                    if ($request->isEmpty('mid')) {

            Spaces must be used for alignment; tabs are not allowed
            Open

                 * Get rooms function.

            Spaces must be used for alignment; tabs are not allowed
            Open

                public function getRooms(App\Request $request)

            Spaces must be used for alignment; tabs are not allowed
            Open

                        $recordId = $room['recordid'];

            Spaces must be used for alignment; tabs are not allowed
            Open

                }

            Spaces must be used for alignment; tabs are not allowed
            Open

                 *

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $chatEntries = $chat->getEntries($request->getInteger('lastId'), '<');

            Spaces must be used for alignment; tabs are not allowed
            Open

                        if ($isNextPage) {

            Spaces must be used for alignment; tabs are not allowed
            Open

                        $result = [

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $chat = \App\Chat::getInstance($roomType, $recordId);

            Spaces must be used for alignment; tabs are not allowed
            Open

                 * @param \App\Request $request

            Spaces must be used for alignment; tabs are not allowed
            Open

                /**

            Spaces must be used for alignment; tabs are not allowed
            Open

                 *

            Spaces must be used for alignment; tabs are not allowed
            Open

                    if (!\in_array($groupHistory, \App\Chat::ALLOWED_ROOM_TYPES)) {

            Spaces must be used for alignment; tabs are not allowed
            Open

                        $chatEntries = $chat->getHistoryByType($groupHistory);

            Spaces must be used for alignment; tabs are not allowed
            Open

                    if (!$chat->isRoomExists()) {

            Spaces must be used for alignment; tabs are not allowed
            Open

                /**

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $response = new Vtiger_Response();

            Spaces must be used for alignment; tabs are not allowed
            Open

                 * Get more messages from chat.

            Spaces must be used for alignment; tabs are not allowed
            Open

                public function getMoreMessages(App\Request $request)

            Spaces must be used for alignment; tabs are not allowed
            Open

                            'chatEntries' => $chatEntries,

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $recordId = $request->getInteger('recordId');

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $isNextPage = $this->isNextPage(\count($chatEntries));

            Spaces must be used for alignment; tabs are not allowed
            Open

                public function addPrivateRoom(App\Request $request)

            Spaces must be used for alignment; tabs are not allowed
            Open

                {

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $chat->createPrivateRoom($request->getByType('name', 'Text'));

            Spaces must be used for alignment; tabs are not allowed
            Open

                 *

            Spaces must be used for alignment; tabs are not allowed
            Open

                 *

            Spaces must be used for alignment; tabs are not allowed
            Open

                {

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $response->emit();

            Spaces must be used for alignment; tabs are not allowed
            Open

                 * @param \App\Request $request

            Spaces must be used for alignment; tabs are not allowed
            Open

                        'roomList' => \App\Chat::getRoomsByUser()

            Spaces must be used for alignment; tabs are not allowed
            Open

                        $roomType = $currentRoom['roomType'];

            Spaces must be used for alignment; tabs are not allowed
            Open

                    }

            Spaces must be used for alignment; tabs are not allowed
            Open

                        $result['currentRoom'] = \App\Chat::getCurrentRoom();

            Spaces must be used for alignment; tabs are not allowed
            Open

                        $roomList[$roomType][$recordId]['showMoreButton'] = $isNextPage;

            Spaces must be used for alignment; tabs are not allowed
            Open

                        $result['amountOfNewMessages'] = \App\Chat::getNumberOfNewMessages();

            Spaces must be used for alignment; tabs are not allowed
            Open

                 *

            Spaces must be used for alignment; tabs are not allowed
            Open

                 *

            Spaces must be used for alignment; tabs are not allowed
            Open

                        'showMoreButton' => $isNextPage,

            Spaces must be used for alignment; tabs are not allowed
            Open

                            'message' => 'JS_CHAT_ROOM_NOT_ALLOWED',

            Spaces must be used for alignment; tabs are not allowed
            Open

                        $isNextPage = $this->isNextPage(\count($chatEntries));

            Spaces must be used for alignment; tabs are not allowed
            Open

                 *

            Spaces must be used for alignment; tabs are not allowed
            Open

                    }

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $response = new Vtiger_Response();

            Spaces must be used for alignment; tabs are not allowed
            Open

                }

            Spaces must be used for alignment; tabs are not allowed
            Open

                 * @param \App\Request $request

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $response->emit();

            Spaces must be used for alignment; tabs are not allowed
            Open

                 * @param \App\Request $request

            Spaces must be used for alignment; tabs are not allowed
            Open

                 *

            Spaces must be used for alignment; tabs are not allowed
            Open

                        $chatEntries = $chat->getHistoryByType($groupHistory, $request->getInteger('mid'));

            Spaces must be used for alignment; tabs are not allowed
            Open

                    }

            Spaces must be used for alignment; tabs are not allowed
            Open

                    ]);

            Spaces must be used for alignment; tabs are not allowed
            Open

                 * @param App\Request $request

            Spaces must be used for alignment; tabs are not allowed
            Open

                 * @return void

            Spaces must be used for alignment; tabs are not allowed
            Open

                        }

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $isNextPage = $this->isNextPage(\count($chatEntries));

            Spaces must be used for alignment; tabs are not allowed
            Open

                    if ($isNextPage) {

            Spaces must be used for alignment; tabs are not allowed
            Open

                 * @param \App\Request $request

            Spaces must be used for alignment; tabs are not allowed
            Open

                        $isNextPage = $this->isNextPage(\count($chatEntries));

            Spaces must be used for alignment; tabs are not allowed
            Open

                /**

            Spaces must be used for alignment; tabs are not allowed
            Open

                 * @throws \yii\db\Exception

            Spaces must be used for alignment; tabs are not allowed
            Open

                    if ($isNextPage) {

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $response->setResult([

            Spaces must be used for alignment; tabs are not allowed
            Open

                            'showMoreButton' => $isNextPage

            Spaces must be used for alignment; tabs are not allowed
            Open

                /**

            Spaces must be used for alignment; tabs are not allowed
            Open

                 * @throws \App\Exceptions\IllegalValue

            Spaces must be used for alignment; tabs are not allowed
            Open

                        array_shift($chatEntries);

            Spaces must be used for alignment; tabs are not allowed
            Open

                        'chatEntries' => $chatEntries,

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $response->setResult(true);

            Spaces must be used for alignment; tabs are not allowed
            Open

                }

            Spaces must be used for alignment; tabs are not allowed
            Open

                    }

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $isNextPage = $this->isNextPage(\count($chatEntries));

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $recordModel = Vtiger_Record_Model::getInstanceById($recordId);

            Spaces must be used for alignment; tabs are not allowed
            Open

                        ]

            Spaces must be used for alignment; tabs are not allowed
            Open

                 *

            Spaces must be used for alignment; tabs are not allowed
            Open

                 *

            Spaces must be used for alignment; tabs are not allowed
            Open

                    }

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $response->setResult([

            Spaces must be used for alignment; tabs are not allowed
            Open

                 * Archive rooms.

            Spaces must be used for alignment; tabs are not allowed
            Open

                    if (!$chat->isRoomModerator($recordId)) {

            Spaces must be used for alignment; tabs are not allowed
            Open

                        throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $alreadyInvited = $chat->addParticipantToPrivate($request->getInteger('userId'));

            Spaces must be used for alignment; tabs are not allowed
            Open

                 * Get all unread messages.

            Spaces must be used for alignment; tabs are not allowed
            Open

                /**

            Spaces must be used for alignment; tabs are not allowed
            Open

                 * @throws \App\Exceptions\IllegalValue

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $chat = \App\Chat::getInstance();

            Spaces must be used for alignment; tabs are not allowed
            Open

                 *

            Spaces must be used for alignment; tabs are not allowed
            Open

                        $roomType = $defaultRoom['roomType'];

            Spaces must be used for alignment; tabs are not allowed
            Open

                 */

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $roomList = \App\Chat::getRoomsByUser();

            Spaces must be used for alignment; tabs are not allowed
            Open

                        $chat = \App\Chat::getInstance($roomType, $recordId);

            Spaces must be used for alignment; tabs are not allowed
            Open

                        }

            Spaces must be used for alignment; tabs are not allowed
            Open

                        }

            Spaces must be used for alignment; tabs are not allowed
            Open

                    }

            Spaces must be used for alignment; tabs are not allowed
            Open

                 */

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $response = new Vtiger_Response();

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $response->emit();

            Spaces must be used for alignment; tabs are not allowed
            Open

                /**

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $chat = \App\Chat::getInstance($roomType, $recordId);

            Spaces must be used for alignment; tabs are not allowed
            Open

                    if (!$chat->isRoomExists()) {

            Spaces must be used for alignment; tabs are not allowed
            Open

                }

            Spaces must be used for alignment; tabs are not allowed
            Open

                    if (!$request->isEmpty('mid')) {

            Spaces must be used for alignment; tabs are not allowed
            Open

                 * @throws \App\Exceptions\AppException

            Spaces must be used for alignment; tabs are not allowed
            Open

                        $result = ['message' => 'JS_CHAT_PARTICIPANT_INVITED'];

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $unreadMessages = [];

            Spaces must be used for alignment; tabs are not allowed
            Open

                    }

            Spaces must be used for alignment; tabs are not allowed
            Open

                        'chatEntries' => $chatEntries,

            Spaces must be used for alignment; tabs are not allowed
            Open

                 *

            Spaces must be used for alignment; tabs are not allowed
            Open

                }

            Spaces must be used for alignment; tabs are not allowed
            Open

                {

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $response->emit();

            Spaces must be used for alignment; tabs are not allowed
            Open

                 * Check if there are more messages.

            Spaces must be used for alignment; tabs are not allowed
            Open

                 *

            Spaces must be used for alignment; tabs are not allowed
            Open

                    if ($isNextPage) {

            Spaces must be used for alignment; tabs are not allowed
            Open

                    ]);

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $response->emit();

            Spaces must be used for alignment; tabs are not allowed
            Open

                 *

            Spaces must be used for alignment; tabs are not allowed
            Open

                 * Add participant.

            Spaces must be used for alignment; tabs are not allowed
            Open

                public function addParticipant(App\Request $request)

            Spaces must be used for alignment; tabs are not allowed
            Open

                    } else {

            Spaces must be used for alignment; tabs are not allowed
            Open

                 * @param \App\Request $request

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $response = new Vtiger_Response();

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $response->setResult([

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $roomType = $request->getByType('roomType');

            Spaces must be used for alignment; tabs are not allowed
            Open

                 * Show chat for record.

            Spaces must be used for alignment; tabs are not allowed
            Open

                 * @param \App\Request $request

            Spaces must be used for alignment; tabs are not allowed
            Open

                 * @param \App\Request $request

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $roomType = $request->getByType('roomType');

            Spaces must be used for alignment; tabs are not allowed
            Open

                    if (!$chat->isRoomModerator($recordId)) {

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $chat = \App\Chat::getInstance('private', $recordId);

            Spaces must be used for alignment; tabs are not allowed
            Open

                 */

            Spaces must be used for alignment; tabs are not allowed
            Open

                        $unreadMessages[$roomType] = \App\Chat::getUnreadByType($roomType);

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $response->emit();

            Spaces must be used for alignment; tabs are not allowed
            Open

                 */

            Spaces must be used for alignment; tabs are not allowed
            Open

                public function getRoomsUnpinned(App\Request $request)

            Spaces must be used for alignment; tabs are not allowed
            Open

                {

            Spaces must be used for alignment; tabs are not allowed
            Open

                    } else {

            Spaces must be used for alignment; tabs are not allowed
            Open

                        }

            Spaces must be used for alignment; tabs are not allowed
            Open

                 * @throws \App\Exceptions\IllegalValue

            Spaces must be used for alignment; tabs are not allowed
            Open

                {

            Spaces must be used for alignment; tabs are not allowed
            Open

                        $roomType = $room['roomType'];

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $response->setResult($result);

            Spaces must be used for alignment; tabs are not allowed
            Open

                        array_shift($chatEntries);

            Spaces must be used for alignment; tabs are not allowed
            Open

                    }

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $recordId = $request->getInteger('recordId');

            Spaces must be used for alignment; tabs are not allowed
            Open

                            'participants' => $chat->getParticipants(),

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $response->emit();

            Spaces must be used for alignment; tabs are not allowed
            Open

                 *

            Spaces must be used for alignment; tabs are not allowed
            Open

                public function search(App\Request $request)

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $response->setResult(\App\Chat::getRoomsByUser());

            Spaces must be used for alignment; tabs are not allowed
            Open

                 * @throws \App\Exceptions\IllegalValue

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $response->emit();

            Spaces must be used for alignment; tabs are not allowed
            Open

                 * Get history.

            Spaces must be used for alignment; tabs are not allowed
            Open

                    if ($isNextPage) {

            Spaces must be used for alignment; tabs are not allowed
            Open

                 *

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $response = new Vtiger_Response();

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $response->setResult(\App\Chat::{$methodName}());

            Spaces must be used for alignment; tabs are not allowed
            Open

                    }

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $chat = \App\Chat::getInstance('crm', $recordId);

            Spaces must be used for alignment; tabs are not allowed
            Open

                                    'recordid' => $recordId,

            Spaces must be used for alignment; tabs are not allowed
            Open

                                    'participants' => $chat->getParticipants(),

            Spaces must be used for alignment; tabs are not allowed
            Open

                                ]

            Spaces must be used for alignment; tabs are not allowed
            Open

                public function getRoomPrivateUnpinnedUsers(App\Request $request)

            Spaces must be used for alignment; tabs are not allowed
            Open

                private function isNextPage(int $numberOfMessages): bool

            Spaces must be used for alignment; tabs are not allowed
            Open

                    return $numberOfMessages >= \App\Config::module('Chat', 'CHAT_ROWS_LIMIT') + 1;

            Spaces must be used for alignment; tabs are not allowed
            Open

                 */

            Spaces must be used for alignment; tabs are not allowed
            Open

                {

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $response = new Vtiger_Response();

            Spaces must be used for alignment; tabs are not allowed
            Open

                {

            Spaces must be used for alignment; tabs are not allowed
            Open

                 *

            Spaces must be used for alignment; tabs are not allowed
            Open

                 * @throws \App\Exceptions\AppException

            Spaces must be used for alignment; tabs are not allowed
            Open

                {

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $response = new Vtiger_Response();

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $response->setResult($unreadMessages);

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $groupHistory = $request->getByType('groupHistory', 2);

            Spaces must be used for alignment; tabs are not allowed
            Open

                        'showMoreButton' => $isNextPage

            Spaces must be used for alignment; tabs are not allowed
            Open

                 */

            Spaces must be used for alignment; tabs are not allowed
            Open

                }

            Spaces must be used for alignment; tabs are not allowed
            Open

                                    'showMoreButton' => \count($chatEntries) > \App\Config::module('Chat', 'CHAT_ROWS_LIMIT')

            Spaces must be used for alignment; tabs are not allowed
            Open

                }

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $searchVal = $request->getByType('searchVal', 'Text');

            Spaces must be used for alignment; tabs are not allowed
            Open

                        'showMoreButton' => $isNextPage

            Spaces must be used for alignment; tabs are not allowed
            Open

                 * Add private room.

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $response = new Vtiger_Response();

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $response->setResult($result);

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $response->emit();

            Spaces must be used for alignment; tabs are not allowed
            Open

                /**

            Spaces must be used for alignment; tabs are not allowed
            Open

                    foreach (\App\Chat::getActiveRoomTypes() as $roomType) {

            Spaces must be used for alignment; tabs are not allowed
            Open

                public function getHistory(App\Request $request)

            Spaces must be used for alignment; tabs are not allowed
            Open

                    }

            Spaces must be used for alignment; tabs are not allowed
            Open

                /**

            Spaces must be used for alignment; tabs are not allowed
            Open

                /**

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $response->emit();

            Spaces must be used for alignment; tabs are not allowed
            Open

                                    'roomType' => 'crm',

            Spaces must be used for alignment; tabs are not allowed
            Open

                        $chatEntries = $chat->getEntries(null, '>', $searchVal);

            Spaces must be used for alignment; tabs are not allowed
            Open

                /**

            Spaces must be used for alignment; tabs are not allowed
            Open

                }

            Spaces must be used for alignment; tabs are not allowed
            Open

                 */

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $recordId = $request->getInteger('recordId');

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $chat = \App\Chat::getInstance('private', $recordId);

            Spaces must be used for alignment; tabs are not allowed
            Open

                    if ($alreadyInvited) {

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $response = new Vtiger_Response();

            Spaces must be used for alignment; tabs are not allowed
            Open

                }

            Spaces must be used for alignment; tabs are not allowed
            Open

                /**

            Spaces must be used for alignment; tabs are not allowed
            Open

                public function getRecordRoom(App\Request $request)

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $chatEntries = $chat->getEntries();

            Spaces must be used for alignment; tabs are not allowed
            Open

                                    'recordRoom' => true,

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $response->emit();

            Spaces must be used for alignment; tabs are not allowed
            Open

                {

            Spaces must be used for alignment; tabs are not allowed
            Open

                    } else {

            Spaces must be used for alignment; tabs are not allowed
            Open

                 *

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $response = new Vtiger_Response();

            Spaces must be used for alignment; tabs are not allowed
            Open

                /**

            Spaces must be used for alignment; tabs are not allowed
            Open

                 */

            Spaces must be used for alignment; tabs are not allowed
            Open

                }

            Spaces must be used for alignment; tabs are not allowed
            Open

                 *

            Spaces must be used for alignment; tabs are not allowed
            Open

                 * @throws \App\Exceptions\AppException

            Spaces must be used for alignment; tabs are not allowed
            Open

                 */

            Spaces must be used for alignment; tabs are not allowed
            Open

                    } else {

            Spaces must be used for alignment; tabs are not allowed
            Open

                            'crm' => [

            Spaces must be used for alignment; tabs are not allowed
            Open

                 */

            Spaces must be used for alignment; tabs are not allowed
            Open

                        $chatEntries = $chat->getEntries($request->getInteger('mid'), '<', $searchVal);

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $chat = \App\Chat::getInstance();

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $response->emit();

            Spaces must be used for alignment; tabs are not allowed
            Open

                        throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);

            Spaces must be used for alignment; tabs are not allowed
            Open

                    }

            Spaces must be used for alignment; tabs are not allowed
            Open

                    if (\App\Chat::getCurrentRoom()['recordId'] === $recordId) {

            Spaces must be used for alignment; tabs are not allowed
            Open

                 *

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $recordId = $request->getInteger('recordId');

            Spaces must be used for alignment; tabs are not allowed
            Open

                    }

            Spaces must be used for alignment; tabs are not allowed
            Open

                public function getUnread(App\Request $request)

            Spaces must be used for alignment; tabs are not allowed
            Open

                    }

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $response->setResult([

            Spaces must be used for alignment; tabs are not allowed
            Open

                {

            Spaces must be used for alignment; tabs are not allowed
            Open

                 *

            Spaces must be used for alignment; tabs are not allowed
            Open

                 */

            Spaces must be used for alignment; tabs are not allowed
            Open

                        throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $response = new Vtiger_Response();

            Spaces must be used for alignment; tabs are not allowed
            Open

                            ]

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $response->setResult(\App\Chat::getRoomPrivateUnpinnedUsers($request->getInteger('roomId')));

            Spaces must be used for alignment; tabs are not allowed
            Open

                 * @return bool

            Spaces must be used for alignment; tabs are not allowed
            Open

                 * @param \App\Request $request

            Spaces must be used for alignment; tabs are not allowed
            Open

                public function archivePrivateRoom(App\Request $request)

            Spaces must be used for alignment; tabs are not allowed
            Open

                        throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);

            Spaces must be used for alignment; tabs are not allowed
            Open

                        array_shift($chatEntries);

            Spaces must be used for alignment; tabs are not allowed
            Open

                    ]);

            Spaces must be used for alignment; tabs are not allowed
            Open

                 * Get rooms unpinned.

            Spaces must be used for alignment; tabs are not allowed
            Open

                                    'active' => true,

            Spaces must be used for alignment; tabs are not allowed
            Open

                /**

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $response = new Vtiger_Response();

            Spaces must be used for alignment; tabs are not allowed
            Open

                }

            Spaces must be used for alignment; tabs are not allowed
            Open

                                $recordId => [

            Spaces must be used for alignment; tabs are not allowed
            Open

                                    'chatEntries' => $chatEntries,

            Spaces must be used for alignment; tabs are not allowed
            Open

                 * Get room private unpinned users.

            Spaces must be used for alignment; tabs are not allowed
            Open

                 */

            Spaces must be used for alignment; tabs are not allowed
            Open

                /**

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $response->setResult([

            Spaces must be used for alignment; tabs are not allowed
            Open

                }

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $methodName = 'getRooms' . ucfirst($roomType) . 'Unpinned';

            Spaces must be used for alignment; tabs are not allowed
            Open

                 *

            Spaces must be used for alignment; tabs are not allowed
            Open

                    if (!$recordModel->isViewable()) {

            Spaces must be used for alignment; tabs are not allowed
            Open

                        'roomList' => [

            Spaces must be used for alignment; tabs are not allowed
            Open

                {

            Spaces must be used for alignment; tabs are not allowed
            Open

                    $recordId = $request->getInteger('id');

            Spaces must be used for alignment; tabs are not allowed
            Open

                    ]);

            Spaces must be used for alignment; tabs are not allowed
            Open

                 */

            Spaces must be used for alignment; tabs are not allowed
            Open

                 * @throws \App\Exceptions\NoPermittedToRecord

            Spaces must be used for alignment; tabs are not allowed
            Open

                 * @param int $numberOfMessages

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

                 */

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

                    $this->exposeMethod('getMessages');

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

                    $this->exposeMethod('addPrivateRoom');

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

                    }

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

                            'isChatAllowed' => $userRealID === \App\User::getCurrentUserId(),

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

                            'defaultRoom' => \App\Chat::getDefaultRoom(),

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

                            'showRoleName' => \App\Config::module('Users', 'SHOW_ROLE_NAME'),

            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

                    $userRoomPin = \App\Config::module('Chat', 'userRoomPin');

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

                    if (!$userRoomPin) {

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

                        'config' => [

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

                            'userRoomPin' => $userRoomPin

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

                    $response = new Vtiger_Response();

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

                    $this->exposeMethod('getRecordRoom');

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

                    $this->exposeMethod('search');

            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

                    $userPrivileges = \Users_Privileges_Model::getCurrentUserPrivilegesModel();

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

                {

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

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

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

                            'dynamicAddingRooms' => \App\Config::module('Chat', 'dynamicAddingRooms'),

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

                }

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

                            'showNumberOfNewMessages' => \App\Config::module('Chat', 'SHOW_NUMBER_OF_NEW_MESSAGES'),

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

                    if ($result['config']['dynamicAddingRooms']) {

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

                }

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

                 * Get messages from chat.

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

                }

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

                    $this->exposeMethod('getRoomsMessages');

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

                    $this->exposeMethod('addParticipant');

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

                {

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

                }

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

                    $result = [

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

                            'maxLengthMessage' => \App\Config::module('Chat', 'MAX_LENGTH_MESSAGE'),

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

                        $result['config']['chatModules'] = \App\Chat::getChatModules();

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

                 * @param \App\Request $request

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

                {

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

                    parent::__construct();

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

                    $this->exposeMethod('getMoreMessages');

            Line exceeds 120 characters; contains 136 characters
            Open

                    if (!$userPrivileges->hasModulePermission($request->getModule()) || $userPrivileges->getId() !== $userPrivileges->getRealId()) {

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

                 *

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

                            'isAdmin' => \Users_Privileges_Model::getCurrentUserPrivilegesModel()->isAdminUser(),

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

                    }

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

                    $response->setResult($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

                 * Get chat init data.

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

                        'roomList' => \App\Chat::getRoomsByUser(),

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

                    $response->emit();

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

                {

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

                    $this->exposeMethod('getRooms');

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

                    $this->exposeMethod('getRoomPrivateUnpinnedUsers');

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

                        throw new \App\Exceptions\NoPermitted('ERR_NOT_ACCESSIBLE', 406);

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

                            'isDefaultSoundNotification' => \App\Config::module('Chat', 'DEFAULT_SOUND_NOTIFICATION'),

            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 getMessages(App\Request $request)

            Line exceeds 120 characters; contains 149 characters
            Open

                            'data' => $this->setMessagesResult(new App\Request(['roomType' => $defaultRoom['roomType'], 'recordId' => $defaultRoom['recordId']]))

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

                use \App\Controller\ExposeMethod;

            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

                public function isSessionExtend(App\Request $request)

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

                 */

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

                            'refreshRoomTime' => \App\Config::module('Chat', 'REFRESH_ROOM_TIME'),

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

                            'activeRoomTypes' => \App\Chat::getActiveRoomTypes(),

            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 getChatConfig(App\Request $request)

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

                 * Constructor.

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

                    $this->exposeMethod('getUnread');

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

                    $this->exposeMethod('send');

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

                    }

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

                        'currentRoom' => \App\Chat::getCurrentRoom()

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

                /**

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

                    $response->emit();

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

                    $this->exposeMethod('getChatConfig');

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

                 * @return void

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

                            'draggableButton' => false,

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

                 *

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

                    $response = new Vtiger_Response();

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

                public function __construct()

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

                public function checkPermission(App\Request $request)

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

                    if (!$userPrivileges->hasModulePermission($request->getModule()) || $userPrivileges->getId() !== $userPrivileges->getRealId()) {

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

                 * @param App\Request $request

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

                 *

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

                            'refreshTimeGlobal' => \App\Config::module('Chat', 'REFRESH_TIME_GLOBAL'),

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

                        ],

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

                 *    Set messages result.

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

                    $this->exposeMethod('getRoomsUnpinned');

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

                    $this->exposeMethod('archivePrivateRoom');

            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

                    $this->exposeMethod('getHistory');

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

                        \App\Chat::pinAllUsers($userRealID);

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

                            'refreshMessageTime' => \App\Config::module('Chat', 'REFRESH_MESSAGE_TIME'),

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

                    $response->setResult($this->setMessagesResult($request));

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

            class Chat_ChatAjax_Action extends \App\Controller\Action

            There are no issues that match your filters.

            Category
            Status