koraktor/steam-condenser-php

View on GitHub

Showing 38 of 40 total issues

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

    public function connect($ipAddress, $portNumber, $timeout) {
        $this->ipAddress = $ipAddress;
        $this->portNumber = $portNumber;

        if($this->socketsEnabled) {
Severity: Minor
Found in lib/SteamCondenser/TCPSocket.php - About 1 hr to fix

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

        public static function create($appId, $steamId, $fetchNow = true, $bypassCache = false) {
            if (is_numeric($steamId)) {
                $steamId64 = $steamId;
            } else {
                $steamId64 = SteamId::resolveVanityUrl($steamId);
    Severity: Minor
    Found in lib/SteamCondenser/Community/GameInventory.php - About 1 hr to fix

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

          public function __construct(GameInventory $inventory, $itemData) {
              $this->inventory = $inventory;
      
              $this->defindex         = $itemData->defindex;
              $this->backpackPosition = $itemData->inventory & 0xffff;
      Severity: Minor
      Found in lib/SteamCondenser/Community/GameItem.php - About 55 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

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

          public function getReply() {
              $bytesRead = $this->receivePacket(1400);
      
              if($this->buffer->getLong() == -2) {
                  do {
      Severity: Minor
      Found in lib/SteamCondenser/Servers/Sockets/GoldSrcSocket.php - About 55 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

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

          public function connect($ipAddress, $portNumber, $timeout) {
              $this->ipAddress = $ipAddress;
              $this->portNumber = $portNumber;
      
              if($this->socketsEnabled) {
      Severity: Minor
      Found in lib/SteamCondenser/UDPSocket.php - About 45 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

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

          public function rconExec($password, $command) {
              if($this->rconChallenge == -1 || $this->isHLTV) {
                  $this->rconGetChallenge();
              }
      
      
      Severity: Minor
      Found in lib/SteamCondenser/Servers/Sockets/GoldSrcSocket.php - About 45 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

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

          public static function create($appId, $steamId, $fetchNow = true, $bypassCache = false) {
              if (is_numeric($steamId)) {
                  $steamId64 = $steamId;
              } else {
                  $steamId64 = SteamId::resolveVanityUrl($steamId);
      Severity: Minor
      Found in lib/SteamCondenser/Community/GameInventory.php - About 45 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

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

          protected function getPlayerStatusAttributes($statusHeader) {
              $statusAttributes = [];
              foreach(preg_split("/\s+/", $statusHeader) as $attribute) {
                  if($attribute == 'connected') {
                      $statusAttributes[] = 'time';
      Severity: Minor
      Found in lib/SteamCondenser/Servers/GameServer.php - About 45 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

      Method load has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public static function load($format, $interface, $method, $version = 1, $params = null) {
      Severity: Minor
      Found in lib/SteamCondenser/Community/WebApi.php - About 35 mins to fix

        Method _load has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            protected function _load($format, $interface, $method, $version = 1, $params = null) {
        Severity: Minor
        Found in lib/SteamCondenser/Community/WebApi.php - About 35 mins to fix

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

              public function addInformation($playerData) {
                  if($playerData['name'] != $this->name) {
                      throw new SteamCondenserException('Information to add belongs to a different player.');
                  }
          
          
          Severity: Minor
          Found in lib/SteamCondenser/Servers/SteamPlayer.php - About 35 mins to fix

          Cognitive Complexity

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

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

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

          Further reading

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

              protected function internalFetch() {
                  $params = ['SteamID' => $this->steamId64];
                  $result = WebApi::getJSONData("IEconItems_{$this->getAppId()}", 'GetPlayerItems', 1, $params);
          
                  $this->items = [];
          Severity: Minor
          Found in lib/SteamCondenser/Community/GameInventory.php - About 35 mins to fix

          Cognitive Complexity

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

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

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

          Further reading

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

              protected function addLanguage($language) {
                  $schema = $this->fetchLanguage($language);
          
                  $initial = false;
                  if (empty($this->data)) {
          Severity: Minor
          Found in lib/SteamCondenser/Community/GameStatsSchema.php - About 35 mins to fix

          Cognitive Complexity

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

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

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

          Further reading

          Avoid too many return statements within this method.
          Open

                          return new M2ASERVERBATCHPacket($data);
          Severity: Major
          Found in lib/SteamCondenser/Servers/Packets/SteamPacketFactory.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                            return new S2CCHALLENGEPacket($data);
            Severity: Major
            Found in lib/SteamCondenser/Servers/Packets/SteamPacketFactory.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                              return new RCONGoldSrcResponse($data);
              Severity: Major
              Found in lib/SteamCondenser/Servers/Packets/SteamPacketFactory.php - About 30 mins to fix

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

                    public static function create() {
                        $args = func_get_args();
                        $className = empty(self::$className) ? get_class() : self::$className;
                        $class = new \ReflectionClass($className);
                        $constructor = $class->getConstructor();
                Severity: Minor
                Found in lib/SteamCondenser/Community/Cacheable.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

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

                    public function send($data) {
                        if($this->socketsEnabled) {
                            $sendResult = socket_send($this->socket, $data, strlen($data), 0);
                            if ($sendResult === false) {
                                throw new SocketException(socket_last_error($this->socket));
                Severity: Minor
                Found in lib/SteamCondenser/Socket.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

                Severity
                Category
                Status
                Source
                Language