jackkum/PHPPDU

View on GitHub

Showing 19 of 23 total issues

Method _prepareParts has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function _prepareParts()
    {
        // 
        $headerSize = self::HEADER_SIZE;
        $max        = Helper::getLimit('normal');
Severity: Major
Found in PDU/Data.php - About 2 hrs to fix

    PDU has 21 functions (exceeds 20 allowed). Consider refactoring.
    Open

    abstract class PDU {
        
        /**
         * Service Centre Address
         * @var PDU\SCA
    Severity: Minor
    Found in PDU.php - About 2 hrs to fix

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

          public function getValue()
          {
              $this->_encodeGroup = 0x00;
              
              // set data encoding, from alphabet and message class
      Severity: Minor
      Found in PDU/DCS.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 parse has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function parse($isAddress = TRUE)
          {
              $SCA     = new self($isAddress);
              $size    = hexdec(PDU::getPduSubstr(2));
              
      Severity: Minor
      Found in PDU/SCA.php - About 1 hr to fix

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

            public function __toString()
            {
                // get pdu type
                $type = $this->getPdu()->getType();
                
        Severity: Minor
        Found in PDU/VP.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 getValue has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getValue()
            {
                $this->_encodeGroup = 0x00;
                
                // set data encoding, from alphabet and message class
        Severity: Minor
        Found in PDU/DCS.php - About 1 hr to fix

          Method parse has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function parse(Data $data)
              {
                  $alphabet = $data->getPdu()->getDcs()->getTextAlphabet();
                  $header   = NULL;
                  $length   = $data->getPdu()->getUdl() * ($alphabet == PDU\DCS::ALPHABET_UCS2 ? 4 : 2);
          Severity: Minor
          Found in PDU/Data/Part.php - About 1 hr to fix

            Function parse has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function parse()
                {
                    $DCS  = new self();
                    $byte = hexdec(PDU::getPduSubstr(2));
                    
            Severity: Minor
            Found in PDU/DCS.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 parse has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function parse()
                {
                    $DCS  = new self();
                    $byte = hexdec(PDU::getPduSubstr(2));
                    
            Severity: Minor
            Found in PDU/DCS.php - About 1 hr to fix

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

                  protected function _prepareParts()
                  {
                      // 
                      $headerSize = self::HEADER_SIZE;
                      $max        = Helper::getLimit('normal');
              Severity: Minor
              Found in PDU/Data.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 parse has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function parse($isAddress = TRUE)
                  {
                      $SCA     = new self($isAddress);
                      $size    = hexdec(PDU::getPduSubstr(2));
                      
              Severity: Minor
              Found in PDU/SCA.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 parse has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function parse(Submit $pdu)
                  {
                      $vp = new self($pdu);
                      
                      switch($pdu->getType()->getVpf()){
              Severity: Minor
              Found in PDU/VP.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

              Avoid too many return statements within this method.
              Open

                              return sprintf("%02X", ($weeks > 63 ? 63 : $weeks)+192);
              Severity: Major
              Found in PDU/VP.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            case 0x0E: return "c";
                Severity: Major
                Found in PDU/SCA.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                              default: return $letter;
                  Severity: Major
                  Found in PDU/SCA.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                            return "";
                    Severity: Major
                    Found in PDU/VP.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                  default: return $letter;
                      Severity: Major
                      Found in PDU/SCA.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                    case "c": return 'E';
                        Severity: Major
                        Found in PDU/SCA.php - About 30 mins to fix

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

                              public function __toString()
                              {
                                  $PDU = sprintf("%02X", $this->getSize());
                                  
                                  if($this->getSize()){
                          Severity: Minor
                          Found in PDU/SCA.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