spotweb/spotweb

View on GitHub
lib/services/Format/Services_Format_Parsing.php

Summary

Maintainability
F
3 days
Test Coverage

Function parseHeader has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring.
Open

    public function parseHeader($subj, $from, $date, $messageid, $rsaKeys)
    {
        // Initialize an empty array, we create a basic template in a few
        $spot = [];

Severity: Minor
Found in lib/services/Format/Services_Format_Parsing.php - About 1 day 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 parseHeader has 152 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function parseHeader($subj, $from, $date, $messageid, $rsaKeys)
    {
        // Initialize an empty array, we create a basic template in a few
        $spot = [];

Severity: Major
Found in lib/services/Format/Services_Format_Parsing.php - About 6 hrs to fix

    Function parseFull has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

        public function parseFull($xmlStr)
        {
            // Create a template array so we always have the full fields to prevent ugly notices
            $tpl_spot = ['category' => '', 'website' => '', 'image' => '', 'sabnzbdurl' => '', 'messageid' => '', 'searchurl' => '', 'description' => '',
                'sub'               => '', 'filesize' => '', 'poster' => '', 'tag' => '', 'nzb' => [], 'title' => '',
    Severity: Minor
    Found in lib/services/Format/Services_Format_Parsing.php - About 5 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 parseFull has 92 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function parseFull($xmlStr)
        {
            // Create a template array so we always have the full fields to prevent ugly notices
            $tpl_spot = ['category' => '', 'website' => '', 'image' => '', 'sabnzbdurl' => '', 'messageid' => '', 'searchurl' => '', 'description' => '',
                'sub'               => '', 'filesize' => '', 'poster' => '', 'tag' => '', 'nzb' => [], 'title' => '',
    Severity: Major
    Found in lib/services/Format/Services_Format_Parsing.php - About 3 hrs to fix

      File Services_Format_Parsing.php has 290 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      class Services_Format_Parsing
      {
          private $_spotSigning = null;
      Severity: Minor
      Found in lib/services/Format/Services_Format_Parsing.php - About 2 hrs to fix

        Avoid deeply nested control flow statements.
        Open

                                        if ($this->_spotSigning->verifySpotHeader($spot, $signature, $userRsaKey)) {
                                            $spot['spotterid'] = $this->_util->calculateSpotterId($spot['selfsignedpubkey']);
                                        } // if
        Severity: Major
        Found in lib/services/Format/Services_Format_Parsing.php - About 45 mins to fix

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

              public function parseHeader($subj, $from, $date, $messageid, $rsaKeys)
          Severity: Minor
          Found in lib/services/Format/Services_Format_Parsing.php - About 35 mins to fix

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

                private function correctElmContents($xmlStr, $elems)
                {
                    $cdataStart = '<![CDATA[';
                    $cdataEnd = ']]>';
            
            
            Severity: Minor
            Found in lib/services/Format/Services_Format_Parsing.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 $spot;
            Severity: Major
            Found in lib/services/Format/Services_Format_Parsing.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return $spot;
              Severity: Major
              Found in lib/services/Format/Services_Format_Parsing.php - About 30 mins to fix

                There are no issues that match your filters.

                Category
                Status