ampache/ampache

View on GitHub
src/Repository/Model/Art.php

Summary

Maintainability
F
6 days
Test Coverage

File Art.php has 960 lines of code (exceeds 500 allowed). Consider refactoring.
Open

<?php

declare(strict_types=0);

/**
Severity: Major
Found in src/Repository/Model/Art.php - About 1 day to fix

    Function insert has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
    Open

        public function insert($source, $mime = ''): bool
        {
            // Disabled in demo mode cause people suck and upload porn
            if (AmpConfig::get('demo_mode')) {
                return false;
    Severity: Minor
    Found in src/Repository/Model/Art.php - About 4 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

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

        public static function url($uid, $type, $sid = null, $thumb = null): ?string
        {
            if (!self::is_valid_type($type)) {
                return null;
            }
    Severity: Minor
    Found in src/Repository/Model/Art.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

    Art has 31 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Art extends database_object
    {
        protected const DB_TABLENAME = 'image';
    
        public const VALID_TYPES = array(
    Severity: Minor
    Found in src/Repository/Model/Art.php - About 3 hrs to fix

      Function has_db_info has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

          public function has_db_info($fallback = false): bool
          {
              $sql         = "SELECT `id`, `image`, `mime`, `size` FROM `image` WHERE `object_type` = ? AND `object_id` = ? AND `kind` = ?";
              $db_results  = Dba::read($sql, array($this->type, $this->uid, $this->kind));
              $default_art = false;
      Severity: Minor
      Found in src/Repository/Model/Art.php - About 3 hrs to fix

      Cognitive Complexity

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

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

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

      Further reading

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

      class Art extends database_object
      {
          protected const DB_TABLENAME = 'image';
      
          public const VALID_TYPES = array(
      Severity: Minor
      Found in src/Repository/Model/Art.php by phpmd

      The class Art has 14 public methods. Consider refactoring Art to keep number of public methods under 10.
      Open

      class Art extends database_object
      {
          protected const DB_TABLENAME = 'image';
      
          public const VALID_TYPES = array(
      Severity: Minor
      Found in src/Repository/Model/Art.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 display has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function display(
              $object_type,
              $object_id,
              $name,
              $thumb,
      Severity: Minor
      Found in src/Repository/Model/Art.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 generate_thumb has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          public function generate_thumb($image, $size, $mime): array
          {
              $data = explode('/', (string) $mime);
              $type = ((string)($data[1] ?? '') !== '') ? strtolower((string) $data[1]) : 'jpg';
      
      
      Severity: Minor
      Found in src/Repository/Model/Art.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 get_from_source has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function get_from_source($data, $type): string
          {
              if (empty($data) || !is_array($data)) {
                  return '';
              }
      Severity: Minor
      Found in src/Repository/Model/Art.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 get_thumb_size has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function get_thumb_size(int $thumb): array
          {
              $size = array();
      
              switch ($thumb) {
      Severity: Minor
      Found in src/Repository/Model/Art.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 test_image has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          private static function test_image($source): bool
          {
              if (strlen((string) $source) < 10) {
                  debug_event(self::class, 'Invalid image passed', 1);
      
      
      Severity: Minor
      Found in src/Repository/Model/Art.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 get_thumb has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          public function get_thumb($size): array
          {
              $sizetext   = $size['width'] . 'x' . $size['height'];
              $sql        = "SELECT `image`, `mime` FROM `image` WHERE `size` = ? AND `object_type` = ? AND `object_id` = ? AND `kind` = ?";
              $db_results = Dba::read($sql, array($sizetext, $this->type, $this->uid, $this->kind));
      Severity: Minor
      Found in src/Repository/Model/Art.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 delete_rec_dir has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          private static function delete_rec_dir($path): void
          {
              debug_event(self::class, 'Deleting ' . (string) $path . ' directory...', 5);
      
              if (Core::is_readable($path)) {
      Severity: Minor
      Found in src/Repository/Model/Art.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 check_dimensions has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function check_dimensions($dimensions): bool
          {
              $width  = (int)($dimensions['width']);
              $height = (int)($dimensions['height']);
      
      
      Severity: Minor
      Found in src/Repository/Model/Art.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 gather_metadata_plugin has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function gather_metadata_plugin($plugin, $type, $options): array
          {
              $gtypes     = array();
              $media_info = array();
              switch ($type) {
      Severity: Minor
      Found in src/Repository/Model/Art.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 get_dir_on_disk has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function get_dir_on_disk($type, $uid, $kind = '', $autocreate = false)
          {
              $path = AmpConfig::get('local_metadata_dir');
              if (!$path) {
                  debug_event(self::class, 'local_metadata_dir setting is required to store art on disk.', 1);
      Severity: Minor
      Found in src/Repository/Model/Art.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

      Method display has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              $object_type,
              $object_id,
              $name,
              $thumb,
              $link = null,
      Severity: Major
      Found in src/Repository/Model/Art.php - About 50 mins to fix

        Method write_to_dir has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            private static function write_to_dir($source, $sizetext, $type, $uid, $kind, $mime): bool
        Severity: Minor
        Found in src/Repository/Model/Art.php - About 45 mins to fix

          Function duplicate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function duplicate($object_type, $old_object_id, $new_object_id, $new_object_type = null)
              {
                  $write_type = (self::is_valid_type($new_object_type))
                      ? $new_object_type
                      : $object_type;
          Severity: Minor
          Found in src/Repository/Model/Art.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 read_from_dir has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              private static function read_from_dir($sizetext, $type, $uid, $kind, $mime): ?string
          Severity: Minor
          Found in src/Repository/Model/Art.php - About 35 mins to fix

            Avoid too many return statements within this method.
            Open

                                return $image['raw'];
            Severity: Major
            Found in src/Repository/Model/Art.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return array();
              Severity: Major
              Found in src/Repository/Model/Art.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                        return '';
                Severity: Major
                Found in src/Repository/Model/Art.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                          return true;
                  Severity: Major
                  Found in src/Repository/Model/Art.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                return array();
                    Severity: Major
                    Found in src/Repository/Model/Art.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                  return array();
                      Severity: Major
                      Found in src/Repository/Model/Art.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                    return array();
                        Severity: Major
                        Found in src/Repository/Model/Art.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                  return array(
                                      'thumb' => $data,
                                      'thumb_mime' => $mime_type
                                  );
                          Severity: Major
                          Found in src/Repository/Model/Art.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                        return array();
                            Severity: Major
                            Found in src/Repository/Model/Art.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                              return $image_data;
                              Severity: Major
                              Found in src/Repository/Model/Art.php - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                            return array();
                                Severity: Major
                                Found in src/Repository/Model/Art.php - About 30 mins to fix

                                  The method test_image() has an NPath complexity of 240. The configured NPath complexity threshold is 200.
                                  Open

                                      private static function test_image($source): bool
                                      {
                                          if (strlen((string) $source) < 10) {
                                              debug_event(self::class, 'Invalid image passed', 1);
                                  
                                  
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.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 get_from_source() has an NPath complexity of 1152. The configured NPath complexity threshold is 200.
                                  Open

                                      public static function get_from_source($data, $type): string
                                      {
                                          if (empty($data) || !is_array($data)) {
                                              return '';
                                          }
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.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 url() has an NPath complexity of 4032. The configured NPath complexity threshold is 200.
                                  Open

                                      public static function url($uid, $type, $sid = null, $thumb = null): ?string
                                      {
                                          if (!self::is_valid_type($type)) {
                                              return null;
                                          }
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.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 display() has an NPath complexity of 9072. The configured NPath complexity threshold is 200.
                                  Open

                                      public static function display(
                                          $object_type,
                                          $object_id,
                                          $name,
                                          $thumb,
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.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 has_db_info() has an NPath complexity of 300. The configured NPath complexity threshold is 200.
                                  Open

                                      public function has_db_info($fallback = false): bool
                                      {
                                          $sql         = "SELECT `id`, `image`, `mime`, `size` FROM `image` WHERE `object_type` = ? AND `object_id` = ? AND `kind` = ?";
                                          $db_results  = Dba::read($sql, array($this->type, $this->uid, $this->kind));
                                          $default_art = false;
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.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 Art has 1382 lines of code. Current threshold is 1000. Avoid really long classes.
                                  Open

                                  class Art extends database_object
                                  {
                                      protected const DB_TABLENAME = 'image';
                                  
                                      public const VALID_TYPES = array(
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.php by phpmd

                                  The method generate_thumb() has an NPath complexity of 466560. The configured NPath complexity threshold is 200.
                                  Open

                                      public function generate_thumb($image, $size, $mime): array
                                      {
                                          $data = explode('/', (string) $mime);
                                          $type = ((string)($data[1] ?? '') !== '') ? strtolower((string) $data[1]) : 'jpg';
                                  
                                  
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.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() has an NPath complexity of 280320. The configured NPath complexity threshold is 200.
                                  Open

                                      public function insert($source, $mime = ''): bool
                                      {
                                          // Disabled in demo mode cause people suck and upload porn
                                          if (AmpConfig::get('demo_mode')) {
                                              return false;
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.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 generate_thumb() has 133 lines of code. Current threshold is set to 100. Avoid really long methods.
                                  Open

                                      public function generate_thumb($image, $size, $mime): array
                                      {
                                          $data = explode('/', (string) $mime);
                                          $type = ((string)($data[1] ?? '') !== '') ? strtolower((string) $data[1]) : 'jpg';
                                  
                                  
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.php by phpmd

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

                                      public function insert($source, $mime = ''): bool
                                      {
                                          // Disabled in demo mode cause people suck and upload porn
                                          if (AmpConfig::get('demo_mode')) {
                                              return false;
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.php by phpmd

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

                                      public static function url($uid, $type, $sid = null, $thumb = null): ?string
                                      {
                                          if (!self::is_valid_type($type)) {
                                              return null;
                                          }
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.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 has_db_info() has a Cyclomatic Complexity of 15. The configured cyclomatic complexity threshold is 10.
                                  Open

                                      public function has_db_info($fallback = false): bool
                                      {
                                          $sql         = "SELECT `id`, `image`, `mime`, `size` FROM `image` WHERE `object_type` = ? AND `object_id` = ? AND `kind` = ?";
                                          $db_results  = Dba::read($sql, array($this->type, $this->uid, $this->kind));
                                          $default_art = false;
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.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 get_dir_on_disk() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
                                  Open

                                      public static function get_dir_on_disk($type, $uid, $kind = '', $autocreate = false)
                                      {
                                          $path = AmpConfig::get('local_metadata_dir');
                                          if (!$path) {
                                              debug_event(self::class, 'local_metadata_dir setting is required to store art on disk.', 1);
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.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 get_thumb_size() has a Cyclomatic Complexity of 19. The configured cyclomatic complexity threshold is 10.
                                  Open

                                      public static function get_thumb_size(int $thumb): array
                                      {
                                          $size = array();
                                  
                                          switch ($thumb) {
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.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 test_image() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10.
                                  Open

                                      private static function test_image($source): bool
                                      {
                                          if (strlen((string) $source) < 10) {
                                              debug_event(self::class, 'Invalid image passed', 1);
                                  
                                  
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.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() has a Cyclomatic Complexity of 27. The configured cyclomatic complexity threshold is 10.
                                  Open

                                      public function insert($source, $mime = ''): bool
                                      {
                                          // Disabled in demo mode cause people suck and upload porn
                                          if (AmpConfig::get('demo_mode')) {
                                              return false;
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.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 display() has a Cyclomatic Complexity of 19. The configured cyclomatic complexity threshold is 10.
                                  Open

                                      public static function display(
                                          $object_type,
                                          $object_id,
                                          $name,
                                          $thumb,
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.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 check_dimensions() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
                                  Open

                                      public static function check_dimensions($dimensions): bool
                                      {
                                          $width  = (int)($dimensions['width']);
                                          $height = (int)($dimensions['height']);
                                  
                                  
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.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 gather_metadata_plugin() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
                                  Open

                                      public static function gather_metadata_plugin($plugin, $type, $options): array
                                      {
                                          $gtypes     = array();
                                          $media_info = array();
                                          switch ($type) {
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.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 generate_thumb() has a Cyclomatic Complexity of 28. The configured cyclomatic complexity threshold is 10.
                                  Open

                                      public function generate_thumb($image, $size, $mime): array
                                      {
                                          $data = explode('/', (string) $mime);
                                          $type = ((string)($data[1] ?? '') !== '') ? strtolower((string) $data[1]) : 'jpg';
                                  
                                  
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.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 get_from_source() has a Cyclomatic Complexity of 15. The configured cyclomatic complexity threshold is 10.
                                  Open

                                      public static function get_from_source($data, $type): string
                                      {
                                          if (empty($data) || !is_array($data)) {
                                              return '';
                                          }
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.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

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

                                      public function has_db_info($fallback = false): bool
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by sonar-php

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

                                  See

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

                                      public function insert($source, $mime = ''): bool
                                  Severity: Major
                                  Found in src/Repository/Model/Art.php by sonar-php

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

                                  Noncompliant Code Example

                                  With the default threshold of 3:

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

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

                                      public function insert($source, $mime = ''): bool
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by sonar-php

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

                                  See

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

                                      public static function display(
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by sonar-php

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

                                  See

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

                                      public static function get_from_source($data, $type): string
                                  Severity: Major
                                  Found in src/Repository/Model/Art.php by sonar-php

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

                                  Noncompliant Code Example

                                  With the default threshold of 3:

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

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

                                      public function generate_thumb($image, $size, $mime): array
                                  Severity: Major
                                  Found in src/Repository/Model/Art.php by sonar-php

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

                                  Noncompliant Code Example

                                  With the default threshold of 3:

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

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

                                      public function generate_thumb($image, $size, $mime): array
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by sonar-php

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

                                  See

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

                                      public static function url($uid, $type, $sid = null, $thumb = null): ?string
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by sonar-php

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

                                  See

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

                                      private static function test_image($source): bool
                                  Severity: Major
                                  Found in src/Repository/Model/Art.php by sonar-php

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

                                  Noncompliant Code Example

                                  With the default threshold of 3:

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

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

                                  class Art extends database_object
                                  Severity: Major
                                  Found in src/Repository/Model/Art.php by sonar-php

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

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

                                      public static function get_from_source($data, $type): string
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by sonar-php

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

                                  See

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

                                      public static function check_dimensions($dimensions): bool
                                  Severity: Major
                                  Found in src/Repository/Model/Art.php by sonar-php

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

                                  Noncompliant Code Example

                                  With the default threshold of 3:

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

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

                                  class Art extends database_object
                                  {
                                      protected const DB_TABLENAME = 'image';
                                  
                                      public const VALID_TYPES = array(
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.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 insert uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                  Open

                                                  } else {
                                                      $apics = $data['id3v2']['APIC'];
                                                  }
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.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 assigning values to variables in if clauses and the like (line '328', column '13').
                                  Open

                                      public static function has_db($object_id, $object_type, $kind = 'default'): bool
                                      {
                                          $sql        = "SELECT COUNT(`id`) AS `nb_img` FROM `image` WHERE `object_type` = ? AND `object_id` = ? AND `kind` = ?";
                                          $db_results = Dba::read($sql, array($object_type, $object_id, $kind));
                                          $nb_img     = 0;
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.php by phpmd

                                  IfStatementAssignment

                                  Since: 2.7.0

                                  Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

                                  Example

                                  class Foo
                                  {
                                      public function bar($flag)
                                      {
                                          if ($foo = 'bar') { // possible typo
                                              // ...
                                          }
                                          if ($baz = 0) { // always false
                                              // ...
                                          }
                                      }
                                  }

                                  Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

                                  The method get_dir_on_disk 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/Repository/Model/Art.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 get uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                  Open

                                          } else {
                                              return $this->thumb;
                                          }
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.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 get_thumb 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, 'Thumb entry found in database but associated data cannot be found.', 3);
                                              }
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.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 url uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                  Open

                                          } else {
                                              $url = AmpConfig::get('web_path') . '/image.php?object_id=' . scrub_out($uid) . '&object_type=' . scrub_out($type);
                                              if ($thumb !== null) {
                                                  $url .= '&thumb=' . $thumb;
                                              }
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.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 uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                  Open

                                                  } else {
                                                      switch (count($apics)) {
                                                          case 1:
                                                              $idx = $this->check_for_duplicate($apics, $ndata, $new_pic, $apic_typeid);
                                                              if (is_null($idx)) {
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.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 delete_rec_dir uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                  Open

                                                  } else {
                                                      unlink($path . '/' . $file);
                                                  }
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.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 url uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                  Open

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

                                              } else {
                                                  $image = $results['image'];
                                              }
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.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 has_db_info uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                  Open

                                                  } else {
                                                      $this->raw = $results['image'];
                                                  }
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.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 has_db_info 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, 'Art id {' . $this->id . '} Unable to generate thumbnail for ' . $this->type . ': ' . $this->uid, 1);
                                              }
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.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 uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                  Open

                                                              } else {
                                                                  $apicsId                             = ($idx == 0) ? 1 : 0;
                                                                  $ndata['attached_picture'][$apicsId] = array(
                                                                      'data' => $apics[$apicsId]['data'],
                                                                      'mime' => $apics[$apicsId][$apic_mimetype],
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.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 generate_thumb uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                  Open

                                          } else {
                                              // square
                                              $new_width  = $size['width'];
                                              $new_height = $size['height'];
                                              $crop_x     = 0;
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.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 url uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                  Open

                                                  } else {
                                                      if ($row['size'] == '275x275' && AmpConfig::get('resize_images')) {
                                                          $thumb_mime = $row['mime'];
                                                      }
                                                  }
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.php by phpmd

                                  ElseExpression

                                  Since: 1.4.0

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

                                  Example

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

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

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

                                                  } elseif ($results['size'] == '275x275') {
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by sonar-php

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

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

                                  Noncompliant Code Example

                                  With the default threshold of 3:

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

                                  Compliant Solution

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

                                  Exceptions

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

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

                                                      $this->save_thumb($data['thumb'], $data['thumb_mime'], $size);
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by sonar-php

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

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

                                  Noncompliant Code Example

                                  With the default threshold of 3:

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

                                  Compliant Solution

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

                                  Exceptions

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

                                  Merge this if statement with the enclosing one.
                                  Open

                                              if (imagedestroy($image) === false) {
                                  Severity: Major
                                  Found in src/Repository/Model/Art.php by sonar-php

                                  Merging collapsible if statements increases the code's readability.

                                  Noncompliant Code Example

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

                                  Compliant Solution

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

                                  Merge this if statement with the enclosing one.
                                  Open

                                              if (!self::has_db($object_id, $object_type, $kind)) {
                                  Severity: Major
                                  Found in src/Repository/Model/Art.php by sonar-php

                                  Merging collapsible if statements increases the code's readability.

                                  Noncompliant Code Example

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

                                  Compliant Solution

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

                                  Define a constant instead of duplicating this literal "picturetypeid" 8 times.
                                  Open

                                                  $apic_typeid   = ($fileformat == 'flac' || $fileformat == 'ogg') ? 'typeid' : 'picturetypeid';
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by sonar-php

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

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

                                  Noncompliant Code Example

                                  With the default threshold of 3:

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

                                  Compliant Solution

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

                                  Exceptions

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

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

                                                  if (AmpConfig::get('album_art_store_disk')) {
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by sonar-php

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

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

                                  Noncompliant Code Example

                                  With the default threshold of 3:

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

                                  Compliant Solution

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

                                  Exceptions

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

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

                                              if ($results['size'] == 'original') {
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by sonar-php

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

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

                                  Noncompliant Code Example

                                  With the default threshold of 3:

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

                                  Compliant Solution

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

                                  Exceptions

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

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

                                                  if ($data['title'] == $image['title']) {
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by sonar-php

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

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

                                  Noncompliant Code Example

                                  With the default threshold of 3:

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

                                  Compliant Solution

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

                                  Exceptions

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

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

                                      public function __construct($uid = 0, $type = 'album', $kind = 'default')
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by sonar-php

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

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

                                  Noncompliant Code Example

                                  With the default threshold of 3:

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

                                  Compliant Solution

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

                                  Exceptions

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

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

                                              } elseif ($this->type === 'artist') {
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by sonar-php

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

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

                                  Noncompliant Code Example

                                  With the default threshold of 3:

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

                                  Compliant Solution

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

                                  Exceptions

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

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

                                      public function __construct($uid = 0, $type = 'album', $kind = 'default')
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by sonar-php

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

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

                                  Noncompliant Code Example

                                  With the default threshold of 3:

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

                                  Compliant Solution

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

                                  Exceptions

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

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

                                              case 'tvshow_episode':
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by sonar-php

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

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

                                  Noncompliant Code Example

                                  With the default threshold of 3:

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

                                  Compliant Solution

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

                                  Exceptions

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

                                  Define and throw a dedicated exception instead of using a generic one.
                                  Open

                                                  throw new RuntimeException('The image handle from source: ' . $source . ' could not be destroyed');
                                  Severity: Major
                                  Found in src/Repository/Model/Art.php by sonar-php

                                  If you throw a general exception type, such as ErrorException, RuntimeException, or Exception in a library or framework, it forces consumers to catch all exceptions, including unknown exceptions that they do not know how to handle.

                                  Instead, either throw a subtype that already exists in the Standard PHP Library, or create your own type that derives from Exception.

                                  Noncompliant Code Example

                                  throw new Exception();  // Noncompliant
                                  

                                  Compliant Solution

                                  throw new InvalidArgumentException();
                                  // or
                                  throw new UnexpectedValueException();
                                  

                                  See

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

                                              case 'tvshow_season':
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by sonar-php

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

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

                                  Noncompliant Code Example

                                  With the default threshold of 3:

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

                                  Compliant Solution

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

                                  Exceptions

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

                                  Define a constant instead of duplicating this literal "attached_picture" 9 times.
                                  Open

                                                      $ndata['attached_picture'][] = $new_pic;
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by sonar-php

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

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

                                  Noncompliant Code Example

                                  With the default threshold of 3:

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

                                  Compliant Solution

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

                                  Exceptions

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

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

                                                      $this->save_thumb($data['thumb'], $data['thumb_mime'], $size);
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by sonar-php

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

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

                                  Noncompliant Code Example

                                  With the default threshold of 3:

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

                                  Compliant Solution

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

                                  Exceptions

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

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

                                          switch ($type) {
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by sonar-php

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

                                  Noncompliant Code Example

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

                                  Compliant Solution

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

                                  See

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

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

                                          $mime  = "image/" . ($rurl['extension'] ?? 'jpg');
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by sonar-php

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

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

                                  Noncompliant Code Example

                                  With the default threshold of 3:

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

                                  Compliant Solution

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

                                  Exceptions

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

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

                                              } elseif (AmpConfig::get('resize_images')) {
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by sonar-php

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

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

                                  Noncompliant Code Example

                                  With the default threshold of 3:

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

                                  Compliant Solution

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

                                  Exceptions

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

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

                                                      switch (count($apics)) {
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by sonar-php

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

                                  Noncompliant Code Example

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

                                  Compliant Solution

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

                                  See

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

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

                                                      'description' => $description
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by sonar-php

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

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

                                  Noncompliant Code Example

                                  With the default threshold of 3:

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

                                  Compliant Solution

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

                                  Exceptions

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

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

                                          $mime  = "image/" . ($rurl['extension'] ?? 'jpg');
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by sonar-php

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

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

                                  Noncompliant Code Example

                                  With the default threshold of 3:

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

                                  Compliant Solution

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

                                  Exceptions

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

                                  Define a constant instead of duplicating this literal "width" 35 times.
                                  Open

                                              $size = array('width' => 275, 'height' => 275);
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by sonar-php

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

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

                                  Noncompliant Code Example

                                  With the default threshold of 3:

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

                                  Compliant Solution

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

                                  Exceptions

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

                                  Define a constant instead of duplicating this literal "&object_type=" 3 times.
                                  Open

                                              $url = AmpConfig::get('web_path') . '/image.php?object_id=' . scrub_out($uid) . '&object_type=' . scrub_out($type);
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by sonar-php

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

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

                                  Noncompliant Code Example

                                  With the default threshold of 3:

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

                                  Compliant Solution

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

                                  Exceptions

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

                                  Rename "$type" which has the same name as the field declared at line 71.
                                  Open

                                          $type = ((string)($data[1] ?? '') !== '') ? strtolower((string) $data[1]) : 'jpg';
                                  Severity: Major
                                  Found in src/Repository/Model/Art.php by sonar-php

                                  Shadowing fields with a local variable is a bad practice that reduces code readability: it makes it confusing to know whether the field or the variable is being used.

                                  Noncompliant Code Example

                                  class Foo {
                                    public $myField;
                                  
                                    public function doSomething() {
                                      $myField = 0;
                                      ...
                                    }
                                  }
                                  

                                  See

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

                                      protected const DB_TABLENAME = 'image';
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by sonar-php

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

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

                                  Noncompliant Code Example

                                  With the default threshold of 3:

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

                                  Compliant Solution

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

                                  Exceptions

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

                                  Define a constant instead of duplicating this literal "&thumb=" 3 times.
                                  Open

                                                  $url .= '&thumb=' . $thumb;
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by sonar-php

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

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

                                  Noncompliant Code Example

                                  With the default threshold of 3:

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

                                  Compliant Solution

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

                                  Exceptions

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

                                  Define a constant instead of duplicating this literal "/image.php?object_id=" 3 times.
                                  Open

                                              $url = AmpConfig::get('web_path') . '/image.php?object_id=' . scrub_out($uid) . '&object_type=' . scrub_out($type);
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by sonar-php

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

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

                                  Noncompliant Code Example

                                  With the default threshold of 3:

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

                                  Compliant Solution

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

                                  Exceptions

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

                                  Define a constant instead of duplicating this literal "&object_id=" 3 times.
                                  Open

                                                  '?page=stream&action=directplay&object_type=' . $object_type . '&object_id=' . $object_id . '\' + getPagePlaySettings() + \'',
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by sonar-php

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

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

                                  Noncompliant Code Example

                                  With the default threshold of 3:

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

                                  Compliant Solution

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

                                  Exceptions

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

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

                                              $url = AmpConfig::get('web_path') . '/play/art/' . $sid . '/' . scrub_out($type) . '/' . scrub_out($uid) . '/thumb';
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by sonar-php

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

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

                                  Noncompliant Code Example

                                  With the default threshold of 3:

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

                                  Compliant Solution

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

                                  Exceptions

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

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

                                              echo "</div>";
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by sonar-php

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

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

                                  Noncompliant Code Example

                                  With the default threshold of 3:

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

                                  Compliant Solution

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

                                  Exceptions

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

                                  Define a constant instead of duplicating this literal "height" 37 times.
                                  Open

                                              $size = array('width' => 275, 'height' => 275);
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by sonar-php

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

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

                                  Noncompliant Code Example

                                  With the default threshold of 3:

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

                                  Compliant Solution

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

                                  Exceptions

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

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

                                              case 'tvshow':
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by sonar-php

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

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

                                  Noncompliant Code Example

                                  With the default threshold of 3:

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

                                  Compliant Solution

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

                                  Exceptions

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

                                  Call to deprecated function \debug_event() defined at /code/src/Config/functions.php:651
                                  Open

                                              debug_event(self::class, 'Invalid image passed', 1);
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to method get from undeclared class \WpOrg\Requests\Requests
                                  Open

                                                  $request = Requests\Requests::get($data['url'], array(), Core::requests_options($options));
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by phan

                                  Reference to undeclared class \Ampache\Repository\Model\database_object
                                  Open

                                              $row  = parent::get_from_cache('art', $key . '275x275');
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to deprecated function \debug_event() defined at /code/src/Config/functions.php:651
                                  Open

                                          debug_event(self::class, 'duplicate... type:' . $object_type . ' old_id:' . $old_object_id . ' new_type:' . $write_type . ' new_id:' . $new_object_id, 5);
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to deprecated function \debug_event() defined at /code/src/Config/functions.php:651
                                  Open

                                                  debug_event(self::class, "Image width not in range (min=$minw, max=$maxw, current=$width).", 1);
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to deprecated function \debug_event() defined at /code/src/Config/functions.php:651
                                  Open

                                              debug_event(self::class, 'Not inserting thumbnail, invalid data passed', 1);
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to method write from undeclared class \Ampache\Module\System\Dba
                                  Open

                                          Dba::write($sql, array($source, $mime, $sizetext, $width, $height, $this->type, $this->uid, $this->kind));
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to deprecated function \debug_event() defined at /code/src/Config/functions.php:651
                                  Open

                                              debug_event(self::class, 'Not trying to generate thumbnail, invalid data passed', 1);
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to method gatherFileArt from undeclared class \Ampache\Module\Art\Collector\MetaTagCollectorModule
                                  Open

                                              $images = MetaTagCollectorModule::gatherFileArt($data['song']);
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by phan

                                  Reference to undeclared class \Ampache\Repository\Model\database_object
                                  Open

                                              $row        = parent::get_from_cache('art', $key . 'original');
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by phan

                                  Saw a token Phan may have failed to parse after '* @return list<array> after <code>list,</code> saw <code>'&lt;'</code></array>
                                  Open

                                       * @return list<array{
                                  Severity: Info
                                  Found in src/Repository/Model/Art.php by phan

                                  Reference to undeclared class \Ampache\Repository\Model\database_object
                                  Open

                                              parent::add_to_cache('art', $row['object_type'] . $row['object_id'] . $row['size'], $row);
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to deprecated function \debug_event() defined at /code/src/Config/functions.php:651
                                  Open

                                              debug_event(self::class, 'Not inserting image for ' . $this->type . ' ' . $this->uid . ', invalid data passed', 1);
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to deprecated function \debug_event() defined at /code/src/Config/functions.php:651
                                  Open

                                              debug_event(self::class, 'PHP-GD Does not support GIFs - unable to resize', 1);
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to method read from undeclared class \Ampache\Module\System\Dba
                                  Open

                                              $db_results = Dba::read($sql, array($type, $uid));
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to method read from undeclared class \Ampache\Module\System\Dba
                                  Open

                                          $db_results  = Dba::read($sql, array($this->type, $this->uid, $this->kind));
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to deprecated function \debug_event() defined at /code/src/Config/functions.php:651
                                  Open

                                              debug_event(self::class, 'Failed to create Image from string - Source Image is damaged / malformed', 2);
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to deprecated function \debug_event() defined at /code/src/Config/functions.php:651
                                  Open

                                              debug_event(self::class, 'PHP-GD Does not support BMPs - unable to resize', 1);
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to method fetch_assoc from undeclared class \Ampache\Module\System\Dba
                                  Open

                                              while ($row = Dba::fetch_assoc($db_results)) {
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by phan

                                  Doc-block of gather_metadata_plugin contains declared return type \Ampache\Repository\Model\list which is incompatible with the return type array declared in the signature
                                  Open

                                       * @return list<array{
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to method read from undeclared class \Ampache\Module\System\Dba
                                  Open

                                          $db_results = Dba::read($sql, array($object_type, $object_id, $kind));
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to deprecated function \debug_event() defined at /code/src/Config/functions.php:651
                                  Open

                                          debug_event(self::class, 'Insert art from url ' . $url, 4);
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to deprecated function \debug_event() defined at /code/src/Config/functions.php:651
                                  Open

                                              debug_event(self::class, 'Error: No mime type found using: ' . $mime, 2);
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.php by phan

                                  Argument 1 (string) is int but \scrub_out() takes null|string defined at /code/src/Config/functions.php:94
                                  Open

                                              $url = AmpConfig::get('web_path') . '/image.php?object_id=' . scrub_out($uid) . '&object_type=' . scrub_out($type);
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to method fetch_assoc from undeclared class \Ampache\Module\System\Dba
                                  Open

                                          if ($results = Dba::fetch_assoc($db_results)) {
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to deprecated function \Ampache\Repository\Model\Art::getSongRepository() defined at /code/src/Repository/Model/Art.php:1415
                                  Open

                                                  $songs = $this->getSongRepository()->getByAlbum($object->id);
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to method write from undeclared class \Ampache\Module\System\Dba
                                  Open

                                          Dba::write($sql, array($source, $mime, $sizetext, $width, $height, $this->type, $this->uid, $this->kind));
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to deprecated function \debug_event() defined at /code/src/Config/functions.php:651
                                  Open

                                                  debug_event(self::class, 'Thumb entry found in database but associated data cannot be found.', 3);
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to method read from undeclared class \Ampache\Module\System\Dba
                                  Open

                                              $db_results = Dba::read($sql, array($type, $data['db']));
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by phan

                                  Doc-block of url has declared return type string which is not a permitted replacement of the nullable return type ?string declared in the signature ('?T' should be documented as 'T|null' or '?T')
                                  Open

                                       * @return string
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to method read from undeclared class \Ampache\Module\System\Dba
                                  Open

                                              $db_results = Dba::read($sql, array($object_type, $old_object_id));
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by phan

                                  Return type of gather_metadata_plugin() is undeclared type \Ampache\Repository\Model\list
                                  Open

                                      public static function gather_metadata_plugin($plugin, $type, $options): array
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.php by phan

                                  Doc-block of $object_ids in build_cache contains phpdoc param type \Ampache\Repository\Model\list<int></int> which is incompatible with the param type array declared in the signature
                                  Open

                                       * @param list<int> $object_ids
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to method read from undeclared class \Ampache\Module\System\Dba
                                  Open

                                          $db_results = Dba::read($sql);
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to deprecated function \debug_event() defined at /code/src/Config/functions.php:651
                                  Open

                                                  debug_event(self::class, "Image width not in range (min=$minw, max=$maxw, current=$width).", 1);
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to deprecated function \debug_event() defined at /code/src/Config/functions.php:651
                                  Open

                                              debug_event(self::class, 'read_from_images ' . $path . ' cannot be read.', 1);
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to deprecated function \debug_event() defined at /code/src/Config/functions.php:651
                                  Open

                                          debug_event(self::class, 'Deleting ' . (string) $path . ' directory...', 5);
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to deprecated function \Ampache\Repository\Model\Art::getArtCleanup() defined at /code/src/Repository/Model/Art.php:1425
                                  Open

                                          $this->getArtCleanup()->deleteForArt($this);
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to deprecated function \debug_event() defined at /code/src/Config/functions.php:651
                                  Open

                                              debug_event(self::class, 'CHECKING URL ' . $data['url'], 2);
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to deprecated function \debug_event() defined at /code/src/Config/functions.php:651
                                  Open

                                                  debug_event(self::class, 'Error getting art: ' . $error->getMessage(), 2);
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to method create from undeclared class \Ampache\Module\System\Session
                                  Open

                                                  $sid = Session::create(array(
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to method write from undeclared class \Ampache\Module\System\Dba
                                  Open

                                          return Dba::write($sql, array($write_type, $new_object_id, $object_type, $old_object_id));
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to method get_icon from undeclared class \Ampache\Module\Util\Ui
                                  Open

                                                  echo Ui::get_icon('delete', T_('Reset Art'));
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to deprecated function \debug_event() defined at /code/src/Config/functions.php:651
                                  Open

                                                  debug_event(self::class, 'Image failed PHP-GD test', 1);
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to deprecated function \Ampache\Repository\Model\Art::getSongRepository() defined at /code/src/Repository/Model/Art.php:1415
                                  Open

                                                  $songs = $this->getSongRepository()->getByArtist($object->id);
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to method register from undeclared class \WpOrg\Requests\autoload
                                  Open

                                                  Requests\Autoload::register();
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by phan

                                  Reference to undeclared class \Ampache\Repository\Model\database_object
                                  Open

                                          if (parent::is_cached('art', $key . 'original')) {
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by phan

                                  Class extends undeclared class \Ampache\Repository\Model\database_object
                                  Open

                                  class Art extends database_object
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to method fetch_assoc from undeclared class \Ampache\Module\System\Dba
                                  Open

                                          while ($results = Dba::fetch_assoc($db_results)) {
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by phan

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

                                                  $song        = new Song($song_id);
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by phan

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

                                                      $song->file
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to deprecated function \debug_event() defined at /code/src/Config/functions.php:651
                                  Open

                                                  debug_event(self::class, "Image height not in range (min=$minh, max=$maxh, current=$height).", 1);
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to method write from undeclared class \Ampache\Module\System\Dba
                                  Open

                                          Dba::write($sql, array($this->uid, $this->type, $sizetext, $this->kind));
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to method fetch_assoc from undeclared class \Ampache\Module\System\Dba
                                  Open

                                          $results = Dba::fetch_assoc($db_results);
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to deprecated function \debug_event() defined at /code/src/Config/functions.php:651
                                  Open

                                              debug_event(self::class, 'PHP-GD Not found - unable to resize art', 1);
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to deprecated function \debug_event() defined at /code/src/Config/functions.php:651
                                  Open

                                              debug_event(self::class, 'PHP-GD Does not support JPGs - unable to resize', 1);
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to deprecated function \debug_event() defined at /code/src/Config/functions.php:651
                                  Open

                                              debug_event(self::class, 'Image size (' . strlen((string) $source) . ') exceed the limit (' . $max_upload_size . ').', 1);
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.php by phan

                                  Assigning ?string to property but \Ampache\Repository\Model\Art->raw is string
                                  Open

                                              $this->raw      = self::read_from_images();
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.php by phan

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

                                                  $description = ($this->type == 'artist') ? $song->get_artist_fullname() : $object->full_name;
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to deprecated function \debug_event() defined at /code/src/Config/functions.php:651
                                  Open

                                              debug_event(self::class, 'Unknown Error resizing art', 1);
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to deprecated function \debug_event() defined at /code/src/Config/functions.php:651
                                  Open

                                                  debug_event(self::class, 'Art id {' . $this->id . '} Unable to generate thumbnail for ' . $this->type . ': ' . $this->uid, 1);
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to deprecated function \debug_event() defined at /code/src/Config/functions.php:651
                                  Open

                                              debug_event(self::class, 'Local image art ' . $path . ' cannot be read.', 1);
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to method read from undeclared class \Ampache\Module\System\Dba
                                  Open

                                          $db_results = Dba::read($sql, array($sizetext, $this->type, $this->uid, $this->kind));
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to deprecated function \debug_event() defined at /code/src/Config/functions.php:651
                                  Open

                                              debug_event(self::class, 'PHP-GD Does not support PNGs - unable to resize', 1);
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to method fetch_assoc from undeclared class \Ampache\Module\System\Dba
                                  Open

                                              $row        = Dba::fetch_assoc($db_results);
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to method get_icon from undeclared class \Ampache\Module\Util\Ui
                                  Open

                                                  echo Ui::get_icon('edit', T_('Edit/Find Art'));
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to method fetch_assoc from undeclared class \Ampache\Module\System\Dba
                                  Open

                                          while ($row = Dba::fetch_assoc($db_results)) {
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to deprecated function \debug_event() defined at /code/src/Config/functions.php:651
                                  Open

                                              debug_event(__CLASS__, 'Inserting ' . $this->type . ' image' . $object->name . ' for song files.', 5);
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to deprecated function \debug_event() defined at /code/src/Config/functions.php:651
                                  Open

                                              debug_event(self::class, 'local_metadata_dir setting is required to store art on disk.', 1);
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to deprecated function \debug_event() defined at /code/src/Config/functions.php:651
                                  Open

                                              debug_event(self::class, 'Local image art directory ' . $path . ' does not exist.', 1);
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to deprecated function \debug_event() defined at /code/src/Config/functions.php:651
                                  Open

                                              debug_event(self::class, 'Unable to create resized image', 1);
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.php by phan

                                  When fetching an array index from a value of type array<int>,</int> found an array index of type '1', but expected the index to be of type int
                                  Open

                                          $extension = $data['1'] ?? '';
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to deprecated function \debug_event() defined at /code/src/Config/functions.php:651
                                  Open

                                                  debug_event(self::class, "Image height not in range (min=$minh, max=$maxh, current=$height).", 1);
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.php by phan

                                  Reference to undeclared class \Ampache\Repository\Model\database_object
                                  Open

                                          if (parent::is_cached('art', $key . '275x275') && AmpConfig::get('resize_images')) {
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by phan

                                  Reference to undeclared class \Ampache\Repository\Model\database_object
                                  Open

                                                  parent::add_to_cache('art', $key . $row['size'], $row);
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by phan

                                  Argument 1 (string) is int but \scrub_out() takes null|string defined at /code/src/Config/functions.php:94
                                  Open

                                              $url = AmpConfig::get('web_path') . '/play/art/' . $sid . '/' . scrub_out($type) . '/' . scrub_out($uid) . '/thumb';
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.php by phan

                                  Call to method fetch_assoc from undeclared class \Ampache\Module\System\Dba
                                  Open

                                              while ($row = Dba::fetch_assoc($db_results)) {
                                  Severity: Critical
                                  Found in src/Repository/Model/Art.php by phan

                                  Avoid variables with short names like $id. Configured minimum length is 3.
                                  Open

                                      public $id;
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.php by phpmd

                                  ShortVariable

                                  Since: 0.2

                                  Detects when a field, local, or parameter has a very short name.

                                  Example

                                  class Something {
                                      private $q = 15; // VIOLATION - Field
                                      public static function main( array $as ) { // VIOLATION - Formal
                                          $r = 20 + $this->q; // VIOLATION - Local
                                          for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                              $r += $this->q;
                                          }
                                      }
                                  }

                                  Source https://phpmd.org/rules/naming.html#shortvariable

                                  The parameter $object_id is not named in camelCase.
                                  Open

                                      public static function has_db($object_id, $object_type, $kind = 'default'): bool
                                      {
                                          $sql        = "SELECT COUNT(`id`) AS `nb_img` FROM `image` WHERE `object_type` = ? AND `object_id` = ? AND `kind` = ?";
                                          $db_results = Dba::read($sql, array($object_type, $object_id, $kind));
                                          $nb_img     = 0;
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.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 has_db($object_id, $object_type, $kind = 'default'): bool
                                      {
                                          $sql        = "SELECT COUNT(`id`) AS `nb_img` FROM `image` WHERE `object_type` = ? AND `object_id` = ? AND `kind` = ?";
                                          $db_results = Dba::read($sql, array($object_type, $object_id, $kind));
                                          $nb_img     = 0;
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.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 $new_pic is not named in camelCase.
                                  Open

                                      private function check_for_duplicate($apics, &$ndata, $new_pic, $apic_typeid): ?int
                                      {
                                          $idx = null;
                                          $cnt = count($apics);
                                          for ($i = 0; $i < $cnt; $i++) {
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.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 $show_default is not named in camelCase.
                                  Open

                                      public static function display(
                                          $object_type,
                                          $object_id,
                                          $name,
                                          $thumb,
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.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 $new_object_type is not named in camelCase.
                                  Open

                                      public static function duplicate($object_type, $old_object_id, $new_object_id, $new_object_type = null)
                                      {
                                          $write_type = (self::is_valid_type($new_object_type))
                                              ? $new_object_type
                                              : $object_type;
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.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 build_cache(array $object_ids, $type = null): bool
                                      {
                                          if ($object_ids === []) {
                                              return false;
                                          }
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.php by phpmd

                                  CamelCaseParameterName

                                  Since: 0.2

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

                                  Example

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

                                  Source

                                  The parameter $object_id is not named in camelCase.
                                  Open

                                      public static function display(
                                          $object_type,
                                          $object_id,
                                          $name,
                                          $thumb,
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.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 $old_object_id is not named in camelCase.
                                  Open

                                      public static function duplicate($object_type, $old_object_id, $new_object_id, $new_object_type = null)
                                      {
                                          $write_type = (self::is_valid_type($new_object_type))
                                              ? $new_object_type
                                              : $object_type;
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.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 display(
                                          $object_type,
                                          $object_id,
                                          $name,
                                          $thumb,
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.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 duplicate($object_type, $old_object_id, $new_object_id, $new_object_type = null)
                                      {
                                          $write_type = (self::is_valid_type($new_object_type))
                                              ? $new_object_type
                                              : $object_type;
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.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 $new_object_id is not named in camelCase.
                                  Open

                                      public static function duplicate($object_type, $old_object_id, $new_object_id, $new_object_type = null)
                                      {
                                          $write_type = (self::is_valid_type($new_object_type))
                                              ? $new_object_type
                                              : $object_type;
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.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 $apic_typeid is not named in camelCase.
                                  Open

                                      private function check_for_duplicate($apics, &$ndata, $new_pic, $apic_typeid): ?int
                                      {
                                          $idx = null;
                                          $cnt = count($apics);
                                          for ($i = 0; $i < $cnt; $i++) {
                                  Severity: Minor
                                  Found in src/Repository/Model/Art.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

                                  There are no issues that match your filters.

                                  Category
                                  Status