koraktor/steam-condenser-php

View on GitHub

Showing 38 of 40 total issues

SteamId has 31 functions (exceeds 20 allowed). Consider refactoring.
Open

class SteamId extends XMLData {

    use Cacheable;

    /**
Severity: Minor
Found in lib/SteamCondenser/Community/SteamId.php - About 3 hrs to fix

    Function getServers has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getServers($regionCode = MasterServer::REGION_ALL , $filter = '', $force = false) {
            $failCount   = 0;
            $finished    = false;
            $portNumber  = 0;
            $hostName    = '0.0.0.0';
    Severity: Minor
    Found in lib/SteamCondenser/Servers/MasterServer.php - About 3 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function __toString has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        public function __toString() {
            $returnString = '';
    
            $returnString .= "Ping: {$this->ping}\n";
            $returnString .= "Challenge number: {$this->challengeNumber}\n";
    Severity: Minor
    Found in lib/SteamCondenser/Servers/GameServer.php - About 2 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

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

        public function getReply() {
            $this->receivePacket(1400);
            $isCompressed = false;
    
            if($this->buffer->getLong() == -2) {
    Severity: Minor
    Found in lib/SteamCondenser/Servers/Sockets/SourceSocket.php - About 2 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

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

        public function internalFetch() {
            $params = ['language' => $this->language];
            $data = WebApi::getJSONData("IEconItems_{$this->appId}", 'GetSchema', 1, $params);
    
            $this->attributes = [];
    Severity: Minor
    Found in lib/SteamCondenser/Community/GameItemSchema.php - About 2 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    Method internalFetch has 47 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function internalFetch() {
            $params = ['language' => $this->language];
            $data = WebApi::getJSONData("IEconItems_{$this->appId}", 'GetSchema', 1, $params);
    
            $this->attributes = [];
    Severity: Minor
    Found in lib/SteamCondenser/Community/GameItemSchema.php - About 1 hr to fix

      Method __construct has 44 lines of code (exceeds 25 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 1 hr to fix

        Method getServers has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getServers($regionCode = MasterServer::REGION_ALL , $filter = '', $force = false) {
                $failCount   = 0;
                $finished    = false;
                $portNumber  = 0;
                $hostName    = '0.0.0.0';
        Severity: Minor
        Found in lib/SteamCondenser/Servers/MasterServer.php - About 1 hr to fix

          Method getReply has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getReply() {
                  $this->receivePacket(1400);
                  $isCompressed = false;
          
                  if($this->buffer->getLong() == -2) {
          Severity: Minor
          Found in lib/SteamCondenser/Servers/Sockets/SourceSocket.php - About 1 hr to fix

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

                protected function handleResponseForRequest($requestType, $repeatOnFailure = true) {
                    switch($requestType) {
                        case self::REQUEST_CHALLENGE:
                            $expectedResponse = '\SteamCondenser\Servers\Packets\S2CCHALLENGEPacket';
                            $requestPacket    = new A2SPLAYERPacket();
            Severity: Minor
            Found in lib/SteamCondenser/Servers/GameServer.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 handleResponseForRequest has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function handleResponseForRequest($requestType, $repeatOnFailure = true) {
                    switch($requestType) {
                        case self::REQUEST_CHALLENGE:
                            $expectedResponse = '\SteamCondenser\Servers\Packets\S2CCHALLENGEPacket';
                            $requestPacket    = new A2SPLAYERPacket();
            Severity: Minor
            Found in lib/SteamCondenser/Servers/GameServer.php - About 1 hr to fix

              Method __construct has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function __construct($data) {
                      parent::__construct(SteamPacket::S2A_INFO2_HEADER, $data);
              
                      $this->info['networkVersion'] = $this->contentData->getByte();
                      $this->info['serverName'] = $this->contentData->getString();
              Severity: Minor
              Found in lib/SteamCondenser/Servers/Packets/S2AINFO2Packet.php - About 1 hr to fix

                Function connect has a Cognitive Complexity of 11 (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/TCPSocket.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 __construct has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function __construct($data) {
                        parent::__construct(SteamPacket::S2A_INFO2_HEADER, $data);
                
                        $this->info['networkVersion'] = $this->contentData->getByte();
                        $this->info['serverName'] = $this->contentData->getString();
                Severity: Minor
                Found in lib/SteamCondenser/Servers/Packets/S2AINFO2Packet.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 __toString has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function __toString() {
                        $returnString = '';
                
                        $returnString .= "Ping: {$this->ping}\n";
                        $returnString .= "Challenge number: {$this->challengeNumber}\n";
                Severity: Minor
                Found in lib/SteamCondenser/Servers/GameServer.php - About 1 hr to fix

                  Method __construct has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function __construct($data) {
                          parent::__construct(SteamPacket::S2A_INFO_DETAILED_HEADER, $data);
                  
                          $this->info['serverIp'] = $this->contentData->getString();
                          $this->info['serverName'] = $this->contentData->getString();
                  Severity: Minor
                  Found in lib/SteamCondenser/Servers/Packets/S2AINFODETAILEDPacket.php - About 1 hr to fix

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

                        protected function splitPlayerStatus($attributes, $playerStatus) {
                            if($attributes[0] != 'userid') {
                                $playerStatus = preg_replace('/^\d+ +/', '', $playerStatus);
                            }
                    
                    
                    Severity: Minor
                    Found in lib/SteamCondenser/Servers/GameServer.php - About 1 hr to fix

                      Function recv has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function recv($length = 128) {
                              if($this->socketsEnabled) {
                                  $data = socket_read($this->socket, $length);
                      
                                  if ($data === false) {
                      Severity: Minor
                      Found in lib/SteamCondenser/Socket.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 updatePlayers has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function updatePlayers($rconPassword = null) {
                              $this->handleResponseForRequest(self::REQUEST_PLAYER);
                      
                              if(!$this->rconAuthenticated) {
                                  if($rconPassword == null) {
                      Severity: Minor
                      Found in lib/SteamCondenser/Servers/GameServer.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 getLeaderboard has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public static function getLeaderboard($gameName, $id) {
                              $leaderboards = self::getLeaderboards($gameName);
                      
                              if (is_int($id)) {
                                  if (array_key_exists($id, $leaderboards)) {
                      Severity: Minor
                      Found in lib/SteamCondenser/Community/GameLeaderboard.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

                      Severity
                      Category
                      Status
                      Source
                      Language