ampache/ampache

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

Summary

Maintainability
F
3 wks
Test Coverage

user accesses the super-global variable $_REQUEST.
Open

    public static function user(User $user, bool $fullinfo): string
    {
        $user->format();
        $art_url = Art::url($user->id, 'user', $_REQUEST['auth'] ?? '');
        $string  = "<user id=\"" . (string)$user->id . "\">\n\t<username><![CDATA[" . $user->username . "]]></username>\n";
Severity: Minor
Found in src/Module/Api/Xml_Data.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

File Xml_Data.php has 1158 lines of code (exceeds 500 allowed). Consider refactoring.
Open

<?php

declare(strict_types=0);

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

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

        public static function index($objects, $object_type, $user, $include = false): string
        {
            if ((count($objects) > self::$limit || self::$offset > 0) && self::$limit) {
                $objects = array_splice($objects, self::$offset, self::$limit);
            }
    Severity: Minor
    Found in src/Module/Api/Xml_Data.php - About 1 day to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function searches has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function searches($searches, $user): string
        {
            $string = "<search>\n";
    
            // here is where we call the object type
    Severity: Minor
    Found in src/Module/Api/Xml_Data.php - About 1 day to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function indexes has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function indexes($objects, $object_type, $user, $full_xml = true, $include = false): string
        {
            if ((count($objects) > self::$limit || self::$offset > 0) && (self::$limit && $full_xml)) {
                $objects = array_splice($objects, self::$offset, self::$limit);
            }
    Severity: Minor
    Found in src/Module/Api/Xml_Data.php - About 1 day to fix

    Cognitive Complexity

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

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

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

    Further reading

    Xml_Data has 48 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Xml_Data
    {
        // This is added so that we don't pop any webservers
        private static ?int $limit  = 5000;
        private static int $offset  = 0;
    Severity: Minor
    Found in src/Module/Api/Xml_Data.php - About 6 hrs to fix

      Function playlists has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function playlists($playlists, $user, $songs = false, $show_dupes = true): string
          {
              if ((count($playlists) > self::$limit || self::$offset > 0) && self::$limit) {
                  $playlists = array_slice($playlists, self::$offset, self::$limit);
              }
      Severity: Minor
      Found in src/Module/Api/Xml_Data.php - About 4 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 output_xml_from_array has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function output_xml_from_array($array, $callback = false, $type = ''): string
          {
              $string = '';
      
              // If we weren't passed an array then return
      Severity: Minor
      Found in src/Module/Api/Xml_Data.php - About 4 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

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

      class Xml_Data
      {
          // This is added so that we don't pop any webservers
          private static ?int $limit  = 5000;
          private static int $offset  = 0;
      Severity: Minor
      Found in src/Module/Api/Xml_Data.php by phpmd

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

      class Xml_Data
      {
          // This is added so that we don't pop any webservers
          private static ?int $limit  = 5000;
          private static int $offset  = 0;
      Severity: Minor
      Found in src/Module/Api/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 Xml_Data has 36 public methods. Consider refactoring Xml_Data to keep number of public methods under 10.
      Open

      class Xml_Data
      {
          // This is added so that we don't pop any webservers
          private static ?int $limit  = 5000;
          private static int $offset  = 0;
      Severity: Minor
      Found in src/Module/Api/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

      Function songs has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function songs($songs, $user, $full_xml = true): string
          {
              if ((count($songs) > self::$limit || self::$offset > 0) && (self::$limit && $full_xml)) {
                  $songs = array_slice($songs, self::$offset, self::$limit);
              }
      Severity: Minor
      Found in src/Module/Api/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 albums has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function albums($albums, $include, $user, $full_xml = true): string
          {
              if ((count($albums) > self::$limit || self::$offset > 0) && (self::$limit && $full_xml)) {
                  $albums = array_splice($albums, self::$offset, self::$limit);
              }
      Severity: Minor
      Found in src/Module/Api/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 podcasts has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function podcasts($podcasts, $user, $episodes = false): string
          {
              if ((count($podcasts) > self::$limit || self::$offset > 0) && self::$limit) {
                  $podcasts = array_splice($podcasts, self::$offset, self::$limit);
              }
      Severity: Minor
      Found in src/Module/Api/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 bookmarks has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function bookmarks(array $bookmarks, bool $include = false): string
          {
              $bookmarkRepository = self::getBookmarkRepository();
      
              $string = "";
      Severity: Minor
      Found in src/Module/Api/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 genre_string has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          private static function genre_string($tags): string
          {
              $string = '';
      
              if (!empty($tags)) {
      Severity: Minor
      Found in src/Module/Api/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 keyed_array has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function keyed_array($array, $callback = false, $object = false): string
          {
              $string = '';
              // Foreach it
              foreach ($array as $key => $value) {
      Severity: Minor
      Found in src/Module/Api/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 browses has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public static function browses($objects, $parent_id, $parent_type, $child_type, $catalog_id): string
      Severity: Minor
      Found in src/Module/Api/Xml_Data.php - About 35 mins to fix

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

            public static function indexes($objects, $object_type, $user, $full_xml = true, $include = false): string
        Severity: Minor
        Found in src/Module/Api/Xml_Data.php - About 35 mins to fix

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

              public static function catalogs($catalogs, $user): string
              {
                  if ((count($catalogs) > self::$limit || self::$offset > 0) && self::$limit) {
                      $catalogs = array_splice($catalogs, self::$offset, self::$limit);
                  }
          Severity: Minor
          Found in src/Module/Api/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

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

              public static function deleted($object_type, $objects): string
              {
                  if ((count($objects) > self::$limit || self::$offset > 0) && self::$limit) {
                      $objects = array_splice($objects, self::$offset, self::$limit);
                  }
          Severity: Minor
          Found in src/Module/Api/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

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

              public static function podcast_episodes($podcast_episodes, $user, $full_xml = true): string
              {
                  if ((count($podcast_episodes) > self::$limit || self::$offset > 0) && (self::$limit && $full_xml)) {
                      $podcast_episodes = array_splice($podcast_episodes, self::$offset, self::$limit);
                  }
          Severity: Minor
          Found in src/Module/Api/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

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

              public static function labels($labels, $user): string
              {
                  if ((count($labels) > self::$limit || self::$offset > 0) && self::$limit) {
                      $labels = array_splice($labels, self::$offset, self::$limit);
                  }
          Severity: Minor
          Found in src/Module/Api/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

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

              public static function artists($artists, $include, $user, $full_xml = true): string
              {
                  if ((count($artists) > self::$limit || self::$offset > 0) && (self::$limit && $full_xml)) {
                      $artists = array_splice($artists, self::$offset, self::$limit);
                  }
          Severity: Minor
          Found in src/Module/Api/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

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

              public static function videos($videos, $user, $full_xml = true): string
              {
                  if ((count($videos) > self::$limit || self::$offset > 0) && self::$limit) {
                      $videos = array_slice($videos, self::$offset, self::$limit);
                  }
          Severity: Minor
          Found in src/Module/Api/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

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

              public static function licenses($licenses, $user): string
              {
                  if ((count($licenses) > self::$limit || self::$offset > 0) && self::$limit) {
                      $licenses = array_splice($licenses, self::$offset, self::$limit);
                  }
          Severity: Minor
          Found in src/Module/Api/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 indexes() has 116 lines of code. Current threshold is set to 100. Avoid really long methods.
          Open

              public static function indexes($objects, $object_type, $user, $full_xml = true, $include = false): string
              {
                  if ((count($objects) > self::$limit || self::$offset > 0) && (self::$limit && $full_xml)) {
                      $objects = array_splice($objects, self::$offset, self::$limit);
                  }
          Severity: Minor
          Found in src/Module/Api/Xml_Data.php by phpmd

          The method artists() has an NPath complexity of 330. The configured NPath complexity threshold is 200.
          Open

              public static function artists($artists, $include, $user, $full_xml = true): string
              {
                  if ((count($artists) > self::$limit || self::$offset > 0) && (self::$limit && $full_xml)) {
                      $artists = array_splice($artists, self::$offset, self::$limit);
                  }
          Severity: Minor
          Found in src/Module/Api/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 Xml_Data has 1696 lines of code. Current threshold is 1000. Avoid really long classes.
          Open

          class Xml_Data
          {
              // This is added so that we don't pop any webservers
              private static ?int $limit  = 5000;
              private static int $offset  = 0;
          Severity: Minor
          Found in src/Module/Api/Xml_Data.php by phpmd

          The method albums() has an NPath complexity of 17290. The configured NPath complexity threshold is 200.
          Open

              public static function albums($albums, $include, $user, $full_xml = true): string
              {
                  if ((count($albums) > self::$limit || self::$offset > 0) && (self::$limit && $full_xml)) {
                      $albums = array_splice($albums, self::$offset, self::$limit);
                  }
          Severity: Minor
          Found in src/Module/Api/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 songs() has an NPath complexity of 51850. The configured NPath complexity threshold is 200.
          Open

              public static function songs($songs, $user, $full_xml = true): string
              {
                  if ((count($songs) > self::$limit || self::$offset > 0) && (self::$limit && $full_xml)) {
                      $songs = array_slice($songs, self::$offset, self::$limit);
                  }
          Severity: Minor
          Found in src/Module/Api/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 searches() has 107 lines of code. Current threshold is set to 100. Avoid really long methods.
          Open

              public static function searches($searches, $user): string
              {
                  $string = "<search>\n";
          
                  // here is where we call the object type
          Severity: Minor
          Found in src/Module/Api/Xml_Data.php by phpmd

          The method playlists() has an NPath complexity of 1672. The configured NPath complexity threshold is 200.
          Open

              public static function playlists($playlists, $user, $songs = false, $show_dupes = true): string
              {
                  if ((count($playlists) > self::$limit || self::$offset > 0) && self::$limit) {
                      $playlists = array_slice($playlists, self::$offset, self::$limit);
                  }
          Severity: Minor
          Found in src/Module/Api/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 index() has 124 lines of code. Current threshold is set to 100. Avoid really long methods.
          Open

              public static function index($objects, $object_type, $user, $include = false): string
              {
                  if ((count($objects) > self::$limit || self::$offset > 0) && self::$limit) {
                      $objects = array_splice($objects, self::$offset, self::$limit);
                  }
          Severity: Minor
          Found in src/Module/Api/Xml_Data.php by phpmd

          The method indexes() has an NPath complexity of 1020. The configured NPath complexity threshold is 200.
          Open

              public static function indexes($objects, $object_type, $user, $full_xml = true, $include = false): string
              {
                  if ((count($objects) > self::$limit || self::$offset > 0) && (self::$limit && $full_xml)) {
                      $objects = array_splice($objects, self::$offset, self::$limit);
                  }
          Severity: Minor
          Found in src/Module/Api/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 index() has a Cyclomatic Complexity of 37. The configured cyclomatic complexity threshold is 10.
          Open

              public static function index($objects, $object_type, $user, $include = false): string
              {
                  if ((count($objects) > self::$limit || self::$offset > 0) && self::$limit) {
                      $objects = array_splice($objects, self::$offset, self::$limit);
                  }
          Severity: Minor
          Found in src/Module/Api/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 indexes() has a Cyclomatic Complexity of 33. The configured cyclomatic complexity threshold is 10.
          Open

              public static function indexes($objects, $object_type, $user, $full_xml = true, $include = false): string
              {
                  if ((count($objects) > self::$limit || self::$offset > 0) && (self::$limit && $full_xml)) {
                      $objects = array_splice($objects, self::$offset, self::$limit);
                  }
          Severity: Minor
          Found in src/Module/Api/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 songs() has a Cyclomatic Complexity of 21. The configured cyclomatic complexity threshold is 10.
          Open

              public static function songs($songs, $user, $full_xml = true): string
              {
                  if ((count($songs) > self::$limit || self::$offset > 0) && (self::$limit && $full_xml)) {
                      $songs = array_slice($songs, self::$offset, self::$limit);
                  }
          Severity: Minor
          Found in src/Module/Api/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 albums() has a Cyclomatic Complexity of 19. The configured cyclomatic complexity threshold is 10.
          Open

              public static function albums($albums, $include, $user, $full_xml = true): string
              {
                  if ((count($albums) > self::$limit || self::$offset > 0) && (self::$limit && $full_xml)) {
                      $albums = array_splice($albums, self::$offset, self::$limit);
                  }
          Severity: Minor
          Found in src/Module/Api/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 playlists() has a Cyclomatic Complexity of 21. The configured cyclomatic complexity threshold is 10.
          Open

              public static function playlists($playlists, $user, $songs = false, $show_dupes = true): string
              {
                  if ((count($playlists) > self::$limit || self::$offset > 0) && self::$limit) {
                      $playlists = array_slice($playlists, self::$offset, self::$limit);
                  }
          Severity: Minor
          Found in src/Module/Api/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 podcasts() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
          Open

              public static function podcasts($podcasts, $user, $episodes = false): string
              {
                  if ((count($podcasts) > self::$limit || self::$offset > 0) && self::$limit) {
                      $podcasts = array_splice($podcasts, self::$offset, self::$limit);
                  }
          Severity: Minor
          Found in src/Module/Api/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 podcast_episodes() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
          Open

              public static function podcast_episodes($podcast_episodes, $user, $full_xml = true): string
              {
                  if ((count($podcast_episodes) > self::$limit || self::$offset > 0) && (self::$limit && $full_xml)) {
                      $podcast_episodes = array_splice($podcast_episodes, self::$offset, self::$limit);
                  }
          Severity: Minor
          Found in src/Module/Api/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 output_xml_from_array() has a Cyclomatic Complexity of 19. The configured cyclomatic complexity threshold is 10.
          Open

              public static function output_xml_from_array($array, $callback = false, $type = ''): string
              {
                  $string = '';
          
                  // If we weren't passed an array then return
          Severity: Minor
          Found in src/Module/Api/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 searches() has a Cyclomatic Complexity of 40. The configured cyclomatic complexity threshold is 10.
          Open

              public static function searches($searches, $user): string
              {
                  $string = "<search>\n";
          
                  // here is where we call the object type
          Severity: Minor
          Found in src/Module/Api/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 artists() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10.
          Open

              public static function artists($artists, $include, $user, $full_xml = true): string
              {
                  if ((count($artists) > self::$limit || self::$offset > 0) && (self::$limit && $full_xml)) {
                      $artists = array_splice($artists, self::$offset, self::$limit);
                  }
          Severity: Minor
          Found in src/Module/Api/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 class Xml_Data has a coupling between objects value of 31. Consider to reduce the number of dependencies under 13.
          Open

          class Xml_Data
          {
              // This is added so that we don't pop any webservers
              private static ?int $limit  = 5000;
              private static int $offset  = 0;
          Severity: Minor
          Found in src/Module/Api/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 searches uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
          Open

                                  } else {
                                      $playlist       = new Playlist($object_id);
                                      $playitem_total = $playlist->get_media_count('song');
                                  }
          Severity: Minor
          Found in src/Module/Api/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 playlists uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
          Open

                      } else {
                          $playlist = new Playlist($playlist_id);
                          if ($playlist->isNew()) {
                              continue;
                          }
          Severity: Minor
          Found in src/Module/Api/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 index uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
          Open

                              } else {
                                  $string .= "<playlist id=\"" . $object_id . "\"/>\n";
                              }
          Severity: Minor
          Found in src/Module/Api/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 index uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
          Open

                              } else {
                                  $string .= "<podcast id=\"" . $object_id . "\"/>\n";
                              }
          Severity: Minor
          Found in src/Module/Api/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 indexes uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
          Open

                              } else {
                                  $artist = new Artist($object_id);
                                  if ($artist->isNew()) {
                                      break;
                                  }
          Severity: Minor
          Found in src/Module/Api/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 output_xml_from_array uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
          Open

                              } else {
                                  if ($key == "key") {
                                      $string .= "\t\t<$key>$value</$key>\n";
                                  } elseif (is_numeric($value)) {
                                      $string .= "\t\t\t<$key>$value</$key>\n";
          Severity: Minor
          Found in src/Module/Api/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 indexes uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
          Open

                              } else {
                                  $playlist       = new Playlist($object_id);
                                  $playitem_total = $playlist->get_media_count('song');
                              }
          Severity: Minor
          Found in src/Module/Api/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 output_xml_from_array uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
          Open

                              } else {
                                  if ($key == "key") {
                                      $string .= "\t\t<$key>$value</$key>\n";
                                  } elseif (is_int($value)) {
                                      $string .= "\t\t\t<key>$key</key><integer>$value</integer>\n";
          Severity: Minor
          Found in src/Module/Api/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 index uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
          Open

                              } else {
                                  $string .= "<artist id=\"" . $object_id . "\"/>\n";
                              }
          Severity: Minor
          Found in src/Module/Api/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 genre_string uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
          Open

                          } else {
                              $atags[$tag['id']] = array(
                                  'name' => $tag['name'],
                                  'count' => 1
                              );
          Severity: Minor
          Found in src/Module/Api/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 indexes uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
          Open

                              } else {
                                  $album = new Album($object_id);
                                  $string .= "<$object_type id=\"" . $object_id . "\">\n\t<name><![CDATA[" . $album->get_fullname() . "]]></name>\n\t<prefix><![CDATA[" . $album->prefix . "]]></prefix>\n\t<basename><![CDATA[" . $album->name . "]]></basename>\n";
                                  if ($album->get_artist_fullname() != "") {
                                      $album_artist = array(
          Severity: Minor
          Found in src/Module/Api/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 playlists uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
          Open

                      } else {
                          $items = $playitem_total;
                      }
          Severity: Minor
          Found in src/Module/Api/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 songs uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
          Open

                      } else {
                          $licenseLink = '';
                      }
          Severity: Minor
          Found in src/Module/Api/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 keyed_array uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
          Open

                      } else {
                          $string .= ($object) ? "\t<$object index=\"" . $key . "\"><![CDATA[" . $value . "]]></$object>\n" : "\t<$key$attribute><![CDATA[" . $value . "]]></$key>\n";
                      }
          Severity: Minor
          Found in src/Module/Api/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 index uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
          Open

                              } else {
                                  $string .= "<artist id=\"" . $object_id . "\"/>\n";
                              }
          Severity: Minor
          Found in src/Module/Api/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 output_xml_from_array uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
          Open

                              } else {
                                  /* We need to escape the value */
                                  $string .= "\t<content div=\"$key\"><![CDATA[" . $value . "]]></content>\n";
                              }
          Severity: Minor
          Found in src/Module/Api/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 index uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
          Open

                              } else {
                                  $string .= "<album id=\"" . $object_id . "\"/>\n";
                              }
          Severity: Minor
          Found in src/Module/Api/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 index uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
          Open

                              } else {
                                  $string .= "<artist id=\"" . $object_id . "\"/>\n";
                              }
          Severity: Minor
          Found in src/Module/Api/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 index uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
          Open

                                  } else {
                                      $sql        = "SELECT `playlist_data`.`id`, `playlist_data`.`object_id`, `playlist_data`.`object_type` FROM `playlist_data` WHERE `playlist_data`.`playlist` = ? ORDER BY `playlist_data`.`track`;";
                                      $db_results = Dba::read($sql, array($object_id));
                                      while ($row = Dba::fetch_assoc($db_results)) {
                                          $string .= "<" . $row['object_type'] . " id=\"" . $row['object_id'] . "\"></" . $row['object_type'] . ">\n";
          Severity: Minor
          Found in src/Module/Api/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

          FIXME found
          Open

                      // FIXME: This is duplicate code and so wrong, functions need to be improved
          Severity: Minor
          Found in src/Module/Api/Xml_Data.php by fixme

          syntax error, unexpected '?', expecting function (T_FUNCTION) or const (T_CONST)
          Open

              private static ?int $limit  = 5000;
          Severity: Critical
          Found in src/Module/Api/Xml_Data.php by phan

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

              public static function deleted($object_type, $objects): string
              {
                  if ((count($objects) > self::$limit || self::$offset > 0) && self::$limit) {
                      $objects = array_splice($objects, self::$offset, self::$limit);
                  }
          Severity: Major
          Found in src/Module/Api/Xml_Data.php and 1 other location - About 2 days to fix
          src/Module/Api/Xml5_Data.php on lines 1112..1137

          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 473.

          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

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

              public static function shares($shares, $user): string
              {
                  if ((count($shares) > self::$limit || self::$offset > 0) && self::$limit) {
                      $shares = array_splice($shares, self::$offset, self::$limit);
                  }
          Severity: Major
          Found in src/Module/Api/Xml_Data.php and 1 other location - About 1 day to fix
          src/Module/Api/Xml5_Data.php on lines 702..715

          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 285.

          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

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

              public static function genres($tags, $user): string
              {
                  if ((count($tags) > self::$limit || self::$offset > 0) && self::$limit) {
                      $tags = array_splice($tags, self::$offset, self::$limit);
                  }
          Severity: Major
          Found in src/Module/Api/Xml_Data.php and 1 other location - About 1 day to fix
          src/Module/Api/Xml5_Data.php on lines 505..519

          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 271.

          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

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

              public static function labels($labels, $user): string
              {
                  if ((count($labels) > self::$limit || self::$offset > 0) && self::$limit) {
                      $labels = array_splice($labels, self::$offset, self::$limit);
                  }
          Severity: Major
          Found in src/Module/Api/Xml_Data.php and 1 other location - About 1 day to fix
          src/Module/Api/Xml5_Data.php on lines 447..467

          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 264.

          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

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

              public static function catalogs($catalogs, $user): string
              {
                  if ((count($catalogs) > self::$limit || self::$offset > 0) && self::$limit) {
                      $catalogs = array_splice($catalogs, self::$offset, self::$limit);
                  }
          Severity: Major
          Found in src/Module/Api/Xml_Data.php and 1 other location - About 1 day to fix
          src/Module/Api/Xml5_Data.php on lines 747..764

          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 262.

          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

          Identical blocks of code found in 3 locations. Consider refactoring.
          Open

                          case 'podcast':
                              $podcast = self::getPodcastRepository()->findById($object_id);
          
                              if ($podcast !== null) {
                                  $string .= "<podcast id=\"$object_id\">\n\t<name><![CDATA[" . $podcast->get_fullname() . "]]></name>\n\t<description><![CDATA[" . $podcast->get_description() . "]]></description>\n\t<language><![CDATA[" . scrub_out($podcast->getLanguage()) . "]]></language>\n\t<copyright><![CDATA[" . scrub_out($podcast->getCopyright()) . "]]></copyright>\n\t<feed_url><![CDATA[" . $podcast->getFeedUrl() . "]]></feed_url>\n\t<generator><![CDATA[" . scrub_out($podcast->getGenerator()) . "]]></generator>\n\t<website><![CDATA[" . scrub_out($podcast->getWebsite()) . "]]></website>\n\t<build_date><![CDATA[" . $podcast->getLastBuildDate()->format(DATE_ATOM) . "]]></build_date>\n\t<sync_date><![CDATA[" . $podcast->getLastSyncDate()->format(DATE_ATOM) . "]]></sync_date>\n\t<public_url><![CDATA[" . $podcast->get_link() . "]]></public_url>\n";
          Severity: Major
          Found in src/Module/Api/Xml_Data.php and 2 other locations - About 1 day to fix
          src/Module/Api/Xml4_Data.php on lines 345..357
          src/Module/Api/Xml5_Data.php on lines 385..397

          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 256.

          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

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

              public static function keyed_array($array, $callback = false, $object = false): string
              {
                  $string = '';
                  // Foreach it
                  foreach ($array as $key => $value) {
          Severity: Major
          Found in src/Module/Api/Xml_Data.php and 1 other location - About 7 hrs to fix
          src/Module/Api/Xml5_Data.php on lines 234..260

          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 239.

          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

          Identical blocks of code found in 4 locations. Consider refactoring.
          Open

              private static function _header($title = null): string
              {
                  switch (self::$type) {
                      case 'xspf':
                          $header = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<playlist version = \"1\" xmlns=\"http://xspf.org/ns/0/\">\n<title>" . ($title ?? T_("Ampache XSPF Playlist")) . "</title>\n<creator>" . scrub_out(AmpConfig::get('site_title')) . "</creator>\n<annotation>" . scrub_out(AmpConfig::get('site_title')) . "</annotation>\n<info>" . AmpConfig::get('web_path') . "</info>\n<trackList>\n";
          Severity: Major
          Found in src/Module/Api/Xml_Data.php and 3 other locations - About 7 hrs to fix
          src/Module/Api/Xml3_Data.php on lines 669..687
          src/Module/Api/Xml4_Data.php on lines 949..967
          src/Module/Api/Xml5_Data.php on lines 1147..1165

          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 229.

          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

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

              public static function licenses($licenses, $user): string
              {
                  if ((count($licenses) > self::$limit || self::$offset > 0) && self::$limit) {
                      $licenses = array_splice($licenses, self::$offset, self::$limit);
                  }
          Severity: Major
          Found in src/Module/Api/Xml_Data.php and 1 other location - About 5 hrs to fix
          src/Module/Api/Xml5_Data.php on lines 420..437

          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 198.

          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

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

                              foreach ($objects as $object_id) {
                                  $album = new Album($object_id);
                                  $string .= "<$object_type id=\"" . $object_id . "\">\n\t<name><![CDATA[" . $album->get_fullname() . "]]></name>\n\t<prefix><![CDATA[" . $album->prefix . "]]></prefix>\n\t<basename><![CDATA[" . $album->name . "]]></basename>\n";
                                  if ($album->get_artist_fullname() != "") {
                                      $album_artist = array(
          Severity: Major
          Found in src/Module/Api/Xml_Data.php and 1 other location - About 4 hrs to fix
          src/Module/Api/Xml_Data.php on lines 559..572

          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 179.

          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

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

                              } else {
                                  $album = new Album($object_id);
                                  $string .= "<$object_type id=\"" . $object_id . "\">\n\t<name><![CDATA[" . $album->get_fullname() . "]]></name>\n\t<prefix><![CDATA[" . $album->prefix . "]]></prefix>\n\t<basename><![CDATA[" . $album->name . "]]></basename>\n";
                                  if ($album->get_artist_fullname() != "") {
                                      $album_artist = array(
          Severity: Major
          Found in src/Module/Api/Xml_Data.php and 1 other location - About 4 hrs to fix
          src/Module/Api/Xml_Data.php on lines 672..685

          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 179.

          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

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

              public static function timeline($activities): string
              {
                  $string = "";
                  foreach ($activities as $activity_id) {
                      $activity = new Useractivity($activity_id);
          Severity: Major
          Found in src/Module/Api/Xml_Data.php and 1 other location - About 4 hrs to fix
          src/Module/Api/Xml5_Data.php on lines 1062..1076

          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 176.

          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

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

              public static function object_array($array, $item, $object_type = ''): string
              {
                  $string = ($object_type == '') ? '' : "<$object_type>\n";
                  // Foreach it
                  foreach ($array as $object) {
          Severity: Major
          Found in src/Module/Api/Xml_Data.php and 1 other location - About 4 hrs to fix
          src/Module/Api/Xml5_Data.php on lines 275..290

          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 171.

          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 2 locations. Consider refactoring.
          Open

              private static function genre_string($tags): string
              {
                  $string = '';
          
                  if (!empty($tags)) {
          Severity: Major
          Found in src/Module/Api/Xml_Data.php and 1 other location - About 3 hrs to fix
          src/Module/Api/Xml5_Data.php on lines 200..223

          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 145.

          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

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

                                  $string .= "<$object_type id=\"" . $object_id . "\">\n\t<title><![CDATA[" . $song->get_fullname() . "]]></title>\n\t<name><![CDATA[" . $song->get_fullname() . "]]></name>\n" .
                                      "\t<artist id=\"" . $song->artist . "\"><name><![CDATA[" . $song_artist['name'] . "]]></name><prefix><![CDATA[" . $song_artist['prefix'] . "]]></prefix><basename><![CDATA[" . $song_artist['basename'] . "]]></basename></artist>\n" .
                                      "\t<album id=\"" . $song->album . "\"><name><![CDATA[" . $song_album['name'] . "]]></name>\n\t<prefix><![CDATA[" . $song_album['prefix'] . "]]></prefix>\n\t<basename><![CDATA[" . $song_album['basename'] . "]]></basename>\n</album>\n";
          Severity: Major
          Found in src/Module/Api/Xml_Data.php and 1 other location - About 2 hrs to fix
          src/Module/Api/Xml_Data.php on lines 578..580

          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 141.

          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

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

                              $string .= "<$object_type id=\"" . $object_id . "\">\n\t<title><![CDATA[" . $song->get_fullname() . "]]></title>\n\t<name><![CDATA[" . $song->get_fullname() . "]]></name>\n" .
                                  "\t<artist id=\"" . $song->artist . "\"><name><![CDATA[" . $song_artist['name'] . "]]></name><prefix><![CDATA[" . $song_artist['prefix'] . "]]></prefix><basename><![CDATA[" . $song_artist['basename'] . "]]></basename></artist>\n" .
                                  "\t<album id=\"" . $song->album . "\"><name><![CDATA[" . $song_album['name'] . "]]></name>\n\t<prefix><![CDATA[" . $song_album['prefix'] . "]]></prefix>\n\t<basename><![CDATA[" . $song_album['basename'] . "]]></basename>\n</album>\n";
          Severity: Major
          Found in src/Module/Api/Xml_Data.php and 1 other location - About 2 hrs to fix
          src/Module/Api/Xml_Data.php on lines 695..697

          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 141.

          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

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

              public static function shouts(array $shouts): string
              {
                  $string = "";
          
                  foreach ($shouts as $shout) {
          Severity: Major
          Found in src/Module/Api/Xml_Data.php and 1 other location - About 2 hrs to fix
          src/Module/Api/Xml5_Data.php on lines 1039..1053

          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 135.

          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 5 locations. Consider refactoring.
          Open

                      case 'artist':
                          foreach ($objects as $object_id) {
                              if ($include) {
                                  $string .= "<artist id=\"" . $object_id . "\">\n";
                                  $sql        = "SELECT DISTINCT `album_map`.`album_id` FROM `album_map` WHERE `album_map`.`object_id` = ?;";
          Severity: Major
          Found in src/Module/Api/Xml_Data.php and 4 other locations - About 1 hr to fix
          src/Module/Api/Xml_Data.php on lines 394..408
          src/Module/Api/Xml_Data.php on lines 409..423
          src/Module/Api/Xml_Data.php on lines 439..453
          src/Module/Api/Xml_Data.php on lines 481..495

          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 118.

          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 5 locations. Consider refactoring.
          Open

                      case 'podcast':
                          foreach ($objects as $object_id) {
                              if ($include) {
                                  $string .= "<podcast id=\"" . $object_id . "\">\n";
                                  $sql        = "SELECT DISTINCT `podcast_episode`.`id` FROM `podcast_episode` WHERE `podcast_episode`.`podcast` = ?;";
          Severity: Major
          Found in src/Module/Api/Xml_Data.php and 4 other locations - About 1 hr to fix
          src/Module/Api/Xml_Data.php on lines 394..408
          src/Module/Api/Xml_Data.php on lines 409..423
          src/Module/Api/Xml_Data.php on lines 424..438
          src/Module/Api/Xml_Data.php on lines 439..453

          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 118.

          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 5 locations. Consider refactoring.
          Open

                      case 'album':
                          foreach ($objects as $object_id) {
                              if ($include) {
                                  $string .= "<album id=\"" . $object_id . "\">\n";
                                  $sql        = "SELECT DISTINCT `song`.`id` FROM `song` WHERE `song`.`album` = ?;";
          Severity: Major
          Found in src/Module/Api/Xml_Data.php and 4 other locations - About 1 hr to fix
          src/Module/Api/Xml_Data.php on lines 394..408
          src/Module/Api/Xml_Data.php on lines 409..423
          src/Module/Api/Xml_Data.php on lines 424..438
          src/Module/Api/Xml_Data.php on lines 481..495

          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 118.

          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 5 locations. Consider refactoring.
          Open

                      case 'album_artist':
                          foreach ($objects as $object_id) {
                              if ($include) {
                                  $string .= "<artist id=\"" . $object_id . "\">\n";
                                  $sql        = "SELECT DISTINCT `album_map`.`album_id` FROM `album_map` WHERE `album_map`.`object_id` = ? AND `album_map`.`object_type` = 'album';";
          Severity: Major
          Found in src/Module/Api/Xml_Data.php and 4 other locations - About 1 hr to fix
          src/Module/Api/Xml_Data.php on lines 409..423
          src/Module/Api/Xml_Data.php on lines 424..438
          src/Module/Api/Xml_Data.php on lines 439..453
          src/Module/Api/Xml_Data.php on lines 481..495

          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 118.

          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 5 locations. Consider refactoring.
          Open

                      case 'song_artist':
                          foreach ($objects as $object_id) {
                              if ($include) {
                                  $string .= "<artist id=\"" . $object_id . "\">\n";
                                  $sql        = "SELECT DISTINCT `album_map`.`album_id` FROM `album_map` WHERE `album_map`.`object_id` = ? AND `album_map`.`object_type` = 'song';";
          Severity: Major
          Found in src/Module/Api/Xml_Data.php and 4 other locations - About 1 hr to fix
          src/Module/Api/Xml_Data.php on lines 394..408
          src/Module/Api/Xml_Data.php on lines 424..438
          src/Module/Api/Xml_Data.php on lines 439..453
          src/Module/Api/Xml_Data.php on lines 481..495

          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 118.

          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 2 locations. Consider refactoring.
          Open

                  foreach ($objects as $object) {
                      $trimmed  = Catalog::trim_prefix(trim((string)$object['name']), $pattern);
                      $prefix   = $trimmed['prefix'];
                      $basename = $trimmed['string'];
                      $string .= "<list id=\"" . $object['id'] . "\">\n" .
          Severity: Major
          Found in src/Module/Api/Xml_Data.php and 1 other location - About 1 hr to fix
          src/Module/Api/Xml_Data.php on lines 808..816

          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 117.

          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 2 locations. Consider refactoring.
          Open

                  foreach ($objects as $object) {
                      $trimmed  = Catalog::trim_prefix(trim((string)$object['name']), $pattern);
                      $prefix   = $trimmed['prefix'];
                      $basename = $trimmed['string'];
                      $string .= "<browse id=\"" . $object['id'] . "\">\n" .
          Severity: Major
          Found in src/Module/Api/Xml_Data.php and 1 other location - About 1 hr to fix
          src/Module/Api/Xml_Data.php on lines 772..780

          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 117.

          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

          Identical blocks of code found in 3 locations. Consider refactoring.
          Open

                      foreach ($song->getMetadata() as $metadata) {
                          $field = $metadata->getField();
          
                          if ($field !== null) {
                              $meta_name = str_replace(array(' ', '(', ')', '/', '\\', '#'), '_', $field->getName());
          Severity: Major
          Found in src/Module/Api/Xml_Data.php and 2 other locations - About 1 hr to fix
          src/Module/Api/Xml4_Data.php on lines 762..769
          src/Module/Api/Xml5_Data.php on lines 901..912

          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 107.

          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

          Identical blocks of code found in 3 locations. Consider refactoring.
          Open

                                  if ($song->get_album_artist_fullname() != "") {
                                      $album_artist = ($song->artist !== $song->albumartist)
                                          ? Artist::get_name_array_by_id($song->albumartist)
                                          : $song_artist;
                                      $string .= "\t<albumartist id=\"" . $song->albumartist . "\"><name><![CDATA[" . $album_artist['name'] . "]]></name>\n\t<prefix><![CDATA[" . $album_artist['prefix'] . "]]></prefix>\n\t<basename><![CDATA[" . $album_artist['basename'] . "]]></basename>\n</albumartist>\n";
          Severity: Major
          Found in src/Module/Api/Xml_Data.php and 2 other locations - About 45 mins to fix
          src/Module/Api/Xml_Data.php on lines 581..586
          src/Module/Api/Xml_Data.php on lines 1345..1350

          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 95.

          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

          Identical blocks of code found in 3 locations. Consider refactoring.
          Open

                      if ($song->get_album_artist_fullname() != "") {
                          $album_artist = ($song->artist !== $song->albumartist)
                              ? Artist::get_name_array_by_id($song->albumartist)
                              : $song_artist;
                          $string .= "\t<albumartist id=\"" . $song->albumartist . "\"><name><![CDATA[" . $album_artist['name'] . "]]></name>\n\t<prefix><![CDATA[" . $album_artist['prefix'] . "]]></prefix>\n\t<basename><![CDATA[" . $album_artist['basename'] . "]]></basename>\n</albumartist>\n";
          Severity: Major
          Found in src/Module/Api/Xml_Data.php and 2 other locations - About 45 mins to fix
          src/Module/Api/Xml_Data.php on lines 581..586
          src/Module/Api/Xml_Data.php on lines 698..703

          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 95.

          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

          Identical blocks of code found in 3 locations. Consider refactoring.
          Open

                              if ($song->get_album_artist_fullname() != "") {
                                  $album_artist = ($song->artist !== $song->albumartist)
                                      ? Artist::get_name_array_by_id($song->albumartist)
                                      : $song_artist;
                                  $string .= "\t<albumartist id=\"" . $song->albumartist . "\"><name><![CDATA[" . $album_artist['name'] . "]]></name>\n\t<prefix><![CDATA[" . $album_artist['prefix'] . "]]></prefix>\n\t<basename><![CDATA[" . $album_artist['basename'] . "]]></basename>\n</albumartist>\n";
          Severity: Major
          Found in src/Module/Api/Xml_Data.php and 2 other locations - About 45 mins to fix
          src/Module/Api/Xml_Data.php on lines 698..703
          src/Module/Api/Xml_Data.php on lines 1345..1350

          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 95.

          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 $parent_id is not named in camelCase.
          Open

              public static function browses($objects, $parent_id, $parent_type, $child_type, $catalog_id): string
              {
                  $string = "<total_count>" . count($objects) . "</total_count>\n";
                  if ((count($objects) > self::$limit || self::$offset > 0) && self::$limit) {
                      $objects = array_slice($objects, self::$offset, self::$limit);
          Severity: Minor
          Found in src/Module/Api/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

              public static function browses($objects, $parent_id, $parent_type, $child_type, $catalog_id): string
              {
                  $string = "<total_count>" . count($objects) . "</total_count>\n";
                  if ((count($objects) > self::$limit || self::$offset > 0) && self::$limit) {
                      $objects = array_slice($objects, self::$offset, self::$limit);
          Severity: Minor
          Found in src/Module/Api/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_episodes is not named in camelCase.
          Open

              public static function podcast_episodes($podcast_episodes, $user, $full_xml = true): string
              {
                  if ((count($podcast_episodes) > self::$limit || self::$offset > 0) && (self::$limit && $full_xml)) {
                      $podcast_episodes = array_splice($podcast_episodes, self::$offset, self::$limit);
                  }
          Severity: Minor
          Found in src/Module/Api/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 $return_data is not named in camelCase.
          Open

              public static function success($string, $return_data = array()): string
              {
                  $xml_string = "\t<success code=\"1\">\n\t<message><![CDATA[" . $string . "]]></message></success>";
                  foreach ($return_data as $title => $data) {
                      $xml_string .= "\n\t<$title><![CDATA[" . $data . "]]></$title>";
          Severity: Minor
          Found in src/Module/Api/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 $child_type is not named in camelCase.
          Open

              public static function browses($objects, $parent_id, $parent_type, $child_type, $catalog_id): string
              {
                  $string = "<total_count>" . count($objects) . "</total_count>\n";
                  if ((count($objects) > self::$limit || self::$offset > 0) && self::$limit) {
                      $objects = array_slice($objects, self::$offset, self::$limit);
          Severity: Minor
          Found in src/Module/Api/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 $full_xml is not named in camelCase.
          Open

              public static function output_xml($string, $full_xml = true): string
              {
                  $xml = "";
                  if ($full_xml) {
                      $xml .= self::_header();
          Severity: Minor
          Found in src/Module/Api/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 $live_streams is not named in camelCase.
          Open

              public static function live_streams($live_streams, $user, $full_xml = true): string
              {
                  if ((count($live_streams) > self::$limit || self::$offset > 0) && self::$limit) {
                      $live_streams = array_splice($live_streams, self::$offset, self::$limit);
                  }
          Severity: Minor
          Found in src/Module/Api/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 $full_xml is not named in camelCase.
          Open

              public static function artists($artists, $include, $user, $full_xml = true): string
              {
                  if ((count($artists) > self::$limit || self::$offset > 0) && (self::$limit && $full_xml)) {
                      $artists = array_splice($artists, self::$offset, self::$limit);
                  }
          Severity: Minor
          Found in src/Module/Api/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_type is not named in camelCase.
          Open

              public static function deleted($object_type, $objects): string
              {
                  if ((count($objects) > self::$limit || self::$offset > 0) && self::$limit) {
                      $objects = array_splice($objects, self::$offset, self::$limit);
                  }
          Severity: Minor
          Found in src/Module/Api/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_type is not named in camelCase.
          Open

              public static function index($objects, $object_type, $user, $include = false): string
              {
                  if ((count($objects) > self::$limit || self::$offset > 0) && self::$limit) {
                      $objects = array_splice($objects, self::$offset, self::$limit);
                  }
          Severity: Minor
          Found in src/Module/Api/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 $full_xml is not named in camelCase.
          Open

              public static function indexes($objects, $object_type, $user, $full_xml = true, $include = false): string
              {
                  if ((count($objects) > self::$limit || self::$offset > 0) && (self::$limit && $full_xml)) {
                      $objects = array_splice($objects, self::$offset, self::$limit);
                  }
          Severity: Minor
          Found in src/Module/Api/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 $full_xml is not named in camelCase.
          Open

              public static function albums($albums, $include, $user, $full_xml = true): string
              {
                  if ((count($albums) > self::$limit || self::$offset > 0) && (self::$limit && $full_xml)) {
                      $albums = array_splice($albums, self::$offset, self::$limit);
                  }
          Severity: Minor
          Found in src/Module/Api/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 $full_xml is not named in camelCase.
          Open

              public static function podcast_episodes($podcast_episodes, $user, $full_xml = true): string
              {
                  if ((count($podcast_episodes) > self::$limit || self::$offset > 0) && (self::$limit && $full_xml)) {
                      $podcast_episodes = array_splice($podcast_episodes, self::$offset, self::$limit);
                  }
          Severity: Minor
          Found in src/Module/Api/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 $full_xml is not named in camelCase.
          Open

              public static function videos($videos, $user, $full_xml = true): string
              {
                  if ((count($videos) > self::$limit || self::$offset > 0) && self::$limit) {
                      $videos = array_slice($videos, self::$offset, self::$limit);
                  }
          Severity: Minor
          Found in src/Module/Api/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 democratic($object_ids, $user): string
              {
                  $democratic = Democratic::get_current_playlist($user);
                  $string     = '';
          
          
          Severity: Minor
          Found in src/Module/Api/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 Xml_Data is not named in CamelCase.
          Open

          class Xml_Data
          {
              // This is added so that we don't pop any webservers
              private static ?int $limit  = 5000;
              private static int $offset  = 0;
          Severity: Minor
          Found in src/Module/Api/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 $show_dupes is not named in camelCase.
          Open

              public static function playlists($playlists, $user, $songs = false, $show_dupes = true): string
              {
                  if ((count($playlists) > self::$limit || self::$offset > 0) && self::$limit) {
                      $playlists = array_slice($playlists, self::$offset, self::$limit);
                  }
          Severity: Minor
          Found in src/Module/Api/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_type is not named in camelCase.
          Open

              public static function object_array($array, $item, $object_type = ''): string
              {
                  $string = ($object_type == '') ? '' : "<$object_type>\n";
                  // Foreach it
                  foreach ($array as $object) {
          Severity: Minor
          Found in src/Module/Api/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 $parent_type is not named in camelCase.
          Open

              public static function browses($objects, $parent_id, $parent_type, $child_type, $catalog_id): string
              {
                  $string = "<total_count>" . count($objects) . "</total_count>\n";
                  if ((count($objects) > self::$limit || self::$offset > 0) && self::$limit) {
                      $objects = array_slice($objects, self::$offset, self::$limit);
          Severity: Minor
          Found in src/Module/Api/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_type is not named in camelCase.
          Open

              public static function indexes($objects, $object_type, $user, $full_xml = true, $include = false): string
              {
                  if ((count($objects) > self::$limit || self::$offset > 0) && (self::$limit && $full_xml)) {
                      $objects = array_splice($objects, self::$offset, self::$limit);
                  }
          Severity: Minor
          Found in src/Module/Api/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 $full_xml is not named in camelCase.
          Open

              public static function songs($songs, $user, $full_xml = true): string
              {
                  if ((count($songs) > self::$limit || self::$offset > 0) && (self::$limit && $full_xml)) {
                      $songs = array_slice($songs, self::$offset, self::$limit);
                  }
          Severity: Minor
          Found in src/Module/Api/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 $full_xml is not named in camelCase.
          Open

              public static function live_streams($live_streams, $user, $full_xml = true): string
              {
                  if ((count($live_streams) > self::$limit || self::$offset > 0) && self::$limit) {
                      $live_streams = array_splice($live_streams, self::$offset, self::$limit);
                  }
          Severity: Minor
          Found in src/Module/Api/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 "_header" should not be prefixed with an underscore to indicate visibility
          Open

              private static function _header($title = null): string
          Severity: Minor
          Found in src/Module/Api/Xml_Data.php by phpcodesniffer

          Method name "_footer" should not be prefixed with an underscore to indicate visibility
          Open

              private static function _footer(): string
          Severity: Minor
          Found in src/Module/Api/Xml_Data.php by phpcodesniffer

          Expected 0 spaces after opening bracket; newline found
          Open

                          if (
          Severity: Minor
          Found in src/Module/Api/Xml_Data.php by phpcodesniffer

          Expected 0 spaces after opening bracket; newline found
          Open

                          if (
          Severity: Minor
          Found in src/Module/Api/Xml_Data.php by phpcodesniffer

          Class name "Xml_Data" is not in camel caps format
          Open

          class Xml_Data
          Severity: Minor
          Found in src/Module/Api/Xml_Data.php by phpcodesniffer

          There are no issues that match your filters.

          Category
          Status