CaffGeek/MBACNationals

View on GitHub
Web.Admin/2014/wordpress/wp-includes/ID3/module.audio-video.asf.php

Summary

Maintainability
F
2 wks
Test Coverage

Function Analyze has a Cognitive Complexity of 288 (exceeds 5 allowed). Consider refactoring.
Open

    public function Analyze() {
        $info = &$this->getid3->info;

        // Shortcuts
        $thisfile_audio = &$info['audio'];
Severity: Minor
Found in Web.Admin/2014/wordpress/wp-includes/ID3/module.audio-video.asf.php - About 5 days 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 Analyze has 917 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function Analyze() {
        $info = &$this->getid3->info;

        // Shortcuts
        $thisfile_audio = &$info['audio'];
Severity: Major
Found in Web.Admin/2014/wordpress/wp-includes/ID3/module.audio-video.asf.php - About 4 days to fix

    File module.audio-video.asf.php has 1378 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /////////////////////////////////////////////////////////////////
    /// getID3() by James Heinrich <info@getid3.org>               //
    //  available at http://getid3.sourceforge.net                 //
    //            or http://www.getid3.org                         //
    Severity: Major
    Found in Web.Admin/2014/wordpress/wp-includes/ID3/module.audio-video.asf.php - About 3 days to fix

      Method ASF_HeaderExtensionObjectDataParse has 177 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function ASF_HeaderExtensionObjectDataParse(&$asf_header_extension_object_data, &$unhandled_sections) {
              // http://msdn.microsoft.com/en-us/library/bb643323.aspx
      
              $offset = 0;
              $objectOffset = 0;
      Severity: Major
      Found in Web.Admin/2014/wordpress/wp-includes/ID3/module.audio-video.asf.php - About 7 hrs to fix

        Function ASF_HeaderExtensionObjectDataParse has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
        Open

            public function ASF_HeaderExtensionObjectDataParse(&$asf_header_extension_object_data, &$unhandled_sections) {
                // http://msdn.microsoft.com/en-us/library/bb643323.aspx
        
                $offset = 0;
                $objectOffset = 0;
        Severity: Minor
        Found in Web.Admin/2014/wordpress/wp-includes/ID3/module.audio-video.asf.php - About 6 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 KnownGUIDs has 111 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function KnownGUIDs() {
                static $GUIDarray = array(
                    'GETID3_ASF_Extended_Stream_Properties_Object'   => '14E6A5CB-C672-4332-8399-A96952065B5A',
                    'GETID3_ASF_Padding_Object'                      => '1806D474-CADF-4509-A4BA-9AABCB96AAE8',
                    'GETID3_ASF_Payload_Ext_Syst_Pixel_Aspect_Ratio' => '1B1EE554-F9EA-4BC8-821A-376B74E4C4B8',
        Severity: Major
        Found in Web.Admin/2014/wordpress/wp-includes/ID3/module.audio-video.asf.php - About 4 hrs to fix

          Method ASF_WMpicture has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function ASF_WMpicture(&$data) {
                  //typedef struct _WMPicture{
                  //  LPWSTR  pwszMIMEType;
                  //  BYTE  bPictureType;
                  //  LPWSTR  pwszDescription;
          Severity: Minor
          Found in Web.Admin/2014/wordpress/wp-includes/ID3/module.audio-video.asf.php - About 1 hr to fix

            Avoid deeply nested control flow statements.
            Open

                                            if (empty($thisfile_video['bitrate']) && !empty($thisfile_audio['bitrate']) && !empty($info['bitrate'])) {
                                                //$thisfile_video['bitrate'] = $thisfile_asf['file_properties_object']['max_bitrate'] - $thisfile_audio['bitrate'];
                                                $thisfile_video['bitrate'] = $info['bitrate'] - $thisfile_audio['bitrate'];
                                            }
            Severity: Major
            Found in Web.Admin/2014/wordpress/wp-includes/ID3/module.audio-video.asf.php - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                              switch ($AudioCodecFrequency) {
                                                  case 8:
                                                  case 8000:
                                                      $thisfile_audio['sample_rate'] = 8000;
                                                      break;
              Severity: Major
              Found in Web.Admin/2014/wordpress/wp-includes/ID3/module.audio-video.asf.php - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                                    if ($info['mime_type'] == 'video/x-ms-asf') {
                                                        $info['mime_type'] = 'video/x-ms-wmv';
                                                    }
                Severity: Major
                Found in Web.Admin/2014/wordpress/wp-includes/ID3/module.audio-video.asf.php - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                                  if (class_exists('getid3_id3v2')) {
                                                      $tempfile         = tempnam(GETID3_TEMP_DIR, 'getID3');
                                                      $tempfilehandle   = fopen($tempfile, 'wb');
                                                      $tempThisfileInfo = array('encoding'=>$info['encoding']);
                                                      fwrite($tempfilehandle, $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']);
                  Severity: Major
                  Found in Web.Admin/2014/wordpress/wp-includes/ID3/module.audio-video.asf.php - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                                        if (preg_match('/^[0-9\x00]+$/', $value)) {
                                                            $thisfile_asf_comments['track'][$key] = intval(str_replace("\x00", '', $value));
                                                        }
                    Severity: Major
                    Found in Web.Admin/2014/wordpress/wp-includes/ID3/module.audio-video.asf.php - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                                      if ($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']) {
                                                          $thisfile_audio['bitrate_mode'] = 'vbr';
                                                          $thisfile_video['bitrate_mode'] = 'vbr';
                                                      }
                      Severity: Major
                      Found in Web.Admin/2014/wordpress/wp-includes/ID3/module.audio-video.asf.php - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                        if (empty($thisfile_asf_comments['track'])) {
                                                            $thisfile_asf_comments['track'] = array(1 + $this->TrimConvert($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']));
                                                        }
                        Severity: Major
                        Found in Web.Admin/2014/wordpress/wp-includes/ID3/module.audio-video.asf.php - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                          if (!isset($thisfile_audio['bitrate']) && strstr($AudioCodecBitrate, 'kbps')) {
                                                              $thisfile_audio['bitrate'] = (int) (trim(str_replace('kbps', '', $AudioCodecBitrate)) * 1000);
                                                          }
                          Severity: Major
                          Found in Web.Admin/2014/wordpress/wp-includes/ID3/module.audio-video.asf.php - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                                if ($info['mime_type'] == 'video/x-ms-asf') {
                                                                    $info['mime_type'] = 'audio/x-ms-wma';
                                                                }
                            Severity: Major
                            Found in Web.Admin/2014/wordpress/wp-includes/ID3/module.audio-video.asf.php - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                              switch ($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value_type']) {
                                                                  case 0: // Unicode string
                                                                      if (substr($this->TrimConvert($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['name']), 0, 3) == 'WM/') {
                                                                          $thisfile_asf_comments[str_replace('wm/', '', strtolower($this->TrimConvert($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['name'])))] = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']));
                                                                      }
                              Severity: Major
                              Found in Web.Admin/2014/wordpress/wp-includes/ID3/module.audio-video.asf.php - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                                if (!isset($thisfile_audio['channels'])) {
                                                                    if (strstr($AudioCodecChannels, 'stereo')) {
                                                                        $thisfile_audio['channels'] = 2;
                                                                    } elseif (strstr($AudioCodecChannels, 'mono')) {
                                                                        $thisfile_audio['channels'] = 1;
                                Severity: Major
                                Found in Web.Admin/2014/wordpress/wp-includes/ID3/module.audio-video.asf.php - About 45 mins to fix

                                  There are no issues that match your filters.

                                  Category
                                  Status