ampache/ampache

View on GitHub
src/Module/Api/Subsonic_Xml_Data.php

Summary

Maintainability
F
1 wk
Test Coverage

File Subsonic_Xml_Data.php has 1182 lines of code (exceeds 500 allowed). Consider refactoring.
Open

<?php

declare(strict_types=0);

/**
Severity: Major
Found in src/Module/Api/Subsonic_Xml_Data.php - About 2 days to fix

    Subsonic_Xml_Data has 88 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Subsonic_Xml_Data
    {
        public const API_VERSION = "1.16.1";
    
        public const SSERROR_GENERIC               = 0;
    Severity: Major
    Found in src/Module/Api/Subsonic_Xml_Data.php - About 1 day to fix

      The class Subsonic_Xml_Data has 55 public methods. Consider refactoring Subsonic_Xml_Data to keep number of public methods under 10.
      Open

      class Subsonic_Xml_Data
      {
          public const API_VERSION = "1.16.1";
      
          public const SSERROR_GENERIC               = 0;
      Severity: Minor
      Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

      TooManyPublicMethods

      Since: 0.1

      A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

      By default it ignores methods starting with 'get' or 'set'.

      Example

      Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

      The class Subsonic_Xml_Data has 85 non-getter- and setter-methods. Consider refactoring Subsonic_Xml_Data to keep number of methods under 25.
      Open

      class Subsonic_Xml_Data
      {
          public const API_VERSION = "1.16.1";
      
          public const SSERROR_GENERIC               = 0;
      Severity: Minor
      Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

      TooManyMethods

      Since: 0.1

      A class with too many methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

      By default it ignores methods starting with 'get' or 'set'.

      The default was changed from 10 to 25 in PHPMD 2.3.

      Example

      Source https://phpmd.org/rules/codesize.html#toomanymethods

      The class Subsonic_Xml_Data has an overall complexity of 291 which is very high. The configured complexity threshold is 50.
      Open

      class Subsonic_Xml_Data
      {
          public const API_VERSION = "1.16.1";
      
          public const SSERROR_GENERIC               = 0;
      Severity: Minor
      Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

      Function addSong has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function addSong($xml, $song_id, $elementName = 'song'): SimpleXMLElement
          {
              $song = new Song($song_id);
              if ($song->isNew()) {
                  return $xml;
      Severity: Minor
      Found in src/Module/Api/Subsonic_Xml_Data.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 addIndex has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          private static function addIndex($xml, $artists): void
          {
              $xlastcat     = null;
              $sharpartists = array();
              $xlastletter  = '';
      Severity: Minor
      Found in src/Module/Api/Subsonic_Xml_Data.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 addArtist has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function addArtist($xml, $artist, $extra = false, $albums = false, $albumsSet = false): void
          {
              if ($artist->isNew()) {
                  return;
              }
      Severity: Minor
      Found in src/Module/Api/Subsonic_Xml_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 addPlaylists has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function addPlaylists($xml, $user_id, $playlists, $smartplaylists = array(), $hide_dupe_searches = false): void
          {
              $playlist_names = array();
              $xplaylists     = self::addChildToResultXml($xml, 'playlists');
              foreach ($playlists as $plist_id) {
      Severity: Minor
      Found in src/Module/Api/Subsonic_Xml_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 addAlbum has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function addAlbum($xml, $album, $songs = false, $elementName = "album"): void
          {
              if ($album->isNew()) {
                  return;
              }
      Severity: Minor
      Found in src/Module/Api/Subsonic_Xml_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

      The class Subsonic_Xml_Data has 56 public methods and attributes. Consider reducing the number of public items to less than 45.
      Open

      class Subsonic_Xml_Data
      {
          public const API_VERSION = "1.16.1";
      
          public const SSERROR_GENERIC               = 0;
      Severity: Minor
      Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

      ExcessivePublicCount

      Since: 0.1

      A large number of public methods and attributes declared in a class can indicate the class may need to be broken up as increased effort will be required to thoroughly test it.

      Example

      public class Foo {
          public $value;
          public $something;
          public $var;
          // [... more more public attributes ...]
      
          public function doWork() {}
          public function doMoreWork() {}
          public function doWorkAgain() {}
          // [... more more public methods ...]
      }

      Source https://phpmd.org/rules/codesize.html#excessivepubliccount

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

          private static function addShare($xml, $share): void
          {
              $xshare = self::addChildToResultXml($xml, 'share');
              $xshare->addAttribute('id', (string)$share->id);
              $xshare->addAttribute('url', (string)$share->public_url);
      Severity: Minor
      Found in src/Module/Api/Subsonic_Xml_Data.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 addError has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function addError($code, $function): SimpleXMLElement
          {
              $xml  = self::_createFailedResponse($function);
              /** @var SimpleXMLElement $xerr */
              $xerr = self::addChildToResultXml($xml, 'error');
      Severity: Minor
      Found in src/Module/Api/Subsonic_Xml_Data.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 addVideo has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          private static function addVideo($xml, $video, $elementName = 'video'): void
          {
              $sub_id = (string)self::_getVideoId($video->id);
              $xvideo = self::addChildToResultXml($xml, htmlspecialchars($elementName));
              $xvideo->addAttribute('id', $sub_id);
      Severity: Minor
      Found in src/Module/Api/Subsonic_Xml_Data.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 _getAmpacheType has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function _getAmpacheType($object_id): string
          {
              if (self::_isArtist($object_id)) {
                  return "artist";
              } elseif (self::_isAlbum($object_id)) {
      Severity: Minor
      Found in src/Module/Api/Subsonic_Xml_Data.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 addPodcasts has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function addPodcasts($xml, $podcasts, $includeEpisodes = true): void
          {
              $podcastRepository = self::getPodcastRepository();
      
              $xpodcasts = self::addChildToResultXml($xml, 'podcasts');
      Severity: Minor
      Found in src/Module/Api/Subsonic_Xml_Data.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 addPlaylists has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public static function addPlaylists($xml, $user_id, $playlists, $smartplaylists = array(), $hide_dupe_searches = false): void
      Severity: Minor
      Found in src/Module/Api/Subsonic_Xml_Data.php - About 35 mins to fix

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

            public static function addArtist($xml, $artist, $extra = false, $albums = false, $albumsSet = false): void
        Severity: Minor
        Found in src/Module/Api/Subsonic_Xml_Data.php - About 35 mins to fix

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

              private static function _setIfStarred($xml, $objectType, $object_id): void
              {
                  if (InterfaceImplementationChecker::is_library_item($objectType)) {
                      if (AmpConfig::get('ratings')) {
                          $starred = new Userflag($object_id, $objectType);
          Severity: Minor
          Found in src/Module/Api/Subsonic_Xml_Data.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 "video";
          Severity: Major
          Found in src/Module/Api/Subsonic_Xml_Data.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return "playlist";
            Severity: Major
            Found in src/Module/Api/Subsonic_Xml_Data.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return "podcast";
              Severity: Major
              Found in src/Module/Api/Subsonic_Xml_Data.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            return "podcast_episode";
                Severity: Major
                Found in src/Module/Api/Subsonic_Xml_Data.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                          return "";
                  Severity: Major
                  Found in src/Module/Api/Subsonic_Xml_Data.php - About 30 mins to fix

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

                        public static function addLyrics($xml, $artist, $title, $song_id): void
                        {
                            $song = new Song($song_id);
                            $song->fill_ext_info('lyrics');
                            $lyrics = $song->get_lyrics();
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.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

                    The method addAlbum() has an NPath complexity of 2304. The configured NPath complexity threshold is 200.
                    Open

                        public static function addAlbum($xml, $album, $songs = false, $elementName = "album"): void
                        {
                            if ($album->isNew()) {
                                return;
                            }
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    NPathComplexity

                    Since: 0.1

                    The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

                    Example

                    class Foo {
                        function bar() {
                            // lots of complicated code
                        }
                    }

                    Source https://phpmd.org/rules/codesize.html#npathcomplexity

                    The method addSong() has an NPath complexity of 11522. The configured NPath complexity threshold is 200.
                    Open

                        public static function addSong($xml, $song_id, $elementName = 'song'): SimpleXMLElement
                        {
                            $song = new Song($song_id);
                            if ($song->isNew()) {
                                return $xml;
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    NPathComplexity

                    Since: 0.1

                    The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

                    Example

                    class Foo {
                        function bar() {
                            // lots of complicated code
                        }
                    }

                    Source https://phpmd.org/rules/codesize.html#npathcomplexity

                    The method addUser() has an NPath complexity of 256. The configured NPath complexity threshold is 200.
                    Open

                        public static function addUser($xml, $user): void
                        {
                            $xuser = self::addChildToResultXml($xml, 'user');
                            $xuser->addAttribute('username', (string)$user->username);
                            $xuser->addAttribute('email', (string)$user->email);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    NPathComplexity

                    Since: 0.1

                    The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

                    Example

                    class Foo {
                        function bar() {
                            // lots of complicated code
                        }
                    }

                    Source https://phpmd.org/rules/codesize.html#npathcomplexity

                    The class Subsonic_Xml_Data has 1770 lines of code. Current threshold is 1000. Avoid really long classes.
                    Open

                    class Subsonic_Xml_Data
                    {
                        public const API_VERSION = "1.16.1";
                    
                        public const SSERROR_GENERIC               = 0;
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    The method addIndex() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
                    Open

                        private static function addIndex($xml, $artists): void
                        {
                            $xlastcat     = null;
                            $sharpartists = array();
                            $xlastletter  = '';
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    CyclomaticComplexity

                    Since: 0.1

                    Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                    Example

                    // Cyclomatic Complexity = 11
                    class Foo {
                    1   public function example() {
                    2       if ($a == $b) {
                    3           if ($a1 == $b1) {
                                    fiddle();
                    4           } elseif ($a2 == $b2) {
                                    fiddle();
                                } else {
                                    fiddle();
                                }
                    5       } elseif ($c == $d) {
                    6           while ($c == $d) {
                                    fiddle();
                                }
                    7        } elseif ($e == $f) {
                    8           for ($n = 0; $n < $h; $n++) {
                                    fiddle();
                                }
                            } else {
                                switch ($z) {
                    9               case 1:
                                        fiddle();
                                        break;
                    10              case 2:
                                        fiddle();
                                        break;
                    11              case 3:
                                        fiddle();
                                        break;
                                    default:
                                        fiddle();
                                        break;
                                }
                            }
                        }
                    }

                    Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                    The method addArtist() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
                    Open

                        public static function addArtist($xml, $artist, $extra = false, $albums = false, $albumsSet = false): void
                        {
                            if ($artist->isNew()) {
                                return;
                            }
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    CyclomaticComplexity

                    Since: 0.1

                    Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                    Example

                    // Cyclomatic Complexity = 11
                    class Foo {
                    1   public function example() {
                    2       if ($a == $b) {
                    3           if ($a1 == $b1) {
                                    fiddle();
                    4           } elseif ($a2 == $b2) {
                                    fiddle();
                                } else {
                                    fiddle();
                                }
                    5       } elseif ($c == $d) {
                    6           while ($c == $d) {
                                    fiddle();
                                }
                    7        } elseif ($e == $f) {
                    8           for ($n = 0; $n < $h; $n++) {
                                    fiddle();
                                }
                            } else {
                                switch ($z) {
                    9               case 1:
                                        fiddle();
                                        break;
                    10              case 2:
                                        fiddle();
                                        break;
                    11              case 3:
                                        fiddle();
                                        break;
                                    default:
                                        fiddle();
                                        break;
                                }
                            }
                        }
                    }

                    Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                    The method addVideo() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
                    Open

                        private static function addVideo($xml, $video, $elementName = 'video'): void
                        {
                            $sub_id = (string)self::_getVideoId($video->id);
                            $xvideo = self::addChildToResultXml($xml, htmlspecialchars($elementName));
                            $xvideo->addAttribute('id', $sub_id);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    CyclomaticComplexity

                    Since: 0.1

                    Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                    Example

                    // Cyclomatic Complexity = 11
                    class Foo {
                    1   public function example() {
                    2       if ($a == $b) {
                    3           if ($a1 == $b1) {
                                    fiddle();
                    4           } elseif ($a2 == $b2) {
                                    fiddle();
                                } else {
                                    fiddle();
                                }
                    5       } elseif ($c == $d) {
                    6           while ($c == $d) {
                                    fiddle();
                                }
                    7        } elseif ($e == $f) {
                    8           for ($n = 0; $n < $h; $n++) {
                                    fiddle();
                                }
                            } else {
                                switch ($z) {
                    9               case 1:
                                        fiddle();
                                        break;
                    10              case 2:
                                        fiddle();
                                        break;
                    11              case 3:
                                        fiddle();
                                        break;
                                    default:
                                        fiddle();
                                        break;
                                }
                            }
                        }
                    }

                    Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                    The method addUser() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
                    Open

                        public static function addUser($xml, $user): void
                        {
                            $xuser = self::addChildToResultXml($xml, 'user');
                            $xuser->addAttribute('username', (string)$user->username);
                            $xuser->addAttribute('email', (string)$user->email);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    CyclomaticComplexity

                    Since: 0.1

                    Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                    Example

                    // Cyclomatic Complexity = 11
                    class Foo {
                    1   public function example() {
                    2       if ($a == $b) {
                    3           if ($a1 == $b1) {
                                    fiddle();
                    4           } elseif ($a2 == $b2) {
                                    fiddle();
                                } else {
                                    fiddle();
                                }
                    5       } elseif ($c == $d) {
                    6           while ($c == $d) {
                                    fiddle();
                                }
                    7        } elseif ($e == $f) {
                    8           for ($n = 0; $n < $h; $n++) {
                                    fiddle();
                                }
                            } else {
                                switch ($z) {
                    9               case 1:
                                        fiddle();
                                        break;
                    10              case 2:
                                        fiddle();
                                        break;
                    11              case 3:
                                        fiddle();
                                        break;
                                    default:
                                        fiddle();
                                        break;
                                }
                            }
                        }
                    }

                    Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                    The method addAlbum() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10.
                    Open

                        public static function addAlbum($xml, $album, $songs = false, $elementName = "album"): void
                        {
                            if ($album->isNew()) {
                                return;
                            }
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    CyclomaticComplexity

                    Since: 0.1

                    Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                    Example

                    // Cyclomatic Complexity = 11
                    class Foo {
                    1   public function example() {
                    2       if ($a == $b) {
                    3           if ($a1 == $b1) {
                                    fiddle();
                    4           } elseif ($a2 == $b2) {
                                    fiddle();
                                } else {
                                    fiddle();
                                }
                    5       } elseif ($c == $d) {
                    6           while ($c == $d) {
                                    fiddle();
                                }
                    7        } elseif ($e == $f) {
                    8           for ($n = 0; $n < $h; $n++) {
                                    fiddle();
                                }
                            } else {
                                switch ($z) {
                    9               case 1:
                                        fiddle();
                                        break;
                    10              case 2:
                                        fiddle();
                                        break;
                    11              case 3:
                                        fiddle();
                                        break;
                                    default:
                                        fiddle();
                                        break;
                                }
                            }
                        }
                    }

                    Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                    The method addSong() has a Cyclomatic Complexity of 18. The configured cyclomatic complexity threshold is 10.
                    Open

                        public static function addSong($xml, $song_id, $elementName = 'song'): SimpleXMLElement
                        {
                            $song = new Song($song_id);
                            if ($song->isNew()) {
                                return $xml;
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    CyclomaticComplexity

                    Since: 0.1

                    Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                    Example

                    // Cyclomatic Complexity = 11
                    class Foo {
                    1   public function example() {
                    2       if ($a == $b) {
                    3           if ($a1 == $b1) {
                                    fiddle();
                    4           } elseif ($a2 == $b2) {
                                    fiddle();
                                } else {
                                    fiddle();
                                }
                    5       } elseif ($c == $d) {
                    6           while ($c == $d) {
                                    fiddle();
                                }
                    7        } elseif ($e == $f) {
                    8           for ($n = 0; $n < $h; $n++) {
                                    fiddle();
                                }
                            } else {
                                switch ($z) {
                    9               case 1:
                                        fiddle();
                                        break;
                    10              case 2:
                                        fiddle();
                                        break;
                    11              case 3:
                                        fiddle();
                                        break;
                                    default:
                                        fiddle();
                                        break;
                                }
                            }
                        }
                    }

                    Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                    The method addPlaylists() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
                    Open

                        public static function addPlaylists($xml, $user_id, $playlists, $smartplaylists = array(), $hide_dupe_searches = false): void
                        {
                            $playlist_names = array();
                            $xplaylists     = self::addChildToResultXml($xml, 'playlists');
                            foreach ($playlists as $plist_id) {
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    CyclomaticComplexity

                    Since: 0.1

                    Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                    Example

                    // Cyclomatic Complexity = 11
                    class Foo {
                    1   public function example() {
                    2       if ($a == $b) {
                    3           if ($a1 == $b1) {
                                    fiddle();
                    4           } elseif ($a2 == $b2) {
                                    fiddle();
                                } else {
                                    fiddle();
                                }
                    5       } elseif ($c == $d) {
                    6           while ($c == $d) {
                                    fiddle();
                                }
                    7        } elseif ($e == $f) {
                    8           for ($n = 0; $n < $h; $n++) {
                                    fiddle();
                                }
                            } else {
                                switch ($z) {
                    9               case 1:
                                        fiddle();
                                        break;
                    10              case 2:
                                        fiddle();
                                        break;
                    11              case 3:
                                        fiddle();
                                        break;
                                    default:
                                        fiddle();
                                        break;
                                }
                            }
                        }
                    }

                    Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                    Reduce the number of returns of this function 4, down to the maximum allowed 3.
                    Open

                        public static function _getAmpacheObject($object_id)

                    Having too many return statements in a function increases the function's essential complexity because the flow of execution is broken each time a return statement is encountered. This makes it harder to read and understand the logic of the function.

                    Noncompliant Code Example

                    With the default threshold of 3:

                    function myFunction(){ // Noncompliant as there are 4 return statements
                      if (condition1) {
                        return true;
                      } else {
                        if (condition2) {
                          return false;
                        } else {
                          return true;
                        }
                      }
                      return false;
                    }
                    

                    Refactor this function to reduce its Cognitive Complexity from 32 to the 15 allowed.
                    Open

                        public static function addSong($xml, $song_id, $elementName = 'song'): SimpleXMLElement
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by sonar-php

                    Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

                    See

                    Reduce the number of returns of this function 9, down to the maximum allowed 3.
                    Open

                        public static function _getAmpacheType($object_id): string

                    Having too many return statements in a function increases the function's essential complexity because the flow of execution is broken each time a return statement is encountered. This makes it harder to read and understand the logic of the function.

                    Noncompliant Code Example

                    With the default threshold of 3:

                    function myFunction(){ // Noncompliant as there are 4 return statements
                      if (condition1) {
                        return true;
                      } else {
                        if (condition2) {
                          return false;
                        } else {
                          return true;
                        }
                      }
                      return false;
                    }
                    

                    Class "Subsonic_Xml_Data" has 88 methods, which is greater than 20 authorized. Split it into smaller classes.
                    Open

                    class Subsonic_Xml_Data

                    A class that grows too much tends to aggregate too many responsibilities and inevitably becomes harder to understand and therefore to maintain. Above a specific threshold, it is strongly advised to refactor the class into smaller ones which focus on well defined topics.

                    Refactor this function to reduce its Cognitive Complexity from 20 to the 15 allowed.
                    Open

                        private static function addIndex($xml, $artists): void
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by sonar-php

                    Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

                    See

                    The class Subsonic_Xml_Data has a coupling between objects value of 29. Consider to reduce the number of dependencies under 13.
                    Open

                    class Subsonic_Xml_Data
                    {
                        public const API_VERSION = "1.16.1";
                    
                        public const SSERROR_GENERIC               = 0;
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    CouplingBetweenObjects

                    Since: 1.1.0

                    A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

                    Example

                    class Foo {
                        /**
                         * @var \foo\bar\X
                         */
                        private $x = null;
                    
                        /**
                         * @var \foo\bar\Y
                         */
                        private $y = null;
                    
                        /**
                         * @var \foo\bar\Z
                         */
                        private $z = null;
                    
                        public function setFoo(\Foo $foo) {}
                        public function setBar(\Bar $bar) {}
                        public function setBaz(\Baz $baz) {}
                    
                        /**
                         * @return \SplObjectStorage
                         * @throws \OutOfRangeException
                         * @throws \InvalidArgumentException
                         * @throws \ErrorException
                         */
                        public function process(\Iterator $it) {}
                    
                        // ...
                    }

                    Source https://phpmd.org/rules/design.html#couplingbetweenobjects

                    The method addIndex uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                    Open

                                    } else {
                                        if (!preg_match("/^[A-W]$/", $letter)) {
                                            $sharpartists[] = $artist;
                                            continue;
                                        }
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    ElseExpression

                    Since: 1.4.0

                    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                    Example

                    class Foo
                    {
                        public function bar($flag)
                        {
                            if ($flag) {
                                // one branch
                            } else {
                                // another branch
                            }
                        }
                    }

                    Source https://phpmd.org/rules/cleancode.html#elseexpression

                    The method addArtist uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                    Open

                                } else {
                                    $xartist->addAttribute('albumCount', (string)count($allalbums));
                                }
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    ElseExpression

                    Since: 1.4.0

                    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                    Example

                    class Foo
                    {
                        public function bar($flag)
                        {
                            if ($flag) {
                                // one branch
                            } else {
                                // another branch
                            }
                        }
                    }

                    Source https://phpmd.org/rules/cleancode.html#elseexpression

                    The method addDirectory_Album uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                    Open

                            } else {
                                $xdir->addAttribute('parent', (string)$album->catalog);
                            }
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    ElseExpression

                    Since: 1.4.0

                    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                    Example

                    class Foo
                    {
                        public function bar($flag)
                        {
                            if ($flag) {
                                // one branch
                            } else {
                                // another branch
                            }
                        }
                    }

                    Source https://phpmd.org/rules/cleancode.html#elseexpression

                    The method addPlaylist_Search uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                    Open

                            } else {
                                $xplaylist->addAttribute('songCount', (string)$search->last_count);
                                $xplaylist->addAttribute('duration', (string)$search->last_duration);
                                $xplaylist->addAttribute('coverArt', $sub_id);
                            }
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    ElseExpression

                    Since: 1.4.0

                    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                    Example

                    class Foo
                    {
                        public function bar($flag)
                        {
                            if ($flag) {
                                // one branch
                            } else {
                                // another branch
                            }
                        }
                    }

                    Source https://phpmd.org/rules/cleancode.html#elseexpression

                    The method addMessage uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                    Open

                            } else {
                                $xbookmark->addAttribute('username', (string)$user->username);
                            }
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    ElseExpression

                    Since: 1.4.0

                    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                    Example

                    class Foo
                    {
                        public function bar($flag)
                        {
                            if ($flag) {
                                // one branch
                            } else {
                                // another branch
                            }
                        }
                    }

                    Source https://phpmd.org/rules/cleancode.html#elseexpression

                    Define a constant instead of duplicating this literal "changed" 4 times.
                    Open

                            $xplaylist->addAttribute('changed', date("c", (int)$playlist->last_update));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by sonar-php

                    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                    Noncompliant Code Example

                    With the default threshold of 3:

                    function run() {
                      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                      execute('action1');
                      release('action1');
                    }
                    

                    Compliant Solution

                    ACTION_1 = 'action1';
                    
                    function run() {
                      prepare(ACTION_1);
                      execute(ACTION_1);
                      release(ACTION_1);
                    }
                    

                    Exceptions

                    To prevent generating some false-positives, literals having less than 5 characters are excluded.

                    Define a constant instead of duplicating this literal "video" 6 times.
                    Open

                        private static function addVideo($xml, $video, $elementName = 'video'): void
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by sonar-php

                    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                    Noncompliant Code Example

                    With the default threshold of 3:

                    function run() {
                      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                      execute('action1');
                      release('action1');
                    }
                    

                    Compliant Solution

                    ACTION_1 = 'action1';
                    
                    function run() {
                      prepare(ACTION_1);
                      execute(ACTION_1);
                      release(ACTION_1);
                    }
                    

                    Exceptions

                    To prevent generating some false-positives, literals having less than 5 characters are excluded.

                    Define a constant instead of duplicating this literal "false" 16 times.
                    Open

                                $xsong->addAttribute('isDir', 'false');
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by sonar-php

                    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                    Noncompliant Code Example

                    With the default threshold of 3:

                    function run() {
                      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                      execute('action1');
                      release('action1');
                    }
                    

                    Compliant Solution

                    ACTION_1 = 'action1';
                    
                    function run() {
                      prepare(ACTION_1);
                      execute(ACTION_1);
                      release(ACTION_1);
                    }
                    

                    Exceptions

                    To prevent generating some false-positives, literals having less than 5 characters are excluded.

                    Define a constant instead of duplicating this literal "username" 7 times.
                    Open

                                $xplayqueue->addAttribute('username', (string)$username);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by sonar-php

                    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                    Noncompliant Code Example

                    With the default threshold of 3:

                    function run() {
                      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                      execute('action1');
                      release('action1');
                    }
                    

                    Compliant Solution

                    ACTION_1 = 'action1';
                    
                    function run() {
                      prepare(ACTION_1);
                      execute(ACTION_1);
                      release(ACTION_1);
                    }
                    

                    Exceptions

                    To prevent generating some false-positives, literals having less than 5 characters are excluded.

                    Define a constant instead of duplicating this literal "suffix" 3 times.
                    Open

                                $xsong->addAttribute('suffix', (string)$song->type);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by sonar-php

                    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                    Noncompliant Code Example

                    With the default threshold of 3:

                    function run() {
                      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                      execute('action1');
                      release('action1');
                    }
                    

                    Compliant Solution

                    ACTION_1 = 'action1';
                    
                    function run() {
                      prepare(ACTION_1);
                      execute(ACTION_1);
                      release(ACTION_1);
                    }
                    

                    Exceptions

                    To prevent generating some false-positives, literals having less than 5 characters are excluded.

                    Define a constant instead of duplicating this literal "duration" 7 times.
                    Open

                            $xalbum->addAttribute('duration', (string) $album->total_duration);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by sonar-php

                    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                    Noncompliant Code Example

                    With the default threshold of 3:

                    function run() {
                      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                      execute('action1');
                      release('action1');
                    }
                    

                    Compliant Solution

                    ACTION_1 = 'action1';
                    
                    function run() {
                      prepare(ACTION_1);
                      execute(ACTION_1);
                      release(ACTION_1);
                    }
                    

                    Exceptions

                    To prevent generating some false-positives, literals having less than 5 characters are excluded.

                    Define a constant instead of duplicating this literal "catalog_id" 4 times.
                    Open

                            if (array_key_exists('catalog_id', $child)) {
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by sonar-php

                    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                    Noncompliant Code Example

                    With the default threshold of 3:

                    function run() {
                      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                      execute('action1');
                      release('action1');
                    }
                    

                    Compliant Solution

                    ACTION_1 = 'action1';
                    
                    function run() {
                      prepare(ACTION_1);
                      execute(ACTION_1);
                      release(ACTION_1);
                    }
                    

                    Exceptions

                    To prevent generating some false-positives, literals having less than 5 characters are excluded.

                    Define a constant instead of duplicating this literal "genre" 5 times.
                    Open

                                $xalbum->addAttribute('genre', (string)$tag['name']);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by sonar-php

                    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                    Noncompliant Code Example

                    With the default threshold of 3:

                    function run() {
                      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                      execute('action1');
                      release('action1');
                    }
                    

                    Compliant Solution

                    ACTION_1 = 'action1';
                    
                    function run() {
                      prepare(ACTION_1);
                      execute(ACTION_1);
                      release(ACTION_1);
                    }
                    

                    Exceptions

                    To prevent generating some false-positives, literals having less than 5 characters are excluded.

                    Define a constant instead of duplicating this literal "entry" 11 times.
                    Open

                                    self::addSong($xplaylist, $song_id, "entry");
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by sonar-php

                    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                    Noncompliant Code Example

                    With the default threshold of 3:

                    function run() {
                      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                      execute('action1');
                      release('action1');
                    }
                    

                    Compliant Solution

                    ACTION_1 = 'action1';
                    
                    function run() {
                      prepare(ACTION_1);
                      execute(ACTION_1);
                      release(ACTION_1);
                    }
                    

                    Exceptions

                    To prevent generating some false-positives, literals having less than 5 characters are excluded.

                    Define a constant instead of duplicating this literal "directory" 3 times.
                    Open

                            $xdir      = self::addChildToResultXml($xml, 'directory');
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by sonar-php

                    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                    Noncompliant Code Example

                    With the default threshold of 3:

                    function run() {
                      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                      execute('action1');
                      release('action1');
                    }
                    

                    Compliant Solution

                    ACTION_1 = 'action1';
                    
                    function run() {
                      prepare(ACTION_1);
                      execute(ACTION_1);
                      release(ACTION_1);
                    }
                    

                    Exceptions

                    To prevent generating some false-positives, literals having less than 5 characters are excluded.

                    Define a constant instead of duplicating this literal "object_id" 4 times.
                    Open

                                    self::addSong($xplaylist, (int)$item['object_id'], "entry");
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by sonar-php

                    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                    Noncompliant Code Example

                    With the default threshold of 3:

                    function run() {
                      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                      execute('action1');
                      release('action1');
                    }
                    

                    Compliant Solution

                    ACTION_1 = 'action1';
                    
                    function run() {
                      prepare(ACTION_1);
                      execute(ACTION_1);
                      release(ACTION_1);
                    }
                    

                    Exceptions

                    To prevent generating some false-positives, literals having less than 5 characters are excluded.

                    Merge this if statement with the enclosing one.
                    Open

                                if (AmpConfig::get('ratings')) {

                    Merging collapsible if statements increases the code's readability.

                    Noncompliant Code Example

                    if (condition1) {
                      if (condition2) {
                        ...
                      }
                    }
                    

                    Compliant Solution

                    if (condition1 && condition2) {
                      ...
                    }
                    

                    Define a constant instead of duplicating this literal "child" 3 times.
                    Open

                            $xchild = self::addChildToResultXml($xml, 'child');
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by sonar-php

                    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                    Noncompliant Code Example

                    With the default threshold of 3:

                    function run() {
                      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                      execute('action1');
                      release('action1');
                    }
                    

                    Compliant Solution

                    ACTION_1 = 'action1';
                    
                    function run() {
                      prepare(ACTION_1);
                      execute(ACTION_1);
                      release(ACTION_1);
                    }
                    

                    Exceptions

                    To prevent generating some false-positives, literals having less than 5 characters are excluded.

                    Define a constant instead of duplicating this literal "isDir" 5 times.
                    Open

                            $xchild->addAttribute('isDir', 'true');
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by sonar-php

                    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                    Noncompliant Code Example

                    With the default threshold of 3:

                    function run() {
                      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                      execute('action1');
                      release('action1');
                    }
                    

                    Compliant Solution

                    ACTION_1 = 'action1';
                    
                    function run() {
                      prepare(ACTION_1);
                      execute(ACTION_1);
                      release(ACTION_1);
                    }
                    

                    Exceptions

                    To prevent generating some false-positives, literals having less than 5 characters are excluded.

                    Define a constant instead of duplicating this literal "artist" 12 times.
                    Open

                            $xartist = self::addChildToResultXml($xml, 'artist');
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by sonar-php

                    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                    Noncompliant Code Example

                    With the default threshold of 3:

                    function run() {
                      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                      execute('action1');
                      release('action1');
                    }
                    

                    Compliant Solution

                    ACTION_1 = 'action1';
                    
                    function run() {
                      prepare(ACTION_1);
                      execute(ACTION_1);
                      release(ACTION_1);
                    }
                    

                    Exceptions

                    To prevent generating some false-positives, literals having less than 5 characters are excluded.

                    Define a constant instead of duplicating this literal "contentType" 3 times.
                    Open

                                $xsong->addAttribute('contentType', (string)$song->mime);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by sonar-php

                    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                    Noncompliant Code Example

                    With the default threshold of 3:

                    function run() {
                      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                      execute('action1');
                      release('action1');
                    }
                    

                    Compliant Solution

                    ACTION_1 = 'action1';
                    
                    function run() {
                      prepare(ACTION_1);
                      execute(ACTION_1);
                      release(ACTION_1);
                    }
                    

                    Exceptions

                    To prevent generating some false-positives, literals having less than 5 characters are excluded.

                    Define a constant instead of duplicating this literal "f_name" 4 times.
                    Open

                            $xchild->addAttribute('title', (string)self::_checkName($child['f_name']));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by sonar-php

                    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                    Noncompliant Code Example

                    With the default threshold of 3:

                    function run() {
                      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                      execute('action1');
                      release('action1');
                    }
                    

                    Compliant Solution

                    ACTION_1 = 'action1';
                    
                    function run() {
                      prepare(ACTION_1);
                      execute(ACTION_1);
                      release(ACTION_1);
                    }
                    

                    Exceptions

                    To prevent generating some false-positives, literals having less than 5 characters are excluded.

                    Define a constant instead of duplicating this literal "status" 3 times.
                    Open

                                $xchannel->addAttribute('status', 'completed');
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by sonar-php

                    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                    Noncompliant Code Example

                    With the default threshold of 3:

                    function run() {
                      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                      execute('action1');
                      release('action1');
                    }
                    

                    Compliant Solution

                    ACTION_1 = 'action1';
                    
                    function run() {
                      prepare(ACTION_1);
                      execute(ACTION_1);
                      release(ACTION_1);
                    }
                    

                    Exceptions

                    To prevent generating some false-positives, literals having less than 5 characters are excluded.

                    Define a constant instead of duplicating this literal "parent" 7 times.
                    Open

                                $xchild->addAttribute('parent', $child['catalog_id']);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by sonar-php

                    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                    Noncompliant Code Example

                    With the default threshold of 3:

                    function run() {
                      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                      execute('action1');
                      release('action1');
                    }
                    

                    Compliant Solution

                    ACTION_1 = 'action1';
                    
                    function run() {
                      prepare(ACTION_1);
                      execute(ACTION_1);
                      release(ACTION_1);
                    }
                    

                    Exceptions

                    To prevent generating some false-positives, literals having less than 5 characters are excluded.

                    Define a constant instead of duplicating this literal "title" 7 times.
                    Open

                            $xchild->addAttribute('title', (string)self::_checkName($child['f_name']));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by sonar-php

                    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                    Noncompliant Code Example

                    With the default threshold of 3:

                    function run() {
                      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                      execute('action1');
                      release('action1');
                    }
                    

                    Compliant Solution

                    ACTION_1 = 'action1';
                    
                    function run() {
                      prepare(ACTION_1);
                      execute(ACTION_1);
                      release(ACTION_1);
                    }
                    

                    Exceptions

                    To prevent generating some false-positives, literals having less than 5 characters are excluded.

                    Define a constant instead of duplicating this literal "description" 3 times.
                    Open

                            $xshare->addAttribute('description', (string)$share->description);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by sonar-php

                    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                    Noncompliant Code Example

                    With the default threshold of 3:

                    function run() {
                      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                      execute('action1');
                      release('action1');
                    }
                    

                    Compliant Solution

                    ACTION_1 = 'action1';
                    
                    function run() {
                      prepare(ACTION_1);
                      execute(ACTION_1);
                      release(ACTION_1);
                    }
                    

                    Exceptions

                    To prevent generating some false-positives, literals having less than 5 characters are excluded.

                    Merge this if statement with the enclosing one.
                    Open

                                if (is_numeric($name)) {

                    Merging collapsible if statements increases the code's readability.

                    Noncompliant Code Example

                    if (condition1) {
                      if (condition2) {
                        ...
                      }
                    }
                    

                    Compliant Solution

                    if (condition1 && condition2) {
                      ...
                    }
                    

                    Define a constant instead of duplicating this literal "has_art" 4 times.
                    Open

                            if (array_key_exists('has_art', $child) && !empty($child['has_art'])) {
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by sonar-php

                    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                    Noncompliant Code Example

                    With the default threshold of 3:

                    function run() {
                      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                      execute('action1');
                      release('action1');
                    }
                    

                    Compliant Solution

                    ACTION_1 = 'action1';
                    
                    function run() {
                      prepare(ACTION_1);
                      execute(ACTION_1);
                      release(ACTION_1);
                    }
                    

                    Exceptions

                    To prevent generating some false-positives, literals having less than 5 characters are excluded.

                    Define a constant instead of duplicating this literal "podcast_episode" 4 times.
                    Open

                            } elseif ($bookmark->object_type == "podcast_episode") {
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by sonar-php

                    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                    Noncompliant Code Example

                    With the default threshold of 3:

                    function run() {
                      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                      execute('action1');
                      release('action1');
                    }
                    

                    Compliant Solution

                    ACTION_1 = 'action1';
                    
                    function run() {
                      prepare(ACTION_1);
                      execute(ACTION_1);
                      release(ACTION_1);
                    }
                    

                    Exceptions

                    To prevent generating some false-positives, literals having less than 5 characters are excluded.

                    Define a constant instead of duplicating this literal "created" 5 times.
                    Open

                            $xalbum->addAttribute('created', date("c", (int)$album->addition_time));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by sonar-php

                    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                    Noncompliant Code Example

                    With the default threshold of 3:

                    function run() {
                      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                      execute('action1');
                      release('action1');
                    }
                    

                    Compliant Solution

                    ACTION_1 = 'action1';
                    
                    function run() {
                      prepare(ACTION_1);
                      execute(ACTION_1);
                      release(ACTION_1);
                    }
                    

                    Exceptions

                    To prevent generating some false-positives, literals having less than 5 characters are excluded.

                    Define a constant instead of duplicating this literal "coverArt" 11 times.
                    Open

                                    $xartist->addAttribute('coverArt', 'ar-' . $sub_id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by sonar-php

                    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                    Noncompliant Code Example

                    With the default threshold of 3:

                    function run() {
                      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                      execute('action1');
                      release('action1');
                    }
                    

                    Compliant Solution

                    ACTION_1 = 'action1';
                    
                    function run() {
                      prepare(ACTION_1);
                      execute(ACTION_1);
                      release(ACTION_1);
                    }
                    

                    Exceptions

                    To prevent generating some false-positives, literals having less than 5 characters are excluded.

                    Define a constant instead of duplicating this literal "songCount" 5 times.
                    Open

                            $xalbum->addAttribute('songCount', (string) $album->song_count);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by sonar-php

                    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                    Noncompliant Code Example

                    With the default threshold of 3:

                    function run() {
                      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                      execute('action1');
                      release('action1');
                    }
                    

                    Compliant Solution

                    ACTION_1 = 'action1';
                    
                    function run() {
                      prepare(ACTION_1);
                      execute(ACTION_1);
                      release(ACTION_1);
                    }
                    

                    Exceptions

                    To prevent generating some false-positives, literals having less than 5 characters are excluded.

                    Define a constant instead of duplicating this literal "position" 3 times.
                    Open

                                $xplayqueue->addAttribute('position', (string)($current['current_time'] * 1000));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by sonar-php

                    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                    Noncompliant Code Example

                    With the default threshold of 3:

                    function run() {
                      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                      execute('action1');
                      release('action1');
                    }
                    

                    Compliant Solution

                    ACTION_1 = 'action1';
                    
                    function run() {
                      prepare(ACTION_1);
                      execute(ACTION_1);
                      release(ACTION_1);
                    }
                    

                    Exceptions

                    To prevent generating some false-positives, literals having less than 5 characters are excluded.

                    Define a constant instead of duplicating this literal "playlist" 4 times.
                    Open

                            $xplaylist = self::addChildToResultXml($xml, 'playlist');
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by sonar-php

                    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                    Noncompliant Code Example

                    With the default threshold of 3:

                    function run() {
                      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                      execute('action1');
                      release('action1');
                    }
                    

                    Compliant Solution

                    ACTION_1 = 'action1';
                    
                    function run() {
                      prepare(ACTION_1);
                      execute(ACTION_1);
                      release(ACTION_1);
                    }
                    

                    Exceptions

                    To prevent generating some false-positives, literals having less than 5 characters are excluded.

                    Define a constant instead of duplicating this literal "album" 12 times.
                    Open

                        public static function addAlbum($xml, $album, $songs = false, $elementName = "album"): void
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by sonar-php

                    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                    Noncompliant Code Example

                    With the default threshold of 3:

                    function run() {
                      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                      execute('action1');
                      release('action1');
                    }
                    

                    Compliant Solution

                    ACTION_1 = 'action1';
                    
                    function run() {
                      prepare(ACTION_1);
                      execute(ACTION_1);
                      release(ACTION_1);
                    }
                    

                    Exceptions

                    To prevent generating some false-positives, literals having less than 5 characters are excluded.

                    Define a constant instead of duplicating this literal "albumCount" 4 times.
                    Open

                                    $xartist->addAttribute('albumCount', (string)$artist->album_count);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by sonar-php

                    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                    Noncompliant Code Example

                    With the default threshold of 3:

                    function run() {
                      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                      execute('action1');
                      release('action1');
                    }
                    

                    Compliant Solution

                    ACTION_1 = 'action1';
                    
                    function run() {
                      prepare(ACTION_1);
                      execute(ACTION_1);
                      release(ACTION_1);
                    }
                    

                    Exceptions

                    To prevent generating some false-positives, literals having less than 5 characters are excluded.

                    Remove this commented out code.
                    Open

                            //$xalbum->addAttribute('discNumber', (string)$album->disk);

                    Programmers should not comment out code as it bloats programs and reduces readability.

                    Unused code should be deleted and can be retrieved from source control history if required.

                    See

                    • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
                    • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
                    • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
                    • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

                    Remove this commented out code.
                    Open

                                // $artist = new Artist($song->artist);

                    Programmers should not comment out code as it bloats programs and reduces readability.

                    Unused code should be deleted and can be retrieved from source control history if required.

                    See

                    • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
                    • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
                    • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
                    • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

                    Remove this commented out code.
                    Open

                            //$xartist->addChild('lastFmUrl', "");

                    Programmers should not comment out code as it bloats programs and reduces readability.

                    Unused code should be deleted and can be retrieved from source control history if required.

                    See

                    • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
                    • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
                    • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
                    • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

                    Define a constant instead of duplicating this literal "track" 4 times.
                    Open

                                    $xsong->addAttribute('track', (string)$song->track);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by sonar-php

                    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                    Noncompliant Code Example

                    With the default threshold of 3:

                    function run() {
                      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                      execute('action1');
                      release('action1');
                    }
                    

                    Compliant Solution

                    ACTION_1 = 'action1';
                    
                    function run() {
                      prepare(ACTION_1);
                      execute(ACTION_1);
                      release(ACTION_1);
                    }
                    

                    Exceptions

                    To prevent generating some false-positives, literals having less than 5 characters are excluded.

                    Remove this commented out code.
                    Open

                            //$xartist->addChild('lastFmUrl', "");

                    Programmers should not comment out code as it bloats programs and reduces readability.

                    Unused code should be deleted and can be retrieved from source control history if required.

                    See

                    • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
                    • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
                    • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
                    • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

                    Add a "case default" clause to this "switch" statement.
                    Open

                            switch ($dirType) {
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by sonar-php

                    The requirement for a final case default clause is defensive programming. The clause should either take appropriate action, or contain a suitable comment as to why no action is taken. Even when the switch covers all current values of an enum, a default case should still be used because there is no guarantee that the enum won't be extended.

                    Noncompliant Code Example

                    switch ($param) {  //missing default clause
                      case 0:
                        do_something();
                        break;
                      case 1:
                        do_something_else();
                        break;
                    }
                    
                    switch ($param) {
                      default: // default clause should be the last one
                        error();
                        break;
                      case 0:
                        do_something();
                        break;
                      case 1:
                        do_something_else();
                        break;
                    }
                    

                    Compliant Solution

                    switch ($param) {
                      case 0:
                        do_something();
                        break;
                      case 1:
                        do_something_else();
                        break;
                      default:
                        error();
                        break;
                    }
                    

                    See

                    • MISRA C:2004, 15.0 - The MISRA C switch syntax shall be used.
                    • MISRA C:2004, 15.3 - The final clause of a switch statement shall be the default clause
                    • MISRA C++:2008, 6-4-3 - A switch statement shall be a well-formed switch statement.
                    • MISRA C++:2008, 6-4-6 - The final clause of a switch statement shall be the default-clause
                    • MISRA C:2012, 16.1 - All switch statements shall be well-formed
                    • MISRA C:2012, 16.4 - Every switch statement shall have a default label
                    • MISRA C:2012, 16.5 - A default label shall appear as either the first or the last switch label of a switch statement
                    • MITRE, CWE-478 - Missing Default Case in Switch Statement
                    • CERT, MSC01-C. - Strive for logical completeness
                    • CERT, MSC01-CPP. - Strive for logical completeness

                    Remove this commented out code.
                    Open

                                //$xsong->addAttribute('created', );

                    Programmers should not comment out code as it bloats programs and reduces readability.

                    Unused code should be deleted and can be retrieved from source control history if required.

                    See

                    • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
                    • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
                    • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
                    • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

                    Add a "case default" clause to this "switch" statement.
                    Open

                            switch ($code) {
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by sonar-php

                    The requirement for a final case default clause is defensive programming. The clause should either take appropriate action, or contain a suitable comment as to why no action is taken. Even when the switch covers all current values of an enum, a default case should still be used because there is no guarantee that the enum won't be extended.

                    Noncompliant Code Example

                    switch ($param) {  //missing default clause
                      case 0:
                        do_something();
                        break;
                      case 1:
                        do_something_else();
                        break;
                    }
                    
                    switch ($param) {
                      default: // default clause should be the last one
                        error();
                        break;
                      case 0:
                        do_something();
                        break;
                      case 1:
                        do_something_else();
                        break;
                    }
                    

                    Compliant Solution

                    switch ($param) {
                      case 0:
                        do_something();
                        break;
                      case 1:
                        do_something_else();
                        break;
                      default:
                        error();
                        break;
                    }
                    

                    See

                    • MISRA C:2004, 15.0 - The MISRA C switch syntax shall be used.
                    • MISRA C:2004, 15.3 - The final clause of a switch statement shall be the default clause
                    • MISRA C++:2008, 6-4-3 - A switch statement shall be a well-formed switch statement.
                    • MISRA C++:2008, 6-4-6 - The final clause of a switch statement shall be the default-clause
                    • MISRA C:2012, 16.1 - All switch statements shall be well-formed
                    • MISRA C:2012, 16.4 - Every switch statement shall have a default label
                    • MISRA C:2012, 16.5 - A default label shall appear as either the first or the last switch label of a switch statement
                    • MITRE, CWE-478 - Missing Default Case in Switch Statement
                    • CERT, MSC01-C. - Strive for logical completeness
                    • CERT, MSC01-CPP. - Strive for logical completeness

                    Avoid unused local variables such as '$podcastRepository'.
                    Open

                            $podcastRepository = self::getPodcastRepository();
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    UnusedLocalVariable

                    Since: 0.2

                    Detects when a local variable is declared and/or assigned, but not used.

                    Example

                    class Foo {
                        public function doSomething()
                        {
                            $i = 5; // Unused
                        }
                    }

                    Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

                    TODO found
                    Open

                                    // TODO addEntry
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by fixme

                    TODO found
                    Open

                                // TODO This can be random play, democratic, podcasts, etc. not just songs
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by fixme

                    TODO found
                    Open

                                // TODO addChild || use addChildArray
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by fixme

                    TODO found
                    Open

                                // TODO addEntry
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by fixme

                    TODO found
                    Open

                                    // TODO addEntry
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by fixme

                    TODO found
                    Open

                                // TODO addEntry
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by fixme

                    TODO found
                    Open

                                    // TODO addEntry
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by fixme

                    TODO found
                    Open

                                // TODO addEntry
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by fixme

                    TODO found
                    Open

                                    // TODO addEntry
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by fixme

                    TODO found
                    Open

                                    // TODO addEntry
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by fixme

                    TODO found
                    Open

                                    // TODO addEntry
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by fixme

                    TODO found
                    Open

                                // TODO addChild || use addChildArray
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by fixme

                    TODO found
                    Open

                                // TODO addEntry
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by fixme

                    TODO found
                    Open

                            $xjbox->addAttribute('position', '0'); // TODO Not supported
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by fixme

                    TODO found
                    Open

                                // TODO addEntry
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by fixme

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xartist->addAttribute('name', (string)self::_checkName($artist->get_fullname()));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        public static function addAlbumList($xml, $albums): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        public static function addAlbum($xml, $album, $songs = false, $elementName = "album"): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method has_art from undeclared class \Ampache\Repository\Model\Album
                    Open

                            if ($album->has_art()) {
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xindexes->addAttribute('lastModified', number_format($lastModified * 1000, 0, '.', ''));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                    $xartist->addAttribute('albumCount', (string)count($allalbums));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method __construct from undeclared class \Ampache\Repository\Model\Album
                    Open

                                    $album = new Album($album_id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $album has undeclared type \Ampache\Repository\Model\Album
                    Open

                        public static function addAlbum($xml, $album, $songs = false, $elementName = "album"): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method get_user_rating from undeclared class \Ampache\Repository\Model\Rating
                    Open

                            $user_rating = ($rating->get_user_rating() ?? 0);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method isNew from undeclared class \Ampache\Repository\Model\Artist
                    Open

                            if ($artist->isNew()) {
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property id from undeclared class \Ampache\Repository\Model\Artist
                    Open

                                $allalbums = static::getAlbumRepository()->getAlbumByArtist($artist->id);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xchild->addAttribute('id', $sub_id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method isNew from undeclared class \Ampache\Repository\Model\Album
                    Open

                            if ($album->isNew()) {
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property total_count from undeclared class \Ampache\Repository\Model\Album
                    Open

                            $xalbum->addAttribute('playCount', (string)$album->total_count);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property year from undeclared class \Ampache\Repository\Model\Album
                    Open

                                : $album->year;
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property tags from undeclared class \Ampache\Repository\Model\Album
                    Open

                                $tag_values = array_values($album->tags);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method format from undeclared class \Ampache\Repository\Model\Album
                    Open

                            $album->format();
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property song_count from undeclared class \Ampache\Repository\Model\Album
                    Open

                            $xalbum->addAttribute('songCount', (string) $album->song_count);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xalbum->addAttribute('artistId', (string)self::_getArtistId($album->album_artist));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method get_artist_fullname from undeclared class \Ampache\Repository\Model\Album
                    Open

                            $xalbum->addAttribute('artist', (string) self::_checkName($album->get_artist_fullname()));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property title from undeclared class \Ampache\Repository\Model\Song
                    Open

                                $xsong->addAttribute('title', (string)self::_checkName($song->title));
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xsong->addAttribute('isDir', 'false');
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xsong->addAttribute('albumId', $subParent);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        public static function addLicense($xml): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property album_artist from undeclared class \Ampache\Repository\Model\Album
                    Open

                                $xalbum->addAttribute('parent', (string)self::_getArtistId($album->album_artist));
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property total_duration from undeclared class \Ampache\Repository\Model\Album
                    Open

                            $xalbum->addAttribute('duration', (string) $album->total_duration);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property tags from undeclared class \Ampache\Repository\Model\Album
                    Open

                            if (count($album->tags) > 0) {
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xalbum->addAttribute('genre', (string)$tag['name']);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method __construct from undeclared class \Ampache\Repository\Model\Rating
                    Open

                            $rating      = new Rating($album->id, "album");
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method __construct from undeclared class \Ampache\Repository\Model\Song
                    Open

                            $song = new Song($song_id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xsong->addAttribute('title', (string)self::_checkName($song->title));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xsong->addAttribute('isVideo', 'false');
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xerr->addAttribute('message', (string)$message);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        public static function addMusicFolders($xml, $catalogs): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Return type of addSubsonicResponse() is undeclared type \SimpleXMLElement
                    Open

                        public static function addSubsonicResponse($function): SimpleXMLElement
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xml->addAttribute('ignoredArticles', (string)$ignoredArticles);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xartist->addAttribute('id', $sub_id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to deprecated function \Ampache\Module\Api\Subsonic_Xml_Data::getAlbumRepository() defined at /code/src/Module/Api/Subsonic_Xml_Data.php:1817
                    Open

                                $allalbums = static::getAlbumRepository()->getAlbumByArtist($artist->id);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method __construct from undeclared class \Ampache\Repository\Model\Album
                    Open

                                $album = new Album($album_id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        private static function addChildArray($xml, $child): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xalbum->addAttribute('playCount', (string)$album->total_count);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Return type of addSong() is undeclared type \SimpleXMLElement
                    Open

                        public static function addSong($xml, $song_id, $elementName = 'song'): SimpleXMLElement
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xartist->addAttribute('albumCount', (string)$artist['album_count']);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method isNew from undeclared class \Ampache\Repository\Model\Song
                    Open

                            if ($song->isNew()) {
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xalbum->addAttribute('isDir', 'true');
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property id from undeclared class \Ampache\Repository\Model\Album
                    Open

                            $rating      = new Rating($album->id, "album");
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to deprecated function \Ampache\Module\Api\Subsonic_Xml_Data::getAlbumRepository() defined at /code/src/Module/Api/Subsonic_Xml_Data.php:1817
                    Open

                                $media_ids = static::getAlbumRepository()->getSongs($album->id);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        public static function addSong($xml, $song_id, $elementName = 'song'): SimpleXMLElement
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xerr->addAttribute('code', (string)$code);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        private static function addIgnoredArticles($xml): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property id from undeclared class \Ampache\Repository\Model\Artist
                    Open

                            $sub_id  = (string)self::_getArtistId($artist->id);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property id from undeclared class \Ampache\Repository\Model\Artist
                    Open

                                self::_setIfStarred($xartist, 'artist', $artist->id);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xchild->addAttribute('isDir', 'true');
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xalbum->addAttribute('id', $sub_id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property original_year from undeclared class \Ampache\Repository\Model\Album
                    Open

                                ? $album->original_year
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xlic->addAttribute('valid', 'true');
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        public static function addArtist($xml, $artist, $extra = false, $albums = false, $albumsSet = false): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        private static function addArtistArray($xml, $artist): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xartist->addAttribute('name', (string)self::_checkName($artist['f_name']));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method get_fullname from undeclared class \Ampache\Repository\Model\Album
                    Open

                            $f_name = (string)self::_checkName($album->get_fullname());
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property addition_time from undeclared class \Ampache\Repository\Model\Album
                    Open

                            $xalbum->addAttribute('created', date("c", (int)$album->addition_time));
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Return type of addError() is undeclared type \SimpleXMLElement
                    Open

                        public static function addError($code, $function): SimpleXMLElement
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xlic->addAttribute('email', 'webmaster@ampache.org');
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method get_fullname from undeclared class \Ampache\Repository\Model\Artist
                    Open

                            $xartist->addAttribute('name', (string)self::_checkName($artist->get_fullname()));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method create_from_id from undeclared class \Ampache\Repository\Model\Catalog
                    Open

                                $catalog = Catalog::create_from_id($folder_id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                    $xartist->addAttribute('albumCount', (string)$artist->album_count);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        private static function addIndex($xml, $artists): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xchild->addAttribute('title', (string)self::_checkName($child['f_name']));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xalbum->addAttribute('name', $f_name);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $artist has undeclared type \Ampache\Repository\Model\Artist
                    Open

                        public static function addArtist($xml, $artist, $extra = false, $albums = false, $albumsSet = false): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property album_artist from undeclared class \Ampache\Repository\Model\Album
                    Open

                                $xalbum->addAttribute('artistId', (string)self::_getArtistId($album->album_artist));
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method __construct from undeclared class \Ampache\Repository\Model\Album
                    Open

                                $album = new Album($album_id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xalbum->addAttribute('averageRating', (string)$avg_rating);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xalbum->addAttribute('created', date("c", (int)$album->addition_time));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xsong->addAttribute('parent', $subParent);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                        $xlastcat->addAttribute('name', (string)$xlastletter);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method format from undeclared class \Ampache\Repository\Model\Artist
                    Open

                            $artist->format();
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xchild->addAttribute('parent', $child['catalog_id']);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xartist->addAttribute('coverArt', 'ar-' . $sub_id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xalbum->addAttribute('coverArt', 'al-' . $sub_id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property album_artist from undeclared class \Ampache\Repository\Model\Album
                    Open

                            if ($album->album_artist) {
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property original_year from undeclared class \Ampache\Repository\Model\Album
                    Open

                            $year          = ($original_year && $album->original_year)
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xalbum->addAttribute('year', (string)$year);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property id from undeclared class \Ampache\Repository\Model\Album
                    Open

                                $media_ids = static::getAlbumRepository()->getSongs($album->id);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xsong->addAttribute('id', $sub_id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xsong->addAttribute('type', 'music');
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xchild->addAttribute('artist', (string)self::_checkName($child['f_name']));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xchild->addAttribute('coverArt', 'ar-' . $sub_id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xalbum->addAttribute('title', $f_name);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property id from undeclared class \Ampache\Repository\Model\Album
                    Open

                            self::_setIfStarred($xalbum, 'album', $album->id);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property id from undeclared class \Ampache\Repository\Model\Song
                    Open

                                $sub_id    = (string)self::_getSongId($song->id);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xfolder->addAttribute('id', (string)$folder_id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xfolder->addAttribute('name', (string)$catalog->name);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xsharpcat->addAttribute('name', '#');
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                    $xartist->addAttribute('coverArt', 'ar-' . $sub_id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property album_count from undeclared class \Ampache\Repository\Model\Artist
                    Open

                                    $xartist->addAttribute('albumCount', (string)$artist->album_count);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property album_artist from undeclared class \Ampache\Repository\Model\Album
                    Open

                            if ($album->album_artist) {
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xalbum->addAttribute('parent', (string)self::_getArtistId($album->album_artist));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        public static function addIndexes($xml, $artists, $lastModified = 0): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xartist->addAttribute('id', $sub_id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xalbum->addAttribute('userRating', (string)ceil($user_rating));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method get_average_rating from undeclared class \Ampache\Repository\Model\Rating
                    Open

                            $avg_rating = $rating->get_average_rating();
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property enabled from undeclared class \Ampache\Repository\Model\Song
                    Open

                            if ($song->enabled) {
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property album from undeclared class \Ampache\Repository\Model\Song
                    Open

                                $subParent = (string)self::_getAlbumId($song->album);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        public static function addArtists($xml, $artists): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method has_art from undeclared class \Ampache\Repository\Model\Artist
                    Open

                                if ($artist->has_art()) {
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        public static function addAlbumList2($xml, $albums): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property id from undeclared class \Ampache\Repository\Model\Album
                    Open

                            $sub_id = (string)self::_getAlbumId($album->id);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xalbum->addAttribute('album', $f_name);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xalbum->addAttribute('songCount', (string) $album->song_count);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xalbum->addAttribute('duration', (string) $album->total_duration);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xalbum->addAttribute('artist', (string) self::_checkName($album->get_artist_fullname()));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property year from undeclared class \Ampache\Repository\Model\Song
                    Open

                                if ($song->year > 0) {
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method get_cache_path from undeclared class \Ampache\Repository\Model\Catalog
                    Open

                                    $file_target    = Catalog::get_cache_path($song->getId(), $song->getCatalogId(), $cache_path, $cache_target);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property size from undeclared class \Ampache\Repository\Model\Video
                    Open

                            $xvideo->addAttribute('size', (string)$video->size);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to undeclared property \Ampache\Repository\Model\Playlist->last_update
                    Open

                            $xplaylist->addAttribute('changed', date("c", (int)$playlist->last_update));
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method get_id_array from undeclared class \Ampache\Repository\Model\Artist
                    Open

                            $data      = Artist::get_id_array($artist_id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xdir->addAttribute('id', (string)$catalog_id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property type from undeclared class \Ampache\Repository\Model\Video
                    Open

                            $xvideo->addAttribute('suffix', (string)$video->type);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method isNew from undeclared class \Ampache\Repository\Model\Search
                    Open

                                    $playlist->isNew() ||
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method get_album_fullname from undeclared class \Ampache\Repository\Model\Song
                    Open

                                $xsong->addAttribute('album', (string)self::_checkName($song->get_album_fullname()));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xsong->addAttribute('artist', (string)self::_checkName($song->get_artist_fullname()));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                    $xsong->addAttribute('discNumber', (string)$disk);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property album_artist from undeclared class \Ampache\Repository\Model\Album
                    Open

                            if ($album->album_artist) {
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        public static function addPlaylist($xml, $playlist, $songs = false): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xplaylist->addAttribute('id', $sub_id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property type from undeclared class \Ampache\Repository\Model\Song
                    Open

                                $xsong->addAttribute('suffix', (string)$song->type);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xsong->addAttribute('contentType', (string)$song->mime);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property catalog from undeclared class \Ampache\Repository\Model\Album
                    Open

                                $xdir->addAttribute('parent', (string)$album->catalog);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xgenre->addAttribute('albumCount', (string)($counts['album'] ?? 0));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        public static function addVideos($xml, $videos): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $video has undeclared type \Ampache\Repository\Model\Video
                    Open

                        private static function addVideo($xml, $video, $elementName = 'video'): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xvideo->addAttribute('duration', (string)$video->time);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                    $xvideo->addAttribute('transcodedSuffix', (string)$transcode_type);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xvideoinfo->addAttribute('id', (string)$video_id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property id from undeclared class \Ampache\Repository\Model\Song
                    Open

                                self::_setIfStarred($xsong, 'song', $song->id);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property size from undeclared class \Ampache\Repository\Model\Song
                    Open

                                $xsong->addAttribute('size', (string)$song->size);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method __construct from undeclared class \Ampache\Repository\Model\Album
                    Open

                                $album = new Album($album_id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property album_artist from undeclared class \Ampache\Repository\Model\Album
                    Open

                                $xdir->addAttribute('parent', (string)self::_getArtistId($album->album_artist));
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property id from undeclared class \Ampache\Repository\Model\Album
                    Open

                            self::_setIfStarred($xdir, 'album', $album->id);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xgenre->addAttribute('songCount', (string)($counts['song'] ?? 0));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method has_art from undeclared class \Ampache\Repository\Model\Video
                    Open

                            if ($video->has_art()) {
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xvideo->addAttribute('coverArt', $sub_id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xvideo->addAttribute('genre', (string)$tags[0]['name']);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to undeclared property \Ampache\Repository\Model\Playlist->id
                    Open

                            $sub_id    = (string)self::_getPlaylistId($playlist->id);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to undeclared method \Ampache\Repository\Model\Playlist::has_art
                    Open

                            if ($playlist->has_art()) {
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xplaylist->addAttribute('coverArt', $sub_id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        private static function addPlaylist_Search($xml, $search, $songs = false): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xsong->addAttribute('album', (string)self::_checkName($song->get_album_fullname()));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                    $xsong->addAttribute('coverArt', $art_id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property id from undeclared class \Ampache\Repository\Model\Song
                    Open

                                $rating      = new Rating($song->id, "song");
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                    $xsong->addAttribute('userRating', (string)ceil($user_rating));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                    $xsong->addAttribute('averageRating', (string)$avg_rating);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                        $xsong->addAttribute('transcodedSuffix', $transcode_type);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property id from undeclared class \Ampache\Repository\Model\Video
                    Open

                            $sub_id = (string)self::_getVideoId($video->id);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method getFileName from undeclared class \Ampache\Repository\Model\Video
                    Open

                            $xvideo->addAttribute('title', $video->getFileName());
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xvideo->addAttribute('isDir', 'false');
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xvideo->addAttribute('contentType', (string)$video->mime);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                    $xvideo->addAttribute('transcodedContentType', Video::type_to_mime($transcode_type));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $playlist has undeclared type \Ampache\Repository\Model\Search
                    Open

                        public static function addPlaylist($xml, $playlist, $songs = false): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to undeclared property \Ampache\Repository\Model\Playlist->type
                    Open

                            $xplaylist->addAttribute('public', ($playlist->type != "private") ? "true" : "false");
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xplaylist->addAttribute('id', $sub_id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                    $xsong->addAttribute('genre', (string)$tags[0]['name']);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to deprecated function \Ampache\Module\Api\Subsonic_Xml_Data::getAlbumRepository() defined at /code/src/Module/Api/Subsonic_Xml_Data.php:1817
                    Open

                            $allalbums = static::getAlbumRepository()->getAlbumByArtist($artist_id);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xdir->addAttribute('name', (string)self::_checkName($album->get_fullname()));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xvideo->addAttribute('suffix', (string)$video->type);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to undeclared property \Ampache\Repository\Model\Playlist->user
                    Open

                                if ($hide_dupe_searches && $playlist->user == $user_id) {
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xplaylist->addAttribute('changed', date("c", (int)$playlist->last_update));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $search has undeclared type \Ampache\Repository\Model\Search
                    Open

                        private static function addPlaylist_Search($xml, $search, $songs = false): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property time from undeclared class \Ampache\Repository\Model\Song
                    Open

                                $xsong->addAttribute('duration', (string)$song->time);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method get_artist_fullname from undeclared class \Ampache\Repository\Model\Song
                    Open

                                $xsong->addAttribute('artist', (string)self::_checkName($song->get_artist_fullname()));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property bitrate from undeclared class \Ampache\Repository\Model\Song
                    Open

                                $xsong->addAttribute('bitRate', (string)((int)($song->bitrate / 1024)));
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property file from undeclared class \Ampache\Repository\Model\Song
                    Open

                                $xsong->addAttribute('path', (string)$song->file);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property type from undeclared class \Ampache\Repository\Model\Song
                    Open

                                        : Stream::get_transcode_format($song->type, null, 'api');
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        private static function addDirectory_Album($xml, $album_id): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        private static function addDirectory_Artist($xml, $sub_id): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method __construct from undeclared class \Ampache\Repository\Model\Album
                    Open

                            $album = new Album(self::_getAmpacheId($album_id));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xdir->addAttribute('parent', (string)$album->catalog);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property id from undeclared class \Ampache\Repository\Model\Album
                    Open

                            $media_ids = static::getAlbumRepository()->getSongs($album->id);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xvideo->addAttribute('isVideo', 'true');
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method format from undeclared class \Ampache\Repository\Model\Album
                    Open

                            $album->format();
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to deprecated function \Ampache\Module\Api\Subsonic_Xml_Data::getAlbumRepository() defined at /code/src/Module/Api/Subsonic_Xml_Data.php:1817
                    Open

                            $media_ids = static::getAlbumRepository()->getSongs($album->id);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xvideo->addAttribute('size', (string)$video->size);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method __construct from undeclared class \Ampache\Repository\Model\Tag
                    Open

                                $otag   = new Tag($tag['id']);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property time from undeclared class \Ampache\Repository\Model\Video
                    Open

                            $xvideo->addAttribute('duration', (string)$video->time);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property file from undeclared class \Ampache\Repository\Model\Video
                    Open

                            $path = basename($video->file);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xdir->addAttribute('name', (string)$catalog->name);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property year from undeclared class \Ampache\Repository\Model\Video
                    Open

                            if (isset($video->year) && $video->year > 0) {
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xvideo->addAttribute('year', (string)$video->year);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method type_to_mime from undeclared class \Ampache\Repository\Model\Video
                    Open

                                    $xvideo->addAttribute('transcodedContentType', Video::type_to_mime($transcode_type));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xvideo->addAttribute('path', (string)$path);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xvideo->addAttribute('type', 'video');
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        public static function addPlaylists($xml, $user_id, $playlists, $smartplaylists = array(), $hide_dupe_searches = false): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property id from undeclared class \Ampache\Repository\Model\Search
                    Open

                            $sub_id    = (string) self::_getSmartPlaylistId($search->id);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        private static function addPlaylist_Playlist($xml, $playlist, $songs = false): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to undeclared method \Ampache\Repository\Model\Playlist::get_fullname
                    Open

                            $xplaylist->addAttribute('name', (string)self::_checkName($playlist->get_fullname()));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method has_art from undeclared class \Ampache\Repository\Model\Song
                    Open

                                if ($song->has_art()) {
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xsong->addAttribute('bitRate', (string)((int)($song->bitrate / 1024)));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method __construct from undeclared class \Ampache\Repository\Model\Rating
                    Open

                                $rating      = new Rating($song->id, "song");
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method get_user_rating from undeclared class \Ampache\Repository\Model\Rating
                    Open

                                $user_rating = ($rating->get_user_rating() ?? 0);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xsong->addAttribute('suffix', (string)$song->type);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xsong->addAttribute('artistId', ($song->artist) ? (string)self::_getArtistId($song->artist) : '');
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method getId from undeclared class \Ampache\Repository\Model\Song
                    Open

                                    $file_target    = Catalog::get_cache_path($song->getId(), $song->getCatalogId(), $cache_path, $cache_target);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property track from undeclared class \Ampache\Repository\Model\Song
                    Open

                                    $xsong->addAttribute('track', (string)$song->track);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property year from undeclared class \Ampache\Repository\Model\Song
                    Open

                                    $xsong->addAttribute('year', (string)$song->year);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xsong->addAttribute('size', (string)$song->size);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method get_artist_arrays from undeclared class \Ampache\Repository\Model\Catalog
                    Open

                            $allartists = Catalog::get_artist_arrays(array($catalog_id));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method get_average_rating from undeclared class \Ampache\Repository\Model\Rating
                    Open

                                $avg_rating = $rating->get_average_rating();
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method count from undeclared class \Ampache\Repository\Model\Tag
                    Open

                                $counts = $otag->count();
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xdir->addAttribute('id', (string)$album_id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                    $xsong->addAttribute('track', (string)$song->track);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xdir->addAttribute('parent', (string)self::_getArtistId($album->album_artist));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                    $xsong->addAttribute('year', (string)$song->year);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method get_fullname from undeclared class \Ampache\Repository\Model\Album
                    Open

                            $xdir->addAttribute('name', (string)self::_checkName($album->get_fullname()));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property name from undeclared class \Ampache\Repository\Model\Tag
                    Open

                                $xgenre = self::addChildToResultXml($xgenres, 'genre', htmlspecialchars((string)$otag->name));
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method create_from_id from undeclared class \Ampache\Repository\Model\Catalog
                    Open

                            $catalog = Catalog::create_from_id((int)$catalog_id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method getCatalogId from undeclared class \Ampache\Repository\Model\Song
                    Open

                                    $file_target    = Catalog::get_cache_path($song->getId(), $song->getCatalogId(), $cache_path, $cache_target);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        public static function addDirectory($xml, $sub_id, $dirType): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xvideo->addAttribute('id', $sub_id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xdir->addAttribute('name', (string)$data['f_name']);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property mime from undeclared class \Ampache\Repository\Model\Video
                    Open

                            $xvideo->addAttribute('contentType', (string)$video->mime);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        public static function addGenres($xml, $tags): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method format from undeclared class \Ampache\Repository\Model\Video
                    Open

                                $video->format();
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xplaylist->addAttribute('owner', (string)$playlist->username);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xplaylist->addAttribute('name', (string) self::_checkName($search->get_fullname()));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property year from undeclared class \Ampache\Repository\Model\Video
                    Open

                                $xvideo->addAttribute('year', (string)$video->year);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property user from undeclared class \Ampache\Repository\Model\Search
                    Open

                                    ($hide_dupe_searches && $playlist->user == $user_id && in_array($playlist->name, $playlist_names))
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method __construct from undeclared class \Ampache\Repository\Model\Search
                    Open

                                $playlist = new Search((int)str_replace('smart_', '', (string)$plist_id), 'song');
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xplaylist->addAttribute('created', date("c", (int)$playlist->date));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property name from undeclared class \Ampache\Repository\Model\Search
                    Open

                                    ($hide_dupe_searches && $playlist->user == $user_id && in_array($playlist->name, $playlist_names))
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xplaylist->addAttribute('name', (string)self::_checkName($playlist->get_fullname()));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to undeclared property \Ampache\Repository\Model\Playlist->date
                    Open

                            $xplaylist->addAttribute('created', date("c", (int)$playlist->date));
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xsong->addAttribute('duration', (string)$song->time);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property disk from undeclared class \Ampache\Repository\Model\Song
                    Open

                                $disk = $song->disk;
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        private static function addVideo($xml, $video, $elementName = 'video'): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property artist from undeclared class \Ampache\Repository\Model\Song
                    Open

                                $xsong->addAttribute('artistId', ($song->artist) ? (string)self::_getArtistId($song->artist) : '');
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xvideo->addAttribute('title', $video->getFileName());
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property track from undeclared class \Ampache\Repository\Model\Song
                    Open

                                if ($song->track > 0) {
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method get_transcode_settings from undeclared class \Ampache\Repository\Model\Video
                    Open

                                $transcode_settings = $video->get_transcode_settings(null, 'api');
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method get_object_tags from undeclared class \Ampache\Repository\Model\Tag
                    Open

                                $tags = Tag::get_object_tags('song', (int)$song->id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        public static function addVideoInfo($xml, $video_id): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property id from undeclared class \Ampache\Repository\Model\Song
                    Open

                                $tags = Tag::get_object_tags('song', (int)$song->id);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xplaylist->addAttribute('songCount', (string)$songcount);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property mime from undeclared class \Ampache\Repository\Model\Song
                    Open

                                $xsong->addAttribute('contentType', (string)$song->mime);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xplaylist->addAttribute('duration', (string)$duration);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xsong->addAttribute('path', (string)$song->file);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Argument 2 (target) is null but \Ampache\Module\Playback\Stream::get_transcode_format() takes string defined at /code/src/Module/Playback/Stream.php:104
                    Open

                                        : Stream::get_transcode_format($song->type, null, 'api');
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property type from undeclared class \Ampache\Repository\Model\Song
                    Open

                                    if (!empty($transcode_type) && $song->type !== $transcode_type) {
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        private static function addDirectory_Catalog($xml, $catalog_id): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $videos has undeclared type \Ampache\Repository\Model\Video[]
                    Open

                        public static function addVideos($xml, $videos): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method get_object_tags from undeclared class \Ampache\Repository\Model\Tag
                    Open

                            $tags = Tag::get_object_tags('video', (int)$video->id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property type from undeclared class \Ampache\Repository\Model\Video
                    Open

                            $valid_types   = Stream::get_stream_types_for_type($video->type, 'api');
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to undeclared property \Ampache\Repository\Model\Playlist->name
                    Open

                                    $playlist_names[] = $playlist->name;
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to undeclared property \Ampache\Repository\Model\Playlist->username
                    Open

                            $xplaylist->addAttribute('owner', (string)$playlist->username);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                        $xsong->addAttribute('transcodedContentType', Song::type_to_mime($transcode_type));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method type_to_mime from undeclared class \Ampache\Repository\Model\Song
                    Open

                                        $xsong->addAttribute('transcodedContentType', Song::type_to_mime($transcode_type));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xdir->addAttribute('id', (string)$sub_id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xdir->addAttribute('parent', (string)$data['catalog_id']);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property id from undeclared class \Ampache\Repository\Model\Video
                    Open

                            $tags = Tag::get_object_tags('video', (int)$video->id);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property id from undeclared class \Ampache\Repository\Model\Video
                    Open

                            self::_setIfStarred($xvideo, 'video', $video->id);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Checking instanceof against undeclared class \Ampache\Repository\Model\Search
                    Open

                            if ($playlist instanceof Search) {
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xplaylist->addAttribute('public', ($playlist->type != "private") ? "true" : "false");
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        public static function addNowPlaying($xml, $data): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method __construct from undeclared class \Ampache\Repository\Model\Artist
                    Open

                                $artist = new Artist((int) $artist_id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $user has undeclared type \Ampache\Repository\Model\User
                    Open

                        public static function addUser($xml, $user): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to deprecated function \Ampache\Module\Authorization\Access::check() defined at /code/src/Module/Authorization/Access.php:154
                    Open

                            $xuser->addAttribute('jukeboxRole', (AmpConfig::get('allow_localplay_playback') && AmpConfig::get('localplay_controller') && Access::check('localplay', 5)) ? 'true' : 'false');
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property name from undeclared class \Ampache\Repository\Model\Live_Stream
                    Open

                            $xradio->addAttribute('name', (string)self::_checkName($radio->name));
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method __construct from undeclared class \Ampache\Repository\Model\Share
                    Open

                                $share = new Share($share_id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xshare->addAttribute('username', (string)$user->username);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property creation_date from undeclared class \Ampache\Repository\Model\Share
                    Open

                            $xshare->addAttribute('created', date("c", (int)$share->creation_date));
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property lastvisit_date from undeclared class \Ampache\Repository\Model\Share
                    Open

                                $xshare->addAttribute('lastVisited', date("c", (int)$share->lastvisit_date));
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property object_type from undeclared class \Ampache\Repository\Model\Share
                    Open

                            } elseif ($share->object_type == 'album') {
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property username from undeclared class \Ampache\Repository\Model\Search
                    Open

                            $xplaylist->addAttribute('owner', (string)$search->username);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method get_total_duration from undeclared class \Ampache\Repository\Model\Search
                    Open

                                $duration = (count($allitems) > 0) ? Search::get_total_duration($allitems) : 0;
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method __construct from undeclared class \Ampache\Repository\Model\Artist
                    Open

                                $artist = new Artist((int) $artist_id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property username from undeclared class \Ampache\Repository\Model\User
                    Open

                            $xuser->addAttribute('username', (string)$user->username);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xuser->addAttribute('downloadRole', Preference::get_by_user($user->id, 'download') ? 'true' : 'false');
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xuser->addAttribute('commentRole', (AmpConfig::get('social')) ? 'true' : 'false');
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addChild from undeclared class \SimpleXMLElement
                    Open

                            $xartist->addChild('mediumImageUrl', htmlentities($info['mediumphoto']));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addChild from undeclared class \SimpleXMLElement
                    Open

                            $xartist->addChild('musicBrainzId', (string)$artist->mbid);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method __construct from undeclared class \Ampache\Repository\Model\Album
                    Open

                                $album = new Album($album_id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xuser->addAttribute('videoConversionRole', 'false');
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        private static function addShare($xml, $share): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xshare->addAttribute('created', date("c", (int)$share->creation_date));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xjbox->addAttribute('gain', (string)$status['volume']);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addChild from undeclared class \SimpleXMLElement
                    Open

                            $xartist->addChild('smallImageUrl', htmlentities($info['smallphoto']));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xplaylist->addAttribute('changed', date("c", time()));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xuser->addAttribute('adminRole', $isAdmin ? 'true' : 'false');
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method isNew from undeclared class \Ampache\Repository\Model\User
                    Open

                                if ($user->isNew() === false) {
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xradio->addAttribute('id', (string)$radio->id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property url from undeclared class \Ampache\Repository\Model\Live_Stream
                    Open

                            $xradio->addAttribute('streamUrl', (string)$radio->url);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xplaylist->addAttribute('duration', (string)$duration);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xplaylist->addAttribute('duration', (string)$search->last_duration);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                    $track->addAttribute('playerId', (string)$row['agent']);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property access from undeclared class \Ampache\Repository\Model\User
                    Open

                            $isAdmin   = ($user->access === 100);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xuser->addAttribute('jukeboxRole', (AmpConfig::get('allow_localplay_playback') && AmpConfig::get('localplay_controller') && Access::check('localplay', 5)) ? 'true' : 'false');
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        public static function addInternetRadioStations($xml, $radios): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property public_url from undeclared class \Ampache\Repository\Model\Share
                    Open

                            $xshare->addAttribute('url', (string)$share->public_url);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xshare->addAttribute('description', (string)$share->description);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xjbox->addAttribute('position', '0'); // TODO Not supported
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method get_lyrics from undeclared class \Ampache\Repository\Model\Song
                    Open

                            $lyrics = $song->get_lyrics();
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addChild from undeclared class \SimpleXMLElement
                    Open

                            $xartist->addChild('mediumImageUrl', htmlentities($info['mediumphoto']));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xplaylist->addAttribute('owner', (string)$search->username);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xplayqueue->addAttribute('changedBy', (string)$changedBy);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property access from undeclared class \Ampache\Repository\Model\User
                    Open

                            $isManager = ($user->access >= 75);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        public static function addUsers($xml, $users): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property max_counter from undeclared class \Ampache\Repository\Model\Share
                    Open

                                if ($share->max_counter === 0 || $share->counter < $share->max_counter) {
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property user from undeclared class \Ampache\Repository\Model\Share
                    Open

                            $user = new User($share->user);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property expire_days from undeclared class \Ampache\Repository\Model\Share
                    Open

                            if ($share->expire_days > 0) {
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addChild from undeclared class \SimpleXMLElement
                    Open

                            $xartist->addChild('musicBrainzId', $album->mbid);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property last_duration from undeclared class \Ampache\Repository\Model\Search
                    Open

                                $xplaylist->addAttribute('duration', (string)$search->last_duration);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method get_items from undeclared class \Ampache\Repository\Model\User_Playlist
                    Open

                            $items = $playQueue->get_items();
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xuser->addAttribute('shareRole', Preference::get_by_user($user->id, 'share') ? 'true' : 'false');
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property id from undeclared class \Ampache\Repository\Model\Live_Stream
                    Open

                            $xradio->addAttribute('id', (string)$radio->id);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $share has undeclared type \Ampache\Repository\Model\Share
                    Open

                        private static function addShare($xml, $share): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property username from undeclared class \Ampache\Repository\Model\User
                    Open

                            $xshare->addAttribute('username', (string)$user->username);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property lastvisit_date from undeclared class \Ampache\Repository\Model\Share
                    Open

                            if ($share->lastvisit_date > 0) {
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property mbid from undeclared class \Ampache\Repository\Model\Artist
                    Open

                            $xartist->addChild('musicBrainzId', (string)$artist->mbid);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xplaylist->addAttribute('public', ($search->type != "private") ? "true" : "false");
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property date from undeclared class \Ampache\Repository\Model\Search
                    Open

                            $xplaylist->addAttribute('created', date("c", (int)$search->date));
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xplaylist->addAttribute('coverArt', $sub_id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xuser->addAttribute('scrobblingEnabled', 'true');
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property id from undeclared class \Ampache\Repository\Model\User
                    Open

                            $xuser->addAttribute('shareRole', Preference::get_by_user($user->id, 'share') ? 'true' : 'false');
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xshare->addAttribute('lastVisited', date("c", (int)$share->lastvisit_date));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property creation_date from undeclared class \Ampache\Repository\Model\Share
                    Open

                                $xshare->addAttribute('expires', date("c", (int)$share->creation_date + ($share->expire_days * 86400)));
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property object_id from undeclared class \Ampache\Repository\Model\Share
                    Open

                                $songs = static::getSongRepository()->getByAlbum($share->object_id);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addChild from undeclared class \SimpleXMLElement
                    Open

                            $xartist->addChild('largeImageUrl', htmlentities($info['largephoto']));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addChild from undeclared class \SimpleXMLElement
                    Open

                            $xartist->addChild('largeImageUrl', htmlentities($info['largephoto']));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method get_items from undeclared class \Ampache\Repository\Model\Search
                    Open

                                $allitems = $search->get_items();
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xplaylist->addAttribute('songCount', (string)$search->last_count);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method __construct from undeclared class \Ampache\Repository\Model\Album
                    Open

                                $album = new Album($album_id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property id from undeclared class \Ampache\Repository\Model\Share
                    Open

                            $xshare->addAttribute('id', (string)$share->id);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xshare->addAttribute('url', (string)$share->public_url);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property object_id from undeclared class \Ampache\Repository\Model\Share
                    Open

                                $playlist = new Playlist($share->object_id);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Return type of addJukeboxStatus() is undeclared type \SimpleXMLElement
                    Open

                        public static function addJukeboxStatus($xml, LocalPlay $localplay, $elementName = 'jukeboxStatus'): SimpleXMLElement
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property mbid from undeclared class \Ampache\Repository\Model\Album
                    Open

                            $xartist->addChild('musicBrainzId', $album->mbid);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xplaylist->addAttribute('created', date("c", (int)$search->date));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        public static function addRandomSongs($xml, $songs): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method __construct from undeclared class \Ampache\Repository\Model\Artist
                    Open

                                $artist = new Artist((int) $artist_id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        public static function addStarred($xml, $artists, $albums, $songs): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        public static function addStarred2($xml, $artists, $albums, $songs): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xuser->addAttribute('username', (string)$user->username);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xradio->addAttribute('name', (string)self::_checkName($radio->name));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property description from undeclared class \Ampache\Repository\Model\Share
                    Open

                            $xshare->addAttribute('description', (string)$share->description);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xshare->addAttribute('expires', date("c", (int)$share->creation_date + ($share->expire_days * 86400)));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method __construct from undeclared class \Ampache\Repository\Model\Song
                    Open

                            $song = new Song($song_id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        public static function addAlbumInfo($xml, $info): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        public static function addArtistInfo($xml, $info, $similars, $elementName = 'artistInfo'): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addChild from undeclared class \SimpleXMLElement
                    Open

                                $xartist->addChild('biography', htmlspecialchars($biography));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $playQueue has undeclared type \Ampache\Repository\Model\User_Playlist
                    Open

                        public static function addPlayQueue($xml, $playQueue, $username): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        public static function addPlayQueue($xml, $playQueue, $username): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        public static function addSearchResult2($xml, $artists, $albums, $songs): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method __construct from undeclared class \Ampache\Repository\Model\Artist
                    Open

                                $artist = new Artist((int) $artist_id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method __construct from undeclared class \Ampache\Repository\Model\Album
                    Open

                                $album = new Album($album_id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        public static function addUser($xml, $user): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property email from undeclared class \Ampache\Repository\Model\User
                    Open

                            $xuser->addAttribute('email', (string)$user->email);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xuser->addAttribute('settingsRole', 'true');
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property id from undeclared class \Ampache\Repository\Model\User
                    Open

                            $xuser->addAttribute('downloadRole', Preference::get_by_user($user->id, 'download') ? 'true' : 'false');
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xuser->addAttribute('coverArtRole', $isManager ? 'true' : 'false');
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property site_url from undeclared class \Ampache\Repository\Model\Live_Stream
                    Open

                            $xradio->addAttribute('homepageUrl', (string)$radio->site_url);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xshare->addAttribute('id', (string)$share->id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xshare->addAttribute('visitCount', (string)$share->counter);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        public static function addLyrics($xml, $artist, $title, $song_id): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                    $xlyrics->addAttribute('title', (string)$title);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        public static function addTopSongs($xml, $songs): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        private static function addInternetRadioStation($xml, $radio): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method __construct from undeclared class \Ampache\Repository\Model\User
                    Open

                            $user = new User($share->user);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property object_type from undeclared class \Ampache\Repository\Model\Share
                    Open

                            } elseif ($share->object_type == 'playlist') {
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to deprecated function \Ampache\Module\Api\Subsonic_Xml_Data::getSongRepository() defined at /code/src/Module/Api/Subsonic_Xml_Data.php:1807
                    Open

                                $songs = static::getSongRepository()->getByAlbum($share->object_id);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        public static function addJukeboxStatus($xml, LocalPlay $localplay, $elementName = 'jukeboxStatus'): SimpleXMLElement
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method __construct from undeclared class \Ampache\Repository\Model\Album
                    Open

                            $album = new Album((int) $info['id']);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addChild from undeclared class \SimpleXMLElement
                    Open

                            $xartist->addChild('smallImageUrl', htmlentities($info['smallphoto']));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xplaylist->addAttribute('songCount', (string)count($allitems));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property last_count from undeclared class \Ampache\Repository\Model\Search
                    Open

                                $xplaylist->addAttribute('songCount', (string)$search->last_count);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xplayqueue->addAttribute('position', (string)($current['current_time'] * 1000));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xplayqueue->addAttribute('username', (string)$username);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xplayqueue->addAttribute('changed', $date->format("c"));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xuser->addAttribute('email', (string)$user->email);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xuser->addAttribute('playlistRole', 'true');
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property counter from undeclared class \Ampache\Repository\Model\Share
                    Open

                                if ($share->max_counter === 0 || $share->counter < $share->max_counter) {
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method get_fullname from undeclared class \Ampache\Repository\Model\Search
                    Open

                            $xplaylist->addAttribute('name', (string) self::_checkName($search->get_fullname()));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property type from undeclared class \Ampache\Repository\Model\Search
                    Open

                            $xplaylist->addAttribute('public', ($search->type != "private") ? "true" : "false");
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xuser->addAttribute('podcastRole', (AmpConfig::get('podcast')) ? 'true' : 'false');
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $radio has undeclared type \Ampache\Repository\Model\Live_Stream
                    Open

                        private static function addInternetRadioStation($xml, $radio): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xjbox->addAttribute('currentIndex', (string)$index);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addChild from undeclared class \SimpleXMLElement
                    Open

                            $xartist->addChild('notes', htmlspecialchars(trim((string)$info['summary'])));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method get_current_object from undeclared class \Ampache\Repository\Model\User_Playlist
                    Open

                                $current   = $playQueue->get_current_object();
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method get_time from undeclared class \Ampache\Repository\Model\User_Playlist
                    Open

                                $play_time = date("Y-m-d H:i:s", $playQueue->get_time());
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xplayqueue->addAttribute('current', (string)self::_getSongId($current['object_id']));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xuser->addAttribute('streamRole', 'true');
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method __construct from undeclared class \Ampache\Repository\Model\Live_Stream
                    Open

                                $radio = new Live_Stream((int)$radio_id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xradio->addAttribute('streamUrl', (string)$radio->url);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xradio->addAttribute('homepageUrl', (string)$radio->site_url);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $shares has undeclared type \Ampache\Module\Api\list<int></int>
                    Open

                        public static function addShares($xml, $shares): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property expire_days from undeclared class \Ampache\Repository\Model\Share
                    Open

                                $xshare->addAttribute('expires', date("c", (int)$share->creation_date + ($share->expire_days * 86400)));
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property counter from undeclared class \Ampache\Repository\Model\Share
                    Open

                            $xshare->addAttribute('visitCount', (string)$share->counter);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property object_type from undeclared class \Ampache\Repository\Model\Share
                    Open

                            if ($share->object_type == 'song') {
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property object_id from undeclared class \Ampache\Repository\Model\Share
                    Open

                                self::addSong($xshare, $share->object_id, "entry");
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method fill_ext_info from undeclared class \Ampache\Repository\Model\Song
                    Open

                            $song->fill_ext_info('lyrics');
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method __construct from undeclared class \Ampache\Repository\Model\Artist
                    Open

                            $artist = new Artist((int) $info['id']);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xchannel->addAttribute('status', 'completed');
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xplaylist->addAttribute('coverArt', $sub_id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property client from undeclared class \Ampache\Repository\Model\User_Playlist
                    Open

                                $changedBy  = $playQueue->client ?? '';
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        public static function addSongsByGenre($xml, $songs): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                    $track->addAttribute('username', (string)$row['client']->username);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                    $track->addAttribute('minutesAgo', (string)(abs((time() - ($row['expire'] - $row['media']->time)) / 60)));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        public static function addSearchResult3($xml, $artists, $albums, $songs): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method __construct from undeclared class \Ampache\Repository\Model\Album
                    Open

                                $album = new Album($album_id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method __construct from undeclared class \Ampache\Repository\Model\User
                    Open

                                $user = new User($user_id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        public static function addShares($xml, $shares): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        public static function addJukeboxPlaylist($xml, LocalPlay $localplay): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xjbox->addAttribute('playing', ($status['state'] == 'play') ? 'true' : 'false');
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                    $xlyrics->addAttribute('artist', (string)$artist);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        public static function addArtistInfo2($xml, $info, $similars): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $bookmark has undeclared type \Ampache\Repository\Model\Bookmark
                    Open

                        private static function addBookmark($xml, $bookmark): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xepisode->addAttribute('parent', $subParent);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property mime from undeclared class \Ampache\Repository\Model\Podcast_Episode
                    Open

                                $xepisode->addAttribute('contentType', (string)$episode->mime);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method getSenderUserId from undeclared class \Ampache\Repository\Model\PrivateMsg
                    Open

                            $user      = new User($message->getSenderUserId());
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $response->addAttribute('serverVersion', Api::$version);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Return type of _createFailedResponse() is undeclared type \SimpleXMLElement
                    Open

                        private static function _createFailedResponse($function = ''): SimpleXMLElement
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method get_flag from undeclared class \Ampache\Repository\Model\Userflag
                    Open

                                    $result  = $starred->get_flag(null, true);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method __construct from undeclared class \Ampache\Repository\Model\Podcast_Episode
                    Open

                                        $episode = new Podcast_Episode($episode_id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property creation_date from undeclared class \Ampache\Repository\Model\Bookmark
                    Open

                            $xbookmark->addAttribute('created', date("c", (int)$bookmark->creation_date));
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xepisode->addAttribute('isDir', "false");
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $user has undeclared type \Ampache\Repository\Model\User
                    Open

                        public static function addScanStatus($xml, $user): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method __construct from undeclared class \Ampache\Repository\Model\User
                    Open

                            $user      = new User($message->getSenderUserId());
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xbookmark->addAttribute('username', (string)$user->username);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $response->addAttribute('version', (string)$version);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                        $xml->addAttribute('starred', date("Y-m-d\TH:i:s\Z", (int)$result[1]));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Return type of addChildToResultXml() is undeclared type \SimpleXMLElement
                    Open

                        private static function addChildToResultXml(SimpleXMLElement $xml, string $qualifiedName, ?string $value = null): SimpleXMLElement
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        public static function addSimilarSongs($xml, $similar_songs, $child): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        public static function addSimilarSongs2($xml, $similar_songs, $child): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method format from undeclared class \Ampache\Repository\Model\Podcast
                    Open

                                $podcast->format();
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property id from undeclared class \Ampache\Repository\Model\Podcast_Episode
                    Open

                            $sub_id    = (string)self::_getPodcastEpisodeId($episode->id);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xepisode->addAttribute('title', self::_checkName($episode->get_fullname()));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xbookmark->addAttribute('username', (string)$user->fullname);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xbookmark->addAttribute('time', (string)($message->getCreationDate() * 1000));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Return type of _getAmpacheObject() is undeclared type \Ampache\Repository\Model\Podcast_Episode
                    Open

                        public static function _getAmpacheObject($object_id)
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method __construct from undeclared class \Ampache\Repository\Model\Video
                    Open

                                return new Video(Subsonic_Xml_Data::_getAmpacheId($object_id));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        public static function addPodcasts($xml, $podcasts, $includeEpisodes = true): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method getEpisodeIds from undeclared class \Ampache\Repository\Model\Podcast
                    Open

                                    $episodes = $podcast->getEpisodeIds();
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property object_type from undeclared class \Ampache\Repository\Model\Bookmark
                    Open

                            } elseif ($bookmark->object_type == "video") {
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xchannel->addAttribute('description', $podcast->get_description());
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method __construct from undeclared class \Ampache\Repository\Model\Video
                    Open

                                self::addVideo($xbookmark, new Video($bookmark->object_id), 'entry');
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method get_description from undeclared class \Ampache\Repository\Model\Podcast
                    Open

                                $xchannel->addAttribute('description', $podcast->get_description());
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method __construct from undeclared class \Ampache\Repository\Model\Podcast_Episode
                    Open

                                self::addPodcastEpisode($xbookmark, new Podcast_Episode($bookmark->object_id), 'entry');
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property update_date from undeclared class \Ampache\Repository\Model\Bookmark
                    Open

                            $xbookmark->addAttribute('changed', date("c", (int)$bookmark->update_date));
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method get_fullname from undeclared class \Ampache\Repository\Model\Podcast_Episode
                    Open

                            $xepisode->addAttribute('title', self::_checkName($episode->get_fullname()));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property state from undeclared class \Ampache\Repository\Model\Podcast_Episode
                    Open

                            $xepisode->addAttribute('status', (string)$episode->state);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xepisode->addAttribute('coverArt', $subParent);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method get_server_counts from undeclared class \Ampache\Repository\Model\Catalog
                    Open

                            $counts = Catalog::get_server_counts($user->id ?? 0);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method getMessage from undeclared class \Ampache\Repository\Model\PrivateMsg
                    Open

                            $xbookmark->addAttribute('message', (string)$message->getMessage());
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xscan->addAttribute('count', (string)$count);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to deprecated function \debug_event() defined at /code/src/Config/functions.php:651
                    Open

                            debug_event(self::class, 'API success in function ' . $function . '-' . $version, 5);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        private static function addMessage($xml, $message): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $response->addAttribute('status', (string)$status);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method format from undeclared class \Ampache\Repository\Model\Podcast_Episode
                    Open

                                $episode->format();
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        private static function addBookmark($xml, $bookmark): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $episode has undeclared type \Ampache\Repository\Model\Podcast_Episode
                    Open

                        private static function addPodcastEpisode($xml, $episode, $elementName = 'episode'): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to deprecated function \Ampache\Module\Api\Subsonic_Xml_Data::getPodcastRepository() defined at /code/src/Module/Api/Subsonic_Xml_Data.php:1827
                    Open

                            $podcastRepository = self::getPodcastRepository();
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xepisode->addAttribute('description', self::_checkName($episode->get_description()));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xchannel->addAttribute('url', $podcast->getFeedUrl());
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addChild from undeclared class \SimpleXMLElement
                    Open

                            $child = $xml->addChild($qualifiedName, $value);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method has_art from undeclared class \Ampache\Repository\Model\Podcast
                    Open

                                if ($podcast->has_art()) {
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        public static function addBookmarks($xml, $bookmarks): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property object_id from undeclared class \Ampache\Repository\Model\Bookmark
                    Open

                                self::addVideo($xbookmark, new Video($bookmark->object_id), 'entry');
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property object_type from undeclared class \Ampache\Repository\Model\Bookmark
                    Open

                            } elseif ($bookmark->object_type == "podcast_episode") {
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xepisode->addAttribute('genre', "Podcast");
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property file from undeclared class \Ampache\Repository\Model\Podcast_Episode
                    Open

                            if ($episode->file) {
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xbookmark->addAttribute('position', (string)$bookmark->position);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xbookmark->addAttribute('created', date("c", (int)$bookmark->creation_date));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xepisode->addAttribute('channelId', $subParent);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method getPubDate from undeclared class \Ampache\Repository\Model\Podcast_Episode
                    Open

                            $xepisode->addAttribute('publishDate', $episode->getPubDate()->format(DATE_ATOM));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xepisode->addAttribute('status', (string)$episode->state);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method has_art from undeclared class \Ampache\Repository\Model\Podcast_Episode
                    Open

                            if ($episode->has_art()) {
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xsimilar->addAttribute('name', (string)self::_checkName($similar['name']));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method get_fullname from undeclared class \Ampache\Repository\Model\Podcast
                    Open

                                $xchannel->addAttribute('title', self::_checkName($podcast->get_fullname()));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xbookmark->addAttribute('comment', (string)$bookmark->comment);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property object_id from undeclared class \Ampache\Repository\Model\Bookmark
                    Open

                                self::addSong($xbookmark, $bookmark->object_id, 'entry');
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property object_id from undeclared class \Ampache\Repository\Model\Bookmark
                    Open

                                self::addPodcastEpisode($xbookmark, new Podcast_Episode($bookmark->object_id), 'entry');
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method getPodcastName from undeclared class \Ampache\Repository\Model\Podcast_Episode
                    Open

                            $xepisode->addAttribute('album', $episode->getPodcastName());
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xepisode->addAttribute('duration', (string)$episode->time);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xepisode->addAttribute('contentType', (string)$episode->mime);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        public static function addScanStatus($xml, $user): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method __construct from undeclared class \Ampache\Repository\Model\Userflag
                    Open

                                    $starred = new Userflag($object_id, $objectType);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method getFeedUrl from undeclared class \Ampache\Repository\Model\Podcast
                    Open

                                $xchannel->addAttribute('url', $podcast->getFeedUrl());
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $bookmarks has undeclared type \Ampache\Module\Api\list<\Ampache\Repository\Model\Bookmark>
                    Open

                        public static function addBookmarks($xml, $bookmarks): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method format from undeclared class \Ampache\Repository\Model\Podcast_Episode
                    Open

                            $episode->format();
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method __construct from undeclared class \Ampache\Repository\Model\Song
                    Open

                                return new Song(Subsonic_Xml_Data::_getAmpacheId($object_id));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        private static function addChildToResultXml(SimpleXMLElement $xml, string $qualifiedName, ?string $value = null): SimpleXMLElement
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property position from undeclared class \Ampache\Repository\Model\Bookmark
                    Open

                            $xbookmark->addAttribute('position', (string)$bookmark->position);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xepisode->addAttribute('suffix', (string)$episode->type);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xscan->addAttribute('scanning', "false");
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $message has undeclared type \Ampache\Repository\Model\PrivateMsg
                    Open

                        private static function addMessage($xml, $message): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property fullname_public from undeclared class \Ampache\Repository\Model\User
                    Open

                            if ($user->fullname_public) {
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Return type of _getAmpacheObject() is undeclared type \Ampache\Repository\Model\Video
                    Open

                        public static function _getAmpacheObject($object_id)
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method getUserName from undeclared class \Ampache\Repository\Model\Bookmark
                    Open

                            $xbookmark->addAttribute('username', $bookmark->getUserName());
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property comment from undeclared class \Ampache\Repository\Model\Bookmark
                    Open

                            $xbookmark->addAttribute('comment', (string)$bookmark->comment);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xepisode->addAttribute('album', $episode->getPodcastName());
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property size from undeclared class \Ampache\Repository\Model\Podcast_Episode
                    Open

                                $xepisode->addAttribute('size', (string)$episode->size);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property username from undeclared class \Ampache\Repository\Model\User
                    Open

                                $xbookmark->addAttribute('username', (string)$user->username);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Return type of _createSuccessResponse() is undeclared type \SimpleXMLElement
                    Open

                        private static function _createSuccessResponse($function = ''): SimpleXMLElement
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xsimilar->addAttribute('id', ($similar['id'] !== null ? (string)self::_getArtistId($similar['id']) : "-1"));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        public static function addNewestPodcasts($xml, $episodes): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xbookmark->addAttribute('username', $bookmark->getUserName());
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method get_description from undeclared class \Ampache\Repository\Model\Podcast_Episode
                    Open

                            $xepisode->addAttribute('description', self::_checkName($episode->get_description()));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property id from undeclared class \Ampache\Repository\Model\Podcast_Episode
                    Open

                            self::_setIfStarred($xepisode, 'podcast_episode', $episode->id);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property file from undeclared class \Ampache\Repository\Model\Podcast_Episode
                    Open

                                $path = basename($episode->file);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method __construct from undeclared class \Ampache\Repository\Model\PrivateMsg
                    Open

                                $chat = new PrivateMsg($message);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property id from undeclared class \Ampache\Repository\Model\User
                    Open

                            $counts = Catalog::get_server_counts($user->id ?? 0);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Return type of _createResponse() is undeclared type \SimpleXMLElement
                    Open

                        private static function _createResponse($version, $status = 'ok'): SimpleXMLElement
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method __construct from undeclared class \SimpleXMLElement
                    Open

                            $response = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><subsonic-response/>');
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $response->addAttribute('xmlns', 'http://subsonic.org/restapi');
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        private static function _setIfStarred($xml, $objectType, $object_id): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method getId from undeclared class \Ampache\Repository\Model\Podcast
                    Open

                                $sub_id   = (string)self::_getPodcastId($podcast->getId());
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xepisode->addAttribute('publishDate', $episode->getPubDate()->format(DATE_ATOM));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xepisode->addAttribute('size', (string)$episode->size);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xepisode->addAttribute('path', (string)$path);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xbookmark->addAttribute('message', (string)$message->getMessage());
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to deprecated function \debug_event() defined at /code/src/Config/functions.php:651
                    Open

                            debug_event(self::class, 'API fail in function ' . $function . '-' . $version, 3);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Return type of _getAmpacheObject() is undeclared type \Ampache\Repository\Model\Song
                    Open

                        public static function _getAmpacheObject($object_id)
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xchannel->addAttribute('id', $sub_id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xchannel->addAttribute('title', self::_checkName($podcast->get_fullname()));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                    $xchannel->addAttribute('coverArt', 'pod-' . $sub_id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $episodes has undeclared type \Ampache\Repository\Model\Podcast_Episode[]
                    Open

                        public static function addNewestPodcasts($xml, $episodes): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xbookmark->addAttribute('changed', date("c", (int)$bookmark->update_date));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property object_type from undeclared class \Ampache\Repository\Model\Bookmark
                    Open

                            if ($bookmark->object_type == "song") {
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property podcast from undeclared class \Ampache\Repository\Model\Podcast_Episode
                    Open

                            $subParent = (string)self::_getPodcastId($episode->podcast);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $xepisode->addAttribute('id', $sub_id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property time from undeclared class \Ampache\Repository\Model\Podcast_Episode
                    Open

                            $xepisode->addAttribute('duration', (string)$episode->time);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                                $xepisode->addAttribute('streamId', $sub_id);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        public static function addChatMessages($xml, $messages): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method addAttribute from undeclared class \SimpleXMLElement
                    Open

                            $response->addAttribute('type', 'ampache');
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $podcasts has undeclared type \Ampache\Repository\Model\Podcast[]
                    Open

                        public static function addPodcasts($xml, $podcasts, $includeEpisodes = true): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Parameter $xml has undeclared type \SimpleXMLElement
                    Open

                        private static function addPodcastEpisode($xml, $episode, $elementName = 'episode'): void
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property type from undeclared class \Ampache\Repository\Model\Podcast_Episode
                    Open

                                $xepisode->addAttribute('suffix', (string)$episode->type);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to instance property fullname from undeclared class \Ampache\Repository\Model\User
                    Open

                                $xbookmark->addAttribute('username', (string)$user->fullname);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method getCreationDate from undeclared class \Ampache\Repository\Model\PrivateMsg
                    Open

                            $xbookmark->addAttribute('time', (string)($message->getCreationDate() * 1000));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Reference to static property version from undeclared class \Ampache\Module\Api\Api
                    Open

                            $response->addAttribute('serverVersion', Api::$version);
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Call to method __construct from undeclared class \Ampache\Repository\Model\Podcast_Episode
                    Open

                                return new Podcast_Episode(Subsonic_Xml_Data::_getAmpacheId($object_id));
                    Severity: Critical
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phan

                    Similar blocks of code found in 4 locations. Consider refactoring.
                    Open

                        public static function addStarred($xml, $artists, $albums, $songs): void
                        {
                            $xstarred = self::addChildToResultXml($xml, htmlspecialchars('starred'));
                    
                            foreach ($artists as $artist_id) {
                    Severity: Major
                    Found in src/Module/Api/Subsonic_Xml_Data.php and 3 other locations - About 2 hrs to fix
                    src/Module/Api/Subsonic_Xml_Data.php on lines 922..936
                    src/Module/Api/Subsonic_Xml_Data.php on lines 945..959
                    src/Module/Api/Subsonic_Xml_Data.php on lines 994..1011

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 131.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 4 locations. Consider refactoring.
                    Open

                        public static function addSearchResult2($xml, $artists, $albums, $songs): void
                        {
                            $xresult = self::addChildToResultXml($xml, htmlspecialchars('searchResult2'));
                            foreach ($artists as $artist_id) {
                                $artist = new Artist((int) $artist_id);
                    Severity: Major
                    Found in src/Module/Api/Subsonic_Xml_Data.php and 3 other locations - About 2 hrs to fix
                    src/Module/Api/Subsonic_Xml_Data.php on lines 945..959
                    src/Module/Api/Subsonic_Xml_Data.php on lines 968..985
                    src/Module/Api/Subsonic_Xml_Data.php on lines 994..1011

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 131.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 4 locations. Consider refactoring.
                    Open

                        public static function addStarred2($xml, $artists, $albums, $songs): void
                        {
                            $xstarred = self::addChildToResultXml($xml, htmlspecialchars('starred2'));
                    
                            foreach ($artists as $artist_id) {
                    Severity: Major
                    Found in src/Module/Api/Subsonic_Xml_Data.php and 3 other locations - About 2 hrs to fix
                    src/Module/Api/Subsonic_Xml_Data.php on lines 922..936
                    src/Module/Api/Subsonic_Xml_Data.php on lines 945..959
                    src/Module/Api/Subsonic_Xml_Data.php on lines 968..985

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 131.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 4 locations. Consider refactoring.
                    Open

                        public static function addSearchResult3($xml, $artists, $albums, $songs): void
                        {
                            $xresult = self::addChildToResultXml($xml, htmlspecialchars('searchResult3'));
                            foreach ($artists as $artist_id) {
                                $artist = new Artist((int) $artist_id);
                    Severity: Major
                    Found in src/Module/Api/Subsonic_Xml_Data.php and 3 other locations - About 2 hrs to fix
                    src/Module/Api/Subsonic_Xml_Data.php on lines 922..936
                    src/Module/Api/Subsonic_Xml_Data.php on lines 968..985
                    src/Module/Api/Subsonic_Xml_Data.php on lines 994..1011

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 131.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    The parameter $video_id is not named in camelCase.
                    Open

                        public static function addVideoInfo($xml, $video_id): void
                        {
                            $xvideoinfo = self::addChildToResultXml($xml, 'videoinfo');
                            $xvideoinfo->addAttribute('id', (string)$video_id);
                        }
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    CamelCaseParameterName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name parameters.

                    Example

                    class ClassName {
                        public function doSomething($user_name) {
                        }
                    }

                    Source

                    The parameter $user_id is not named in camelCase.
                    Open

                        public static function addPlaylists($xml, $user_id, $playlists, $smartplaylists = array(), $hide_dupe_searches = false): void
                        {
                            $playlist_names = array();
                            $xplaylists     = self::addChildToResultXml($xml, 'playlists');
                            foreach ($playlists as $plist_id) {
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    CamelCaseParameterName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name parameters.

                    Example

                    class ClassName {
                        public function doSomething($user_name) {
                        }
                    }

                    Source

                    The parameter $similar_songs is not named in camelCase.
                    Open

                        public static function addSimilarSongs($xml, $similar_songs, $child): void
                        {
                            $xsimilar = self::addChildToResultXml($xml, htmlspecialchars($child));
                            foreach ($similar_songs as $similar_song) {
                                if ($similar_song['id'] !== null) {
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    CamelCaseParameterName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name parameters.

                    Example

                    class ClassName {
                        public function doSomething($user_name) {
                        }
                    }

                    Source

                    The parameter $artist_id is not named in camelCase.
                    Open

                        private static function _getArtistId($artist_id): int
                        {
                            return ((int)$artist_id) + self::AMPACHEID_ARTIST;
                        }
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    CamelCaseParameterName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name parameters.

                    Example

                    class ClassName {
                        public function doSomething($user_name) {
                        }
                    }

                    Source

                    The parameter $artist_id is not named in camelCase.
                    Open

                        public static function _isArtist($artist_id): bool
                        {
                            $artist_id = self::_cleanId($artist_id);
                    
                            return ($artist_id >= self::AMPACHEID_ARTIST && $artist_id < self::AMPACHEID_ALBUM);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    CamelCaseParameterName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name parameters.

                    Example

                    class ClassName {
                        public function doSomething($user_name) {
                        }
                    }

                    Source

                    The parameter $plist_id is not named in camelCase.
                    Open

                        private static function _getSmartPlaylistId($plist_id): int
                        {
                            return $plist_id + self::AMPACHEID_SMARTPL;
                        }
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    CamelCaseParameterName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name parameters.

                    Example

                    class ClassName {
                        public function doSomething($user_name) {
                        }
                    }

                    Source

                    The parameter $video_id is not named in camelCase.
                    Open

                        public static function _isVideo($video_id): bool
                        {
                            $video_id = self::_cleanId($video_id);
                    
                            return ($video_id >= self::AMPACHEID_VIDEO && $video_id < self::AMPACHEID_PODCAST);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    CamelCaseParameterName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name parameters.

                    Example

                    class ClassName {
                        public function doSomething($user_name) {
                        }
                    }

                    Source

                    The parameter $song_id is not named in camelCase.
                    Open

                        public static function addSong($xml, $song_id, $elementName = 'song'): SimpleXMLElement
                        {
                            $song = new Song($song_id);
                            if ($song->isNew()) {
                                return $xml;
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    CamelCaseParameterName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name parameters.

                    Example

                    class ClassName {
                        public function doSomething($user_name) {
                        }
                    }

                    Source

                    The parameter $hide_dupe_searches is not named in camelCase.
                    Open

                        public static function addPlaylists($xml, $user_id, $playlists, $smartplaylists = array(), $hide_dupe_searches = false): void
                        {
                            $playlist_names = array();
                            $xplaylists     = self::addChildToResultXml($xml, 'playlists');
                            foreach ($playlists as $plist_id) {
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    CamelCaseParameterName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name parameters.

                    Example

                    class ClassName {
                        public function doSomething($user_name) {
                        }
                    }

                    Source

                    The parameter $similar_songs is not named in camelCase.
                    Open

                        public static function addSimilarSongs2($xml, $similar_songs, $child): void
                        {
                            $xsimilar = self::addChildToResultXml($xml, htmlspecialchars($child));
                            foreach ($similar_songs as $similar_song) {
                                if ($similar_song['id'] !== null) {
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    CamelCaseParameterName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name parameters.

                    Example

                    class ClassName {
                        public function doSomething($user_name) {
                        }
                    }

                    Source

                    The parameter $video_id is not named in camelCase.
                    Open

                        private static function _getVideoId($video_id): int
                        {
                            return $video_id + Subsonic_Xml_Data::AMPACHEID_VIDEO;
                        }
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    CamelCaseParameterName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name parameters.

                    Example

                    class ClassName {
                        public function doSomething($user_name) {
                        }
                    }

                    Source

                    The parameter $episode_id is not named in camelCase.
                    Open

                        private static function _getPodcastEpisodeId($episode_id): int
                        {
                            return $episode_id + self::AMPACHEID_PODCASTEP;
                        }
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    CamelCaseParameterName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name parameters.

                    Example

                    class ClassName {
                        public function doSomething($user_name) {
                        }
                    }

                    Source

                    The parameter $object_id is not named in camelCase.
                    Open

                        public static function _getAmpacheType($object_id): string
                        {
                            if (self::_isArtist($object_id)) {
                                return "artist";
                            } elseif (self::_isAlbum($object_id)) {
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    CamelCaseParameterName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name parameters.

                    Example

                    class ClassName {
                        public function doSomething($user_name) {
                        }
                    }

                    Source

                    The class Subsonic_Xml_Data is not named in CamelCase.
                    Open

                    class Subsonic_Xml_Data
                    {
                        public const API_VERSION = "1.16.1";
                    
                        public const SSERROR_GENERIC               = 0;
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    CamelCaseClassName

                    Since: 0.2

                    It is considered best practice to use the CamelCase notation to name classes.

                    Example

                    class class_name {
                    }

                    Source

                    The parameter $sub_id is not named in camelCase.
                    Open

                        private static function addDirectory_Artist($xml, $sub_id): void
                        {
                            $artist_id = self::_getAmpacheId($sub_id);
                            $data      = Artist::get_id_array($artist_id);
                            $xdir      = self::addChildToResultXml($xml, 'directory');
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    CamelCaseParameterName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name parameters.

                    Example

                    class ClassName {
                        public function doSomething($user_name) {
                        }
                    }

                    Source

                    The parameter $catalog_id is not named in camelCase.
                    Open

                        private static function addDirectory_Catalog($xml, $catalog_id): void
                        {
                            $catalog = Catalog::create_from_id((int)$catalog_id);
                            if ($catalog === null) {
                                return;
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    CamelCaseParameterName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name parameters.

                    Example

                    class ClassName {
                        public function doSomething($user_name) {
                        }
                    }

                    Source

                    The parameter $sub_id is not named in camelCase.
                    Open

                        public static function addDirectory($xml, $sub_id, $dirType): void
                        {
                            switch ($dirType) {
                                case 'artist':
                                    self::addDirectory_Artist($xml, $sub_id);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    CamelCaseParameterName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name parameters.

                    Example

                    class ClassName {
                        public function doSomething($user_name) {
                        }
                    }

                    Source

                    The parameter $song_id is not named in camelCase.
                    Open

                        private static function _getSongId($song_id): int
                        {
                            return ((int)$song_id) + self::AMPACHEID_SONG;
                        }
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    CamelCaseParameterName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name parameters.

                    Example

                    class ClassName {
                        public function doSomething($user_name) {
                        }
                    }

                    Source

                    The parameter $object_id is not named in camelCase.
                    Open

                        public static function _getAmpacheObject($object_id)
                        {
                            if (Subsonic_Xml_Data::_isSong($object_id)) {
                                return new Song(Subsonic_Xml_Data::_getAmpacheId($object_id));
                            }
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    CamelCaseParameterName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name parameters.

                    Example

                    class ClassName {
                        public function doSomething($user_name) {
                        }
                    }

                    Source

                    The parameter $object_id is not named in camelCase.
                    Open

                        public static function _getAmpacheId($object_id): int
                        {
                            return (self::_cleanId($object_id) % self::AMPACHEID_ARTIST);
                        }
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    CamelCaseParameterName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name parameters.

                    Example

                    class ClassName {
                        public function doSomething($user_name) {
                        }
                    }

                    Source

                    The parameter $episode_id is not named in camelCase.
                    Open

                        public static function _isPodcastEpisode($episode_id): bool
                        {
                            $episode_id = self::_cleanId($episode_id);
                    
                            return ($episode_id >= self::AMPACHEID_PODCASTEP && $episode_id < self::AMPACHEID_PLAYLIST);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    CamelCaseParameterName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name parameters.

                    Example

                    class ClassName {
                        public function doSomething($user_name) {
                        }
                    }

                    Source

                    The parameter $podcast_id is not named in camelCase.
                    Open

                        public static function _isPodcast($podcast_id): bool
                        {
                            $podcast_id = self::_cleanId($podcast_id);
                    
                            return ($podcast_id >= self::AMPACHEID_PODCAST && $podcast_id < self::AMPACHEID_PODCASTEP);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    CamelCaseParameterName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name parameters.

                    Example

                    class ClassName {
                        public function doSomething($user_name) {
                        }
                    }

                    Source

                    The parameter $plist_id is not named in camelCase.
                    Open

                        public static function _isSmartPlaylist($plist_id): bool
                        {
                            $plist_id = self::_cleanId($plist_id);
                    
                            return ($plist_id >= self::AMPACHEID_SMARTPL && $plist_id < self::AMPACHEID_VIDEO);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    CamelCaseParameterName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name parameters.

                    Example

                    class ClassName {
                        public function doSomething($user_name) {
                        }
                    }

                    Source

                    The parameter $plist_id is not named in camelCase.
                    Open

                        public static function _isPlaylist($plist_id): bool
                        {
                            $plist_id = self::_cleanId($plist_id);
                    
                            return ($plist_id >= self::AMPACHEID_PLAYLIST);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    CamelCaseParameterName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name parameters.

                    Example

                    class ClassName {
                        public function doSomething($user_name) {
                        }
                    }

                    Source

                    The parameter $object_id is not named in camelCase.
                    Open

                        private static function _setIfStarred($xml, $objectType, $object_id): void
                        {
                            if (InterfaceImplementationChecker::is_library_item($objectType)) {
                                if (AmpConfig::get('ratings')) {
                                    $starred = new Userflag($object_id, $objectType);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    CamelCaseParameterName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name parameters.

                    Example

                    class ClassName {
                        public function doSomething($user_name) {
                        }
                    }

                    Source

                    The parameter $album_id is not named in camelCase.
                    Open

                        public static function _isAlbum($album_id): bool
                        {
                            $album_id = self::_cleanId($album_id);
                    
                            return ($album_id >= self::AMPACHEID_ALBUM && $album_id < self::AMPACHEID_SONG);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    CamelCaseParameterName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name parameters.

                    Example

                    class ClassName {
                        public function doSomething($user_name) {
                        }
                    }

                    Source

                    The parameter $album_id is not named in camelCase.
                    Open

                        private static function addDirectory_Album($xml, $album_id): void
                        {
                            $album = new Album(self::_getAmpacheId($album_id));
                            $album->format();
                            /** @var SimpleXMLElement $xdir */
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    CamelCaseParameterName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name parameters.

                    Example

                    class ClassName {
                        public function doSomething($user_name) {
                        }
                    }

                    Source

                    The parameter $song_id is not named in camelCase.
                    Open

                        public static function addLyrics($xml, $artist, $title, $song_id): void
                        {
                            $song = new Song($song_id);
                            $song->fill_ext_info('lyrics');
                            $lyrics = $song->get_lyrics();
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    CamelCaseParameterName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name parameters.

                    Example

                    class ClassName {
                        public function doSomething($user_name) {
                        }
                    }

                    Source

                    The parameter $plist_id is not named in camelCase.
                    Open

                        private static function _getPlaylistId($plist_id): int
                        {
                            return $plist_id + self::AMPACHEID_PLAYLIST;
                        }
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    CamelCaseParameterName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name parameters.

                    Example

                    class ClassName {
                        public function doSomething($user_name) {
                        }
                    }

                    Source

                    The parameter $object_id is not named in camelCase.
                    Open

                        private static function _cleanId($object_id): int
                        {
                            // Remove all al-, ar-, ... prefixes
                            $tpos = strpos((string)$object_id, "-");
                            if ($tpos !== false) {
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    CamelCaseParameterName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name parameters.

                    Example

                    class ClassName {
                        public function doSomething($user_name) {
                        }
                    }

                    Source

                    The parameter $object_ids is not named in camelCase.
                    Open

                        public static function _getAmpacheIdArrays($object_ids): array
                        {
                            $ampidarrays = array();
                            $track       = 1;
                            foreach ($object_ids as $object_id) {
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    CamelCaseParameterName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name parameters.

                    Example

                    class ClassName {
                        public function doSomething($user_name) {
                        }
                    }

                    Source

                    The parameter $album_id is not named in camelCase.
                    Open

                        private static function _getAlbumId($album_id): int
                        {
                            return ((int)$album_id) + self::AMPACHEID_ALBUM;
                        }
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    CamelCaseParameterName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name parameters.

                    Example

                    class ClassName {
                        public function doSomething($user_name) {
                        }
                    }

                    Source

                    The parameter $podcast_id is not named in camelCase.
                    Open

                        private static function _getPodcastId($podcast_id): int
                        {
                            return $podcast_id + self::AMPACHEID_PODCAST;
                        }
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    CamelCaseParameterName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name parameters.

                    Example

                    class ClassName {
                        public function doSomething($user_name) {
                        }
                    }

                    Source

                    The parameter $song_id is not named in camelCase.
                    Open

                        public static function _isSong($song_id): bool
                        {
                            $song_id = self::_cleanId($song_id);
                    
                            return ($song_id >= self::AMPACHEID_SONG && $song_id < self::AMPACHEID_SMARTPL);
                    Severity: Minor
                    Found in src/Module/Api/Subsonic_Xml_Data.php by phpmd

                    CamelCaseParameterName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name parameters.

                    Example

                    class ClassName {
                        public function doSomething($user_name) {
                        }
                    }

                    Source

                    Method name "_isVideo" should not be prefixed with an underscore to indicate visibility
                    Open

                        public static function _isVideo($video_id): bool

                    Method name "_getArtistId" should not be prefixed with an underscore to indicate visibility
                    Open

                        private static function _getArtistId($artist_id): int

                    Method name "_isSong" should not be prefixed with an underscore to indicate visibility
                    Open

                        public static function _isSong($song_id): bool

                    Method name "_getAlbumId" should not be prefixed with an underscore to indicate visibility
                    Open

                        private static function _getAlbumId($album_id): int

                    Method name "_getVideoId" should not be prefixed with an underscore to indicate visibility
                    Open

                        private static function _getVideoId($video_id): int

                    Method name "_createFailedResponse" should not be prefixed with an underscore to indicate visibility
                    Open

                        private static function _createFailedResponse($function = ''): SimpleXMLElement

                    Method name "_isPodcast" should not be prefixed with an underscore to indicate visibility
                    Open

                        public static function _isPodcast($podcast_id): bool

                    Method name "_checkName" should not be prefixed with an underscore to indicate visibility
                    Open

                        private static function _checkName($name): string

                    Method name "_getAmpacheObject" should not be prefixed with an underscore to indicate visibility
                    Open

                        public static function _getAmpacheObject($object_id)

                    Method name "_isPlaylist" should not be prefixed with an underscore to indicate visibility
                    Open

                        public static function _isPlaylist($plist_id): bool

                    Method name "_getSmartPlaylistId" should not be prefixed with an underscore to indicate visibility
                    Open

                        private static function _getSmartPlaylistId($plist_id): int

                    Method name "_createSuccessResponse" should not be prefixed with an underscore to indicate visibility
                    Open

                        private static function _createSuccessResponse($function = ''): SimpleXMLElement

                    Method name "_getPodcastEpisodeId" should not be prefixed with an underscore to indicate visibility
                    Open

                        private static function _getPodcastEpisodeId($episode_id): int

                    Method name "_cleanId" should not be prefixed with an underscore to indicate visibility
                    Open

                        private static function _cleanId($object_id): int

                    Method name "_createResponse" should not be prefixed with an underscore to indicate visibility
                    Open

                        private static function _createResponse($version, $status = 'ok'): SimpleXMLElement

                    Method name "_getPodcastId" should not be prefixed with an underscore to indicate visibility
                    Open

                        private static function _getPodcastId($podcast_id): int

                    Method name "_getAmpacheType" should not be prefixed with an underscore to indicate visibility
                    Open

                        public static function _getAmpacheType($object_id): string

                    Method name "_isPodcastEpisode" should not be prefixed with an underscore to indicate visibility
                    Open

                        public static function _isPodcastEpisode($episode_id): bool

                    Method name "_setIfStarred" should not be prefixed with an underscore to indicate visibility
                    Open

                        private static function _setIfStarred($xml, $objectType, $object_id): void

                    Method name "_isAlbum" should not be prefixed with an underscore to indicate visibility
                    Open

                        public static function _isAlbum($album_id): bool

                    Method name "_getSongId" should not be prefixed with an underscore to indicate visibility
                    Open

                        private static function _getSongId($song_id): int

                    Method name "_getPlaylistId" should not be prefixed with an underscore to indicate visibility
                    Open

                        private static function _getPlaylistId($plist_id): int

                    Method name "_getAmpacheId" should not be prefixed with an underscore to indicate visibility
                    Open

                        public static function _getAmpacheId($object_id): int

                    Method name "_isSmartPlaylist" should not be prefixed with an underscore to indicate visibility
                    Open

                        public static function _isSmartPlaylist($plist_id): bool

                    Method name "_getAmpacheIdArrays" should not be prefixed with an underscore to indicate visibility
                    Open

                        public static function _getAmpacheIdArrays($object_ids): array

                    Method name "_isArtist" should not be prefixed with an underscore to indicate visibility
                    Open

                        public static function _isArtist($artist_id): bool

                    Class name "Subsonic_Xml_Data" is not in camel caps format
                    Open

                    class Subsonic_Xml_Data

                    Expected 0 spaces after opening bracket; newline found
                    Open

                                if (

                    There are no issues that match your filters.

                    Category
                    Status