ampache/ampache

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

Summary

Maintainability
F
2 wks
Test Coverage

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/Xml5_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

File Xml5_Data.php has 736 lines of code (exceeds 500 allowed). Consider refactoring.
Open

<?php

declare(strict_types=0);

/**
Severity: Major
Found in src/Module/Api/Xml5_Data.php - About 7 hrs to fix

    Xml5_Data has 41 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Xml5_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/Xml5_Data.php - About 5 hrs to fix

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

      class Xml5_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/Xml5_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 Xml5_Data has an overall complexity of 218 which is very high. The configured complexity threshold is 50.
      Open

      class Xml5_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/Xml5_Data.php by phpmd

      The class Xml5_Data has 29 public methods. Consider refactoring Xml5_Data to keep number of public methods under 10.
      Open

      class Xml5_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/Xml5_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 17 (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/Xml5_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 playlists has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function playlists($playlists, $user): 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/Xml5_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 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/Xml5_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 albums has a Cognitive Complexity of 9 (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/Xml5_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 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/Xml5_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/Xml5_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 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/Xml5_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/Xml5_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/Xml5_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 live_streams has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function live_streams($live_streams, $user): 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/Xml5_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/Xml5_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/Xml5_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/Xml5_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): 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/Xml5_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/Xml5_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 an NPath complexity of 990. 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/Xml5_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 indexes() has 107 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/Xml5_Data.php by phpmd

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

        class Xml5_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/Xml5_Data.php by phpmd

        The method albums() has an NPath complexity of 730. 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/Xml5_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 4330. 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/Xml5_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 albums() has a Cyclomatic Complexity of 14. 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/Xml5_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 32. 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/Xml5_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 11. 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/Xml5_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 10. The configured cyclomatic complexity threshold is 10.
        Open

            public static function playlists($playlists, $user): 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/Xml5_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 17. 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/Xml5_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 Xml5_Data has a coupling between objects value of 29. Consider to reduce the number of dependencies under 13.
        Open

        class Xml5_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/Xml5_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 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/Xml5_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/Xml5_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";
                                if ($album->get_artist_fullname() != "") {
                                    $string .= "\t\t<artist id=\"" . $album->album_artist . "\"><![CDATA[" . $album->f_artist_name . "]]></artist>\n";
        Severity: Minor
        Found in src/Module/Api/Xml5_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/Xml5_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/Xml5_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/Xml5_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/Xml5_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

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

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

        UnusedLocalVariable

        Since: 0.2

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

        Example

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

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

        FIXME found
        Open

                    // FIXME: This is duplicate code and so wrong, functions need to be improved
        Severity: Minor
        Found in src/Module/Api/Xml5_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/Xml5_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/Xml5_Data.php and 1 other location - About 2 days to fix
        src/Module/Api/Xml_Data.php on lines 1616..1641

        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/Xml5_Data.php and 1 other location - About 1 day to fix
        src/Module/Api/Xml_Data.php on lines 1117..1130

        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/Xml5_Data.php and 1 other location - About 1 day to fix
        src/Module/Api/Xml_Data.php on lines 915..929

        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/Xml5_Data.php and 1 other location - About 1 day to fix
        src/Module/Api/Xml_Data.php on lines 860..880

        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/Xml5_Data.php and 1 other location - About 1 day to fix
        src/Module/Api/Xml_Data.php on lines 1180..1197

        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";
                                if ($include) {
        Severity: Major
        Found in src/Module/Api/Xml5_Data.php and 2 other locations - About 1 day to fix
        src/Module/Api/Xml4_Data.php on lines 344..356
        src/Module/Api/Xml_Data.php on lines 616..629

        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/Xml5_Data.php and 1 other location - About 7 hrs to fix
        src/Module/Api/Xml_Data.php on lines 316..342

        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/Xml5_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 937..955
        src/Module/Api/Xml_Data.php on lines 1651..1669

        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

                    $string .= "<podcast id=\"$podcast_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\t<art><![CDATA[" . $art_url . "]]></art>\n\t<flag>" . (!$flag->get_flag($user->getId()) ? 0 : 1) . "</flag>\n\t<preciserating>" . $user_rating . "</preciserating>\n\t<rating>" . $user_rating . "</rating>\n\t<averagerating>" . (string) $rating->get_average_rating() . "</averagerating>\n";
        Severity: Major
        Found in src/Module/Api/Xml5_Data.php and 1 other location - About 6 hrs to fix
        src/Module/Api/Xml4_Data.php on lines 652..652

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

        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/Xml5_Data.php and 1 other location - About 5 hrs to fix
        src/Module/Api/Xml_Data.php on lines 833..850

        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

                        case 'artist':
                            if ($include) {
                                $string .= self::artists(array($object_id), array('songs', 'albums'), $user, false);
                            } else {
                                $artist = new Artist($object_id);
        Severity: Major
        Found in src/Module/Api/Xml5_Data.php and 1 other location - About 5 hrs to fix
        src/Module/Api/Xml4_Data.php on lines 271..289

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

        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/Xml5_Data.php and 1 other location - About 4 hrs to fix
        src/Module/Api/Xml_Data.php on lines 1566..1580

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

                    if ((int)$playlist_id === 0) {
                        $playlist = new Search((int) str_replace('smart_', '', (string) $playlist_id), 'song', $user);
                        if ($playlist->isNew()) {
                            continue;
                        }
        Severity: Major
        Found in src/Module/Api/Xml5_Data.php and 4 other locations - About 4 hrs to fix
        src/Module/Api/Json4_Data.php on lines 463..479
        src/Module/Api/Json5_Data.php on lines 556..572
        src/Module/Api/Json_Data.php on lines 882..898
        src/Module/Api/Xml4_Data.php on lines 545..561

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

        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

                    $string .= "<video id=\"" . $video->id . "\">\n\t<title><![CDATA[" . $video->title . "]]></title>\n\t<name><![CDATA[" . $video->title . "]]></name>\n\t<mime><![CDATA[" . $video->mime . "]]></mime>\n\t<resolution><![CDATA[" . $video->f_resolution . "]]></resolution>\n\t<size>" . $video->size . "</size>\n" . self::genre_string($video->tags) . "\t<time><![CDATA[" . $video->time . "]]></time>\n\t<url><![CDATA[" . $video->play_url('', 'api', false, $user->getId(), $user->streamtoken) . "]]></url>\n\t<art><![CDATA[" . $art_url . "]]></art>\n\t<flag>" . (!$flag->get_flag($user->getId()) ? 0 : 1) . "</flag>\n\t<preciserating>" . $user_rating . "</preciserating>\n\t<rating>" . $user_rating . "</rating>\n\t<averagerating>" . (string) $rating->get_average_rating() . "</averagerating>\n\t<playcount>" . $video->total_count . "</playcount>\n</video>\n";
        Severity: Major
        Found in src/Module/Api/Xml5_Data.php and 1 other location - About 4 hrs to fix
        src/Module/Api/Xml4_Data.php on lines 795..795

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

        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/Xml5_Data.php and 1 other location - About 4 hrs to fix
        src/Module/Api/Xml_Data.php on lines 357..372

        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

                    $string .= "\t<podcast_episode id=\"$episode_id\">\n\t\t<title><![CDATA[" . $episode->get_fullname() . "]]></title>\n\t\t<name><![CDATA[" . $episode->get_fullname() . "]]></name>\n\t\t<description><![CDATA[" . $episode->get_description() . "]]></description>\n\t\t<category><![CDATA[" . $episode->getCategory() . "]]></category>\n\t\t<author><![CDATA[" . $episode->getAuthor() . "]]></author>\n\t\t<author_full><![CDATA[" . $episode->getAuthor() . "]]></author_full>\n\t\t<website><![CDATA[" . $episode->getWebsite() . "]]></website>\n\t\t<pubdate><![CDATA[" . $episode->getPubDate()->format(DATE_ATOM) . "]]></pubdate>\n\t\t<state><![CDATA[" . $episode->getStateDescription() . "]]></state>\n\t\t<filelength><![CDATA[" . $episode->f_time_h . "]]></filelength>\n\t\t<filesize><![CDATA[" . $episode->getSizeFormatted() . "]]></filesize>\n\t\t<filename><![CDATA[" . $episode->getFileName() . "]]></filename>\n\t\t<mime><![CDATA[" . $episode->mime . "]]></mime>\n\t\t<time>" . (int)$episode->time . "</time>\n\t\t<size>" . (int)$episode->size . "</size>\n\t\t<public_url><![CDATA[" . $episode->get_link() . "]]></public_url>\n\t\t<url><![CDATA[" . $episode->play_url('', 'api', false, $user->getId(), $user->streamtoken) . "]]></url>\n\t\t<catalog>" . $episode->catalog . "</catalog>\n\t\t<art><![CDATA[" . $art_url . "]]></art>\n\t\t<flag>" . (!$flag->get_flag($user->getId()) ? 0 : 1) . "</flag>\n\t\t<preciserating>" . $user_rating . "</preciserating>\n\t\t<rating>" . $user_rating . "</rating>\n\t\t<averagerating>" . (string) $rating->get_average_rating() . "</averagerating>\n\t\t<playcount>" . $episode->total_count . "</playcount>\n\t\t<played>" . $episode->played . "</played>\n\t</podcast_episode>\n";
        Severity: Major
        Found in src/Module/Api/Xml5_Data.php and 1 other location - About 3 hrs to fix
        src/Module/Api/Xml4_Data.php on lines 691..691

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

        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/Xml5_Data.php and 1 other location - About 3 hrs to fix
        src/Module/Api/Xml_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

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

        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

        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(
        Severity: Major
        Found in src/Module/Api/Xml5_Data.php and 2 other locations - About 1 hr to fix
        src/Module/Api/Xml4_Data.php on lines 750..757
        src/Module/Api/Xml_Data.php on lines 1346..1353

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

                    $string .= "<playlist id=\"" . $playlist_id . "\">\n\t<name><![CDATA[" . $playlist_name . "]]></name>\n\t<owner><![CDATA[" . $playlist_user . "]]></owner>\n\t<items>" . (int)$playitem_total . "</items>\n\t<type>" . $playlist_type . "</type>\n\t<art><![CDATA[" . $art_url . "]]></art>\n\t<flag>" . (!$flag->get_flag($user->getId()) ? 0 : 1) . "</flag>\n\t<preciserating>" . $user_rating . "</preciserating>\n\t<rating>" . $user_rating . "</rating>\n\t<averagerating>" . (string) $rating->get_average_rating() . "</averagerating>\n</playlist>\n";
        Severity: Minor
        Found in src/Module/Api/Xml5_Data.php and 1 other location - About 40 mins to fix
        src/Module/Api/Xml4_Data.php on lines 571..571

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

        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 class Xml5_Data is not named in CamelCase.
        Open

        class Xml5_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/Xml5_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 $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/Xml5_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\"><![CDATA[" . $string . "]]></success>";
                foreach ($return_data as $title => $data) {
                    $xml_string .= "\n\t<$title><![CDATA[" . $data . "]]></$title>";
        Severity: Minor
        Found in src/Module/Api/Xml5_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/Xml5_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/Xml5_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): 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/Xml5_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/Xml5_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/Xml5_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/Xml5_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/Xml5_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/Xml5_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/Xml5_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/Xml5_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 "_footer" should not be prefixed with an underscore to indicate visibility
        Open

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

        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/Xml5_Data.php by phpcodesniffer

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

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

        There are no issues that match your filters.

        Category
        Status