ampache/ampache

View on GitHub
src/Module/Catalog/Catalog_local.php

Summary

Maintainability
F
1 wk
Test Coverage

File Catalog_local.php has 958 lines of code (exceeds 500 allowed). Consider refactoring.
Open

<?php

/**
 * vim:set softtabstop=4 shiftwidth=4 expandtab:
 *
Severity: Major
Found in src/Module/Catalog/Catalog_local.php - About 1 day to fix

    Function _insert_local_song has a Cognitive Complexity of 69 (exceeds 5 allowed). Consider refactoring.
    Open

        private function _insert_local_song(string $file, $options = array())
        {
            $vainfo = self::getUtilityFactory()->createVaInfo(
                $file,
                $this->get_gather_types('music'),
    Severity: Minor
    Found in src/Module/Catalog/Catalog_local.php - About 1 day to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function add_file has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring.
    Open

        public function add_file($full_file, $options, $counter = 0): bool
        {
            // Ensure that we've got our cache
            $this->_create_filecache();
    
    
    Severity: Minor
    Found in src/Module/Catalog/Catalog_local.php - About 1 day to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function add_to_catalog has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
    Open

        public function add_to_catalog($options = null): int
        {
            if (empty($options)) {
                $options = array(
                    'gather_art' => true,
    Severity: Minor
    Found in src/Module/Catalog/Catalog_local.php - About 6 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function cache_catalog_proc has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

        public function cache_catalog_proc(): bool
        {
            $m4a    = AmpConfig::get('cache_m4a');
            $flac   = AmpConfig::get('cache_flac');
            $mpc    = AmpConfig::get('cache_mpc');
    Severity: Minor
    Found in src/Module/Catalog/Catalog_local.php - About 4 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    Catalog_local has 33 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Catalog_local extends Catalog
    {
        private string $version     = '000001';
        private string $type        = 'local';
        private string $description = 'Local Catalog';
    Severity: Minor
    Found in src/Module/Catalog/Catalog_local.php - About 4 hrs to fix

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

      class Catalog_local extends Catalog
      {
          private string $version     = '000001';
          private string $type        = 'local';
          private string $description = 'Local Catalog';
      Severity: Minor
      Found in src/Module/Catalog/Catalog_local.php by phpmd

      The class Catalog_local has 16 public methods. Consider refactoring Catalog_local to keep number of public methods under 10.
      Open

      class Catalog_local extends Catalog
      {
          private string $version     = '000001';
          private string $type        = 'local';
          private string $description = 'Local Catalog';
      Severity: Minor
      Found in src/Module/Catalog/Catalog_local.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

      Consider simplifying this complex logical expression.
      Open

              if (
                  !$m4a &&
                  !$flac &&
                  !$mpc &&
                  !$ogg &&
      Severity: Critical
      Found in src/Module/Catalog/Catalog_local.php - About 3 hrs to fix

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

            private function _verify_chunk($tableName, $chunk, $chunk_size): int
            {
                $count   = $chunk * $chunk_size;
                $changed = 0;
        
        
        Severity: Minor
        Found in src/Module/Catalog/Catalog_local.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 add_files has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            public function add_files($path, $options, $counter = 0): int
            {
                // See if we want a non-root path for the add
                if (isset($options['subdirectory'])) {
                    $path = $options['subdirectory'];
        Severity: Minor
        Found in src/Module/Catalog/Catalog_local.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 clean_catalog_proc has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            public function clean_catalog_proc(): int
            {
                if (!Core::is_readable($this->path)) {
                    // First sanity check; no point in proceeding with an unreadable catalog root.
                    debug_event('local.catalog', 'Catalog path:' . $this->path . ' unreadable, clean failed', 1);
        Severity: Minor
        Found in src/Module/Catalog/Catalog_local.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 verify_catalog_proc has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public function verify_catalog_proc(): int
            {
                debug_event('local.catalog', 'Verify starting on ' . $this->name, 5);
                set_time_limit(0);
        
        
        Severity: Minor
        Found in src/Module/Catalog/Catalog_local.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

        Avoid deeply nested control flow statements.
        Open

                                if (!Core::is_readable($directory)) {
                                    debug_event(self::class, 'mkdir: ' . $directory, 5);
                                    mkdir($directory, 0755, true);
                                }
        Severity: Major
        Found in src/Module/Catalog/Catalog_local.php - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if (!Core::is_readable($root)) {
                                      debug_event(self::class, 'Target user directory `' . $root . "` doesn't exist. Creating it...", 5);
                                      mkdir($root);
                                  }
          Severity: Major
          Found in src/Module/Catalog/Catalog_local.php - About 45 mins to fix

            Avoid too many return statements within this method.
            Open

                                    return false;
            Severity: Major
            Found in src/Module/Catalog/Catalog_local.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                              return false;
              Severity: Major
              Found in src/Module/Catalog/Catalog_local.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            return true;
                Severity: Major
                Found in src/Module/Catalog/Catalog_local.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                                              return false;
                  Severity: Major
                  Found in src/Module/Catalog/Catalog_local.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                return false;
                    Severity: Major
                    Found in src/Module/Catalog/Catalog_local.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                              return false;
                      Severity: Major
                      Found in src/Module/Catalog/Catalog_local.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                                return false;
                        Severity: Major
                        Found in src/Module/Catalog/Catalog_local.php - About 30 mins to fix

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

                              public function clean_file($file, $media_type = 'song'): bool
                              {
                                  $file_info = Core::get_filesize(Core::conv_lc_file($file));
                                  if ($file_info < 1) {
                                      $object_id = Catalog::get_id_from_file($file, $media_type);
                          Severity: Minor
                          Found in src/Module/Catalog/Catalog_local.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 _verify_chunk() has an NPath complexity of 984. The configured NPath complexity threshold is 200.
                          Open

                              private function _verify_chunk($tableName, $chunk, $chunk_size): int
                              {
                                  $count   = $chunk * $chunk_size;
                                  $changed = 0;
                          
                          
                          Severity: Minor
                          Found in src/Module/Catalog/Catalog_local.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 _insert_local_song() has 137 lines of code. Current threshold is set to 100. Avoid really long methods.
                          Open

                              private function _insert_local_song(string $file, $options = array())
                              {
                                  $vainfo = self::getUtilityFactory()->createVaInfo(
                                      $file,
                                      $this->get_gather_types('music'),
                          Severity: Minor
                          Found in src/Module/Catalog/Catalog_local.php by phpmd

                          The method add_to_catalog() has 104 lines of code. Current threshold is set to 100. Avoid really long methods.
                          Open

                              public function add_to_catalog($options = null): int
                              {
                                  if (empty($options)) {
                                      $options = array(
                                          'gather_art' => true,
                          Severity: Minor
                          Found in src/Module/Catalog/Catalog_local.php by phpmd

                          The method add_file() has 147 lines of code. Current threshold is set to 100. Avoid really long methods.
                          Open

                              public function add_file($full_file, $options, $counter = 0): bool
                              {
                                  // Ensure that we've got our cache
                                  $this->_create_filecache();
                          
                          
                          Severity: Minor
                          Found in src/Module/Catalog/Catalog_local.php by phpmd

                          The method cache_catalog_proc() has 142 lines of code. Current threshold is set to 100. Avoid really long methods.
                          Open

                              public function cache_catalog_proc(): bool
                              {
                                  $m4a    = AmpConfig::get('cache_m4a');
                                  $flac   = AmpConfig::get('cache_flac');
                                  $mpc    = AmpConfig::get('cache_mpc');
                          Severity: Minor
                          Found in src/Module/Catalog/Catalog_local.php by phpmd

                          The method add_files() has an NPath complexity of 832. The configured NPath complexity threshold is 200.
                          Open

                              public function add_files($path, $options, $counter = 0): int
                              {
                                  // See if we want a non-root path for the add
                                  if (isset($options['subdirectory'])) {
                                      $path = $options['subdirectory'];
                          Severity: Minor
                          Found in src/Module/Catalog/Catalog_local.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 add_file() has an NPath complexity of 494208. The configured NPath complexity threshold is 200.
                          Open

                              public function add_file($full_file, $options, $counter = 0): bool
                              {
                                  // Ensure that we've got our cache
                                  $this->_create_filecache();
                          
                          
                          Severity: Minor
                          Found in src/Module/Catalog/Catalog_local.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 add_to_catalog() has an NPath complexity of 35424. The configured NPath complexity threshold is 200.
                          Open

                              public function add_to_catalog($options = null): int
                              {
                                  if (empty($options)) {
                                      $options = array(
                                          'gather_art' => true,
                          Severity: Minor
                          Found in src/Module/Catalog/Catalog_local.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 _insert_local_song() has an NPath complexity of 1118272. The configured NPath complexity threshold is 200.
                          Open

                              private function _insert_local_song(string $file, $options = array())
                              {
                                  $vainfo = self::getUtilityFactory()->createVaInfo(
                                      $file,
                                      $this->get_gather_types('music'),
                          Severity: Minor
                          Found in src/Module/Catalog/Catalog_local.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 cache_catalog_proc() has an NPath complexity of 34406400. The configured NPath complexity threshold is 200.
                          Open

                              public function cache_catalog_proc(): bool
                              {
                                  $m4a    = AmpConfig::get('cache_m4a');
                                  $flac   = AmpConfig::get('cache_flac');
                                  $mpc    = AmpConfig::get('cache_mpc');
                          Severity: Minor
                          Found in src/Module/Catalog/Catalog_local.php by phpmd

                          NPathComplexity

                          Since: 0.1

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

                          Example

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

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

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

                          class Catalog_local extends Catalog
                          {
                              private string $version     = '000001';
                              private string $type        = 'local';
                              private string $description = 'Local Catalog';
                          Severity: Minor
                          Found in src/Module/Catalog/Catalog_local.php by phpmd

                          The method clean_catalog_proc() has an NPath complexity of 288. The configured NPath complexity threshold is 200.
                          Open

                              public function clean_catalog_proc(): int
                              {
                                  if (!Core::is_readable($this->path)) {
                                      // First sanity check; no point in proceeding with an unreadable catalog root.
                                      debug_event('local.catalog', 'Catalog path:' . $this->path . ' unreadable, clean failed', 1);
                          Severity: Minor
                          Found in src/Module/Catalog/Catalog_local.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 add_files() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10.
                          Open

                              public function add_files($path, $options, $counter = 0): int
                              {
                                  // See if we want a non-root path for the add
                                  if (isset($options['subdirectory'])) {
                                      $path = $options['subdirectory'];
                          Severity: Minor
                          Found in src/Module/Catalog/Catalog_local.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 add_file() has a Cyclomatic Complexity of 32. The configured cyclomatic complexity threshold is 10.
                          Open

                              public function add_file($full_file, $options, $counter = 0): bool
                              {
                                  // Ensure that we've got our cache
                                  $this->_create_filecache();
                          
                          
                          Severity: Minor
                          Found in src/Module/Catalog/Catalog_local.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 add_to_catalog() has a Cyclomatic Complexity of 24. The configured cyclomatic complexity threshold is 10.
                          Open

                              public function add_to_catalog($options = null): int
                              {
                                  if (empty($options)) {
                                      $options = array(
                                          'gather_art' => true,
                          Severity: Minor
                          Found in src/Module/Catalog/Catalog_local.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 cache_catalog_proc() has a Cyclomatic Complexity of 39. The configured cyclomatic complexity threshold is 10.
                          Open

                              public function cache_catalog_proc(): bool
                              {
                                  $m4a    = AmpConfig::get('cache_m4a');
                                  $flac   = AmpConfig::get('cache_flac');
                                  $mpc    = AmpConfig::get('cache_mpc');
                          Severity: Minor
                          Found in src/Module/Catalog/Catalog_local.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 _insert_local_song() has a Cyclomatic Complexity of 33. The configured cyclomatic complexity threshold is 10.
                          Open

                              private function _insert_local_song(string $file, $options = array())
                              {
                                  $vainfo = self::getUtilityFactory()->createVaInfo(
                                      $file,
                                      $this->get_gather_types('music'),
                          Severity: Minor
                          Found in src/Module/Catalog/Catalog_local.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 _verify_chunk() has a Cyclomatic Complexity of 18. The configured cyclomatic complexity threshold is 10.
                          Open

                              private function _verify_chunk($tableName, $chunk, $chunk_size): int
                              {
                                  $count   = $chunk * $chunk_size;
                                  $changed = 0;
                          
                          
                          Severity: Minor
                          Found in src/Module/Catalog/Catalog_local.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 clean_catalog_proc() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
                          Open

                              public function clean_catalog_proc(): int
                              {
                                  if (!Core::is_readable($this->path)) {
                                      // First sanity check; no point in proceeding with an unreadable catalog root.
                                      debug_event('local.catalog', 'Catalog path:' . $this->path . ' unreadable, clean failed', 1);
                          Severity: Minor
                          Found in src/Module/Catalog/Catalog_local.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 Catalog_local has a coupling between objects value of 23. Consider to reduce the number of dependencies under 13.
                          Open

                          class Catalog_local extends Catalog
                          {
                              private string $version     = '000001';
                              private string $type        = 'local';
                              private string $description = 'Local Catalog';
                          Severity: Minor
                          Found in src/Module/Catalog/Catalog_local.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 add_to_catalog uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                          Open

                                                          } else {
                                                              echo "-: " . T_('Failure') . ":\t" . scrub_out($file['file']) . "\n";
                                                          }
                          Severity: Minor
                          Found in src/Module/Catalog/Catalog_local.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 add_file uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                          Open

                                          } else {
                                              if (count($this->get_gather_types('video')) > 0) {
                                                  if ($is_video_file && $this->_insert_local_video($full_file, $options)) {
                                                      debug_event('local.catalog', 'Imported video file: ' . $full_file, 5);
                                                  } else {
                          Severity: Minor
                          Found in src/Module/Catalog/Catalog_local.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 add_file uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                          Open

                                  } else {
                                      // if it matches the pattern
                                      if ($counter % 1000 == 0) {
                                          debug_event('local.catalog', "$full_file ignored, non-audio file or 0 bytes", 5);
                                      }
                          Severity: Minor
                          Found in src/Module/Catalog/Catalog_local.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 _insert_local_song uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                          Open

                                              } else {
                                                  $fullpath = rtrim($directory, "\/") . '/' . ltrim($filename, "\/") . "." . (pathinfo((string)$song->file, PATHINFO_EXTENSION));
                                              }
                          Severity: Minor
                          Found in src/Module/Catalog/Catalog_local.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 add_file uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                          Open

                                                  } else {
                                                      debug_event('local.catalog', 'Skipped video file: ' . $full_file, 5);
                          
                                                      return false;
                                                  }
                          Severity: Minor
                          Found in src/Module/Catalog/Catalog_local.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 add_file uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                          Open

                                              } else {
                                                  debug_event('local.catalog', 'Skipped song file: ' . $full_file, 5);
                          
                                                  return false;
                                              }
                          Severity: Minor
                          Found in src/Module/Catalog/Catalog_local.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 verify_catalog_proc uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                          Open

                                  } else {
                                      return $this->count;
                                  }
                          Severity: Minor
                          Found in src/Module/Catalog/Catalog_local.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 _insert_local_video uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                          Open

                                  } else {
                                      $this->videos_to_gather[] = $video_id;
                                  }
                          Severity: Minor
                          Found in src/Module/Catalog/Catalog_local.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 add_files uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                          Open

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

                                              } else {
                                                  $convok = (strcmp($enc_full_file, $full_file) == 0);
                                              }
                          Severity: Minor
                          Found in src/Module/Catalog/Catalog_local.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 add_file uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                          Open

                                      } else {
                                          if (count($this->get_gather_types('music')) > 0) {
                                              if ($is_audio_file && $this->_insert_local_song($full_file, $options)) {
                                                  debug_event('local.catalog', 'Imported song file: ' . $full_file, 5);
                                              } else {
                          Severity: Minor
                          Found in src/Module/Catalog/Catalog_local.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 add_to_catalog uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                          Open

                                  } else {
                                      /* Get the songs and then insert them into the db */
                                      $this->count += $this->add_files($this->path, $options);
                                      if ($options['parse_playlist'] && count($this->_playlists)) {
                                          // Foreach Playlists we found
                          Severity: Minor
                          Found in src/Module/Catalog/Catalog_local.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 _insert_local_song uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                          Open

                                                  } else {
                                                      debug_event(self::class, 'song path updated: ' . $fullpath, 5);
                                                      unlink($song->file); // delete the original on success
                                                      // Update the catalog
                                                      $sql = "UPDATE `song` SET `file` = ? WHERE `id` = ?;";
                          Severity: Minor
                          Found in src/Module/Catalog/Catalog_local.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 '$catalog_id'.
                          Open

                                          $catalog_id = $this->catalog_id;
                          Severity: Minor
                          Found in src/Module/Catalog/Catalog_local.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

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

                              private string $version     = '000001';
                          Severity: Critical
                          Found in src/Module/Catalog/Catalog_local.php by phan

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

                                              if ($directory === null || $filename === null) {
                                                  $fullpath = (string)$song->file;
                                              } else {
                                                  $fullpath = rtrim($directory, "\/") . '/' . ltrim($filename, "\/") . "." . (pathinfo((string)$song->file, PATHINFO_EXTENSION));
                                              }
                          Severity: Minor
                          Found in src/Module/Catalog/Catalog_local.php and 1 other location - About 50 mins to fix
                          src/Module/Song/SongSorter.php on lines 170..174

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

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          The parameter $catalog_id is not named in camelCase.
                          Open

                              public function __construct($catalog_id = null)
                              {
                                  if ($catalog_id) {
                                      $info = $this->get_info($catalog_id, static::DB_TABLENAME);
                                      foreach ($info as $key => $value) {
                          Severity: Minor
                          Found in src/Module/Catalog/Catalog_local.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 $file_path is not named in camelCase.
                          Open

                              public function get_rel_path($file_path): string
                              {
                                  $catalog_path = rtrim($this->path, "/");
                          
                                  return (str_replace($catalog_path . "/", "", $file_path));
                          Severity: Minor
                          Found in src/Module/Catalog/Catalog_local.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_file is not named in camelCase.
                          Open

                              public function add_file($full_file, $options, $counter = 0): bool
                              {
                                  // Ensure that we've got our cache
                                  $this->_create_filecache();
                          
                          
                          Severity: Minor
                          Found in src/Module/Catalog/Catalog_local.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 $chunk_size is not named in camelCase.
                          Open

                              private function _clean_chunk($media_type, $chunk, $chunk_size): array
                              {
                                  $dead  = array();
                                  $count = $chunk * $chunk_size;
                          
                          
                          Severity: Minor
                          Found in src/Module/Catalog/Catalog_local.php by phpmd

                          CamelCaseParameterName

                          Since: 0.2

                          It is considered best practice to use the camelCase notation to name parameters.

                          Example

                          class ClassName {
                              public function doSomething($user_name) {
                              }
                          }

                          Source

                          The parameter $catalog_id is not named in camelCase.
                          Open

                              public static function create_type($catalog_id, $data): bool
                              {
                                  // Clean up the path just in case
                                  $path = rtrim(rtrim(trim($data['path']), '/'), '\\');
                          
                          
                          Severity: Minor
                          Found in src/Module/Catalog/Catalog_local.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 $media_type is not named in camelCase.
                          Open

                              private function _check_chunk($media_type, $chunk, $chunk_size): array
                              {
                                  $missing = array();
                                  $count   = $chunk * $chunk_size;
                          
                          
                          Severity: Minor
                          Found in src/Module/Catalog/Catalog_local.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 $media_type is not named in camelCase.
                          Open

                              public function clean_file($file, $media_type = 'song'): bool
                              {
                                  $file_info = Core::get_filesize(Core::conv_lc_file($file));
                                  if ($file_info < 1) {
                                      $object_id = Catalog::get_id_from_file($file, $media_type);
                          Severity: Minor
                          Found in src/Module/Catalog/Catalog_local.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 $chunk_size is not named in camelCase.
                          Open

                              private function _check_chunk($media_type, $chunk, $chunk_size): array
                              {
                                  $missing = array();
                                  $count   = $chunk * $chunk_size;
                          
                          
                          Severity: Minor
                          Found in src/Module/Catalog/Catalog_local.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 $chunk_size is not named in camelCase.
                          Open

                              private function _verify_chunk($tableName, $chunk, $chunk_size): int
                              {
                                  $count   = $chunk * $chunk_size;
                                  $changed = 0;
                          
                          
                          Severity: Minor
                          Found in src/Module/Catalog/Catalog_local.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 $media_type is not named in camelCase.
                          Open

                              private function _clean_chunk($media_type, $chunk, $chunk_size): array
                              {
                                  $dead  = array();
                                  $count = $chunk * $chunk_size;
                          
                          
                          Severity: Minor
                          Found in src/Module/Catalog/Catalog_local.php by phpmd

                          CamelCaseParameterName

                          Since: 0.2

                          It is considered best practice to use the camelCase notation to name parameters.

                          Example

                          class ClassName {
                              public function doSomething($user_name) {
                              }
                          }

                          Source

                          The class Catalog_local is not named in CamelCase.
                          Open

                          class Catalog_local extends Catalog
                          {
                              private string $version     = '000001';
                              private string $type        = 'local';
                              private string $description = 'Local Catalog';
                          Severity: Minor
                          Found in src/Module/Catalog/Catalog_local.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 $new_path is not named in camelCase.
                          Open

                              public function move_catalog_proc($new_path): bool
                              {
                                  if (!self::check_path($new_path)) {
                                      return false;
                                  }
                          Severity: Minor
                          Found in src/Module/Catalog/Catalog_local.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 "_clean_chunk" should not be prefixed with an underscore to indicate visibility
                          Open

                              private function _clean_chunk($media_type, $chunk, $chunk_size): array

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

                              private function _verify_chunk($tableName, $chunk, $chunk_size): int

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

                              private function _check_chunk($media_type, $chunk, $chunk_size): array

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

                              private function _insert_local_video($file, $options = array()): int

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

                              private function _insert_local_song(string $file, $options = array())

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

                          class Catalog_local extends Catalog

                          Expected 0 spaces after opening bracket; newline found
                          Open

                                  if (

                          There are no issues that match your filters.

                          Category
                          Status