ampache/ampache

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

Summary

Maintainability
F
4 days
Test Coverage

upload_avatar accesses the super-global variable $_FILES.
Open

    public function upload_avatar(): bool
    {
        $upload = array();
        if (!empty($_FILES['avatar']['tmp_name']) && $_FILES['avatar']['size'] <= AmpConfig::get('max_upload_size')) {
            $path_info      = pathinfo($_FILES['avatar']['name']);
Severity: Minor
Found in src/Repository/Model/User.php by phpmd

Superglobals

Since: 0.2

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

Example

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

Source

update_password accesses the super-global variable $_SESSION.
Open

    public function update_password($new_password, $hashed_password = null): void
    {
        debug_event(self::class, 'Updating password', 1);
        if (!$hashed_password) {
            $hashed_password = hash('sha256', $new_password);
Severity: Minor
Found in src/Repository/Model/User.php by phpmd

Superglobals

Since: 0.2

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

Example

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

Source

upload_avatar accesses the super-global variable $_FILES.
Open

    public function upload_avatar(): bool
    {
        $upload = array();
        if (!empty($_FILES['avatar']['tmp_name']) && $_FILES['avatar']['size'] <= AmpConfig::get('max_upload_size')) {
            $path_info      = pathinfo($_FILES['avatar']['name']);
Severity: Minor
Found in src/Repository/Model/User.php by phpmd

Superglobals

Since: 0.2

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

Example

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

Source

upload_avatar accesses the super-global variable $_FILES.
Open

    public function upload_avatar(): bool
    {
        $upload = array();
        if (!empty($_FILES['avatar']['tmp_name']) && $_FILES['avatar']['size'] <= AmpConfig::get('max_upload_size')) {
            $path_info      = pathinfo($_FILES['avatar']['name']);
Severity: Minor
Found in src/Repository/Model/User.php by phpmd

Superglobals

Since: 0.2

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

Example

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

Source

upload_avatar accesses the super-global variable $_FILES.
Open

    public function upload_avatar(): bool
    {
        $upload = array();
        if (!empty($_FILES['avatar']['tmp_name']) && $_FILES['avatar']['size'] <= AmpConfig::get('max_upload_size')) {
            $path_info      = pathinfo($_FILES['avatar']['name']);
Severity: Minor
Found in src/Repository/Model/User.php by phpmd

Superglobals

Since: 0.2

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

Example

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

Source

File User.php has 910 lines of code (exceeds 500 allowed). Consider refactoring.
Open

<?php

declare(strict_types=0);

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

    User has 61 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class User extends database_object
    {
        /** @var int Defines the internal system user-id */
        public const INTERNAL_SYSTEM_USER_ID = -1;
    
    
    Severity: Major
    Found in src/Repository/Model/User.php - About 1 day to fix

      The class User has 31 public methods. Consider refactoring User to keep number of public methods under 10.
      Open

      class User extends database_object
      {
          /** @var int Defines the internal system user-id */
          public const INTERNAL_SYSTEM_USER_ID = -1;
      
      
      Severity: Minor
      Found in src/Repository/Model/User.php by phpmd

      TooManyPublicMethods

      Since: 0.1

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

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

      Example

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

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

      class User extends database_object
      {
          /** @var int Defines the internal system user-id */
          public const INTERNAL_SYSTEM_USER_ID = -1;
      
      
      Severity: Minor
      Found in src/Repository/Model/User.php by phpmd

      TooManyMethods

      Since: 0.1

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

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

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

      Example

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

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

      class User extends database_object
      {
          /** @var int Defines the internal system user-id */
          public const INTERNAL_SYSTEM_USER_ID = -1;
      
      
      Severity: Minor
      Found in src/Repository/Model/User.php by phpmd

      Function update_counts has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function update_counts(): void
          {
              $catalog_disable = AmpConfig::get('catalog_disable');
              $catalog_filter  = AmpConfig::get('catalog_filter');
              $sql             = "SELECT `id` FROM `user`";
      Severity: Minor
      Found in src/Repository/Model/User.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 fix_preferences has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function fix_preferences($user_id): void
          {
              // Check default group (autoincrement starts at 1 so force it to be 0)
              $sql        = "SELECT `id`, `name` FROM `catalog_filter_group` WHERE `name` = 'DEFAULT';";
              $db_results = Dba::read($sql);
      Severity: Minor
      Found in src/Repository/Model/User.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 update has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          public function update(array $data)
          {
              if (empty($data['username'])) {
                  AmpError::add('username', T_('Username is required'));
              }
      Severity: Minor
      Found in src/Repository/Model/User.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_avatar has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          public function get_avatar($local = false): array
          {
              $avatar          = array();
              $avatar['title'] = T_('User avatar');
              if ($this->has_art()) {
      Severity: Minor
      Found in src/Repository/Model/User.php - About 1 hr to fix

      Cognitive Complexity

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

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

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

      Further reading

      The class User has 31 fields. Consider redesigning User to keep the number of fields under 15.
      Open

      class User extends database_object
      {
          /** @var int Defines the internal system user-id */
          public const INTERNAL_SYSTEM_USER_ID = -1;
      
      
      Severity: Minor
      Found in src/Repository/Model/User.php by phpmd

      TooManyFields

      Since: 0.1

      Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.

      Example

      class Person {
         protected $one;
         private $two;
         private $three;
         [... many more fields ...]
      }

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

      Function create has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function create(
              $username,
              $fullname,
              $email,
              $website,
      Severity: Minor
      Found in src/Repository/Model/User.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

      Method create has 11 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              $username,
              $fullname,
              $email,
              $website,
              $password,
      Severity: Major
      Found in src/Repository/Model/User.php - About 1 hr to fix

        Function format has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            public function format($details = true): void
            {
                if ($this->isNew()) {
                    return;
                }
        Severity: Minor
        Found in src/Repository/Model/User.php - About 1 hr to fix

        Cognitive Complexity

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

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

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

        Further reading

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

        class User extends database_object
        {
            /** @var int Defines the internal system user-id */
            public const INTERNAL_SYSTEM_USER_ID = -1;
        
        
        Severity: Minor
        Found in src/Repository/Model/User.php by phpmd

        ExcessivePublicCount

        Since: 0.1

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

        Example

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

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

        Function stream_control has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function stream_control($media_ids, ?User $user = null): bool
            {
                if ($user === null) {
                    $user = Core::get_global('user');
                    if (!$user instanceof User) {
        Severity: Minor
        Found in src/Repository/Model/User.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_favorites has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public function get_favorites($type): array
            {
                $items   = array();
                $count   = AmpConfig::get('popular_threshold', 10);
                $results = Stats::get_user($count, $type, $this->id, 1);
        Severity: Minor
        Found in src/Repository/Model/User.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 get_recently_played has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public function get_recently_played($type, $count, $offset = 0, $newest = true, $count_type = 'stream'): array
        Severity: Minor
        Found in src/Repository/Model/User.php - About 35 mins to fix

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

              public function get_preferences($type = 0, $system = false): array
              {
                  $user_limit = "";
                  if (!$system) {
                      $user_id    = $this->id;
          Severity: Minor
          Found in src/Repository/Model/User.php - About 35 mins to fix

          Cognitive Complexity

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

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

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

          Further reading

          Avoid too many return statements within this method.
          Open

                          return T_('Guest');
          Severity: Major
          Found in src/Repository/Model/User.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                            return T_('Unknown');
            Severity: Major
            Found in src/Repository/Model/User.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                              return AccessLevelEnum::LEVEL_DEFAULT;
              Severity: Major
              Found in src/Repository/Model/User.php - About 30 mins to fix

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

                    public static function save_mediaplay($user, $media): void
                    {
                        foreach (Plugin::get_plugins('save_mediaplay') as $plugin_name) {
                            try {
                                $plugin = new Plugin($plugin_name);
                Severity: Minor
                Found in src/Repository/Model/User.php - About 25 mins to fix

                Cognitive Complexity

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

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

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

                Further reading

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

                    public function upload_avatar(): bool
                    {
                        $upload = array();
                        if (!empty($_FILES['avatar']['tmp_name']) && $_FILES['avatar']['size'] <= AmpConfig::get('max_upload_size')) {
                            $path_info      = pathinfo($_FILES['avatar']['name']);
                Severity: Minor
                Found in src/Repository/Model/User.php - About 25 mins to fix

                Cognitive Complexity

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

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

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

                Further reading

                The method fix_preferences() has an NPath complexity of 216. The configured NPath complexity threshold is 200.
                Open

                    public static function fix_preferences($user_id): void
                    {
                        // Check default group (autoincrement starts at 1 so force it to be 0)
                        $sql        = "SELECT `id`, `name` FROM `catalog_filter_group` WHERE `name` = 'DEFAULT';";
                        $db_results = Dba::read($sql);
                Severity: Minor
                Found in src/Repository/Model/User.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 format() has an NPath complexity of 576. The configured NPath complexity threshold is 200.
                Open

                    public function format($details = true): void
                    {
                        if ($this->isNew()) {
                            return;
                        }
                Severity: Minor
                Found in src/Repository/Model/User.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 create() has an NPath complexity of 6144. The configured NPath complexity threshold is 200.
                Open

                    public static function create(
                        $username,
                        $fullname,
                        $email,
                        $website,
                Severity: Minor
                Found in src/Repository/Model/User.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 create has 11 parameters. Consider reducing the number of parameters to less than 10.
                Open

                    public static function create(
                        $username,
                        $fullname,
                        $email,
                        $website,
                Severity: Minor
                Found in src/Repository/Model/User.php by phpmd

                The method update() has an NPath complexity of 600. The configured NPath complexity threshold is 200.
                Open

                    public function update(array $data)
                    {
                        if (empty($data['username'])) {
                            AmpError::add('username', T_('Username is required'));
                        }
                Severity: Minor
                Found in src/Repository/Model/User.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 User has 1451 lines of code. Current threshold is 1000. Avoid really long classes.
                Open

                class User extends database_object
                {
                    /** @var int Defines the internal system user-id */
                    public const INTERNAL_SYSTEM_USER_ID = -1;
                
                
                Severity: Minor
                Found in src/Repository/Model/User.php by phpmd

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

                    public static function update_counts(): void
                    {
                        $catalog_disable = AmpConfig::get('catalog_disable');
                        $catalog_filter  = AmpConfig::get('catalog_filter');
                        $sql             = "SELECT `id` FROM `user`";
                Severity: Minor
                Found in src/Repository/Model/User.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 update() has a Cyclomatic Complexity of 20. The configured cyclomatic complexity threshold is 10.
                Open

                    public function update(array $data)
                    {
                        if (empty($data['username'])) {
                            AmpError::add('username', T_('Username is required'));
                        }
                Severity: Minor
                Found in src/Repository/Model/User.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 format() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10.
                Open

                    public function format($details = true): void
                    {
                        if ($this->isNew()) {
                            return;
                        }
                Severity: Minor
                Found in src/Repository/Model/User.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 create() has a Cyclomatic Complexity of 14. The configured cyclomatic complexity threshold is 10.
                Open

                    public static function create(
                        $username,
                        $fullname,
                        $email,
                        $website,
                Severity: Minor
                Found in src/Repository/Model/User.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 fix_preferences() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
                Open

                    public static function fix_preferences($user_id): void
                    {
                        // Check default group (autoincrement starts at 1 so force it to be 0)
                        $sql        = "SELECT `id`, `name` FROM `catalog_filter_group` WHERE `name` = 'DEFAULT';";
                        $db_results = Dba::read($sql);
                Severity: Minor
                Found in src/Repository/Model/User.php by phpmd

                CyclomaticComplexity

                Since: 0.1

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

                Example

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

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

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

                class User extends database_object
                {
                    /** @var int Defines the internal system user-id */
                    public const INTERNAL_SYSTEM_USER_ID = -1;
                
                
                Severity: Minor
                Found in src/Repository/Model/User.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 fix_preferences uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                Open

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

                        } else {
                            foreach (Plugin::get_plugins('get_avatar_url') as $plugin_name) {
                                $plugin = new Plugin($plugin_name);
                                if ($plugin->_plugin !== null && $plugin->load(Core::get_global('user'))) {
                                    $avatar['url'] = $plugin->_plugin->get_avatar_url($this);
                Severity: Minor
                Found in src/Repository/Model/User.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 update uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                Open

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

                            } else {
                                $this->ip_history = T_('Not Enough Data');
                            }
                Severity: Minor
                Found in src/Repository/Model/User.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 '404', column '13').
                Open

                    public function is_logged_in(): ?string
                    {
                        $sql = (AmpConfig::get('perpetual_api_session'))
                            ? "SELECT `id`, `ip` FROM `session` WHERE `username` = ? AND ((`expire` = 0 AND `type` = 'api') OR `expire` > ?);"
                            : "SELECT `id`, `ip` FROM `session` WHERE `username` = ? AND `expire` > ?;";
                Severity: Minor
                Found in src/Repository/Model/User.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_preferences uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                Open

                        } else {
                            $user_id = -1;
                            if ($type != '0') {
                                $user_limit = "AND `preference`.`category` = '" . Dba::escape($type) . "'";
                            }
                Severity: Minor
                Found in src/Repository/Model/User.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_f_link uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                Open

                            } else {
                                $this->f_link = '<a href="' . $this->get_link() . '">' . scrub_out($this->get_fullname()) . '</a>';
                            }
                Severity: Minor
                Found in src/Repository/Model/User.php by phpmd

                ElseExpression

                Since: 1.4.0

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

                Example

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

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

                FIXME found
                Open

                        /* Ok this is crappy, need to clean this up or improve the code FIXME */
                Severity: Minor
                Found in src/Repository/Model/User.php by fixme

                TODO found
                Open

                        // TODO $user_list[] = -1; // make sure the System / Guest user gets a count as well
                Severity: Minor
                Found in src/Repository/Model/User.php by fixme

                FIXME found
                Open

                        // FIXME why is manager not here? (AccessLevelEnum::LEVEL_CONTENT_MANAGER;)
                Severity: Minor
                Found in src/Repository/Model/User.php by fixme

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

                    public int $id = 0;
                Severity: Critical
                Found in src/Repository/Model/User.php by phan

                Avoid excessively long variable names like $user_create_streamtoken. Keep variable name length under 20.
                Open

                        $user_create_streamtoken = AmpConfig::get('user_create_streamtoken', false);
                Severity: Minor
                Found in src/Repository/Model/User.php by phpmd

                LongVariable

                Since: 0.2

                Detects when a field, formal or local variable is declared with a long name.

                Example

                class Something {
                    protected $reallyLongIntName = -3; // VIOLATION - Field
                    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                        $otherReallyLongName = -5; // VIOLATION - Local
                        for ($interestingIntIndex = 0; // VIOLATION - For
                             $interestingIntIndex < 10;
                             $interestingIntIndex++ ) {
                        }
                    }
                }

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

                The parameter $catalog_filter_group is not named in camelCase.
                Open

                    public static function create(
                        $username,
                        $fullname,
                        $email,
                        $website,
                Severity: Minor
                Found in src/Repository/Model/User.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

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

                    public int $id = 0;
                Severity: Minor
                Found in src/Repository/Model/User.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 $new_validation is not named in camelCase.
                Open

                    public function update_validation($new_validation)
                    {
                        $sql              = "UPDATE `user` SET `validation` = ?, `disabled`='1' WHERE `id` = ?";
                        $db_results       = Dba::write($sql, array($new_validation, $this->id));
                        $this->validation = $new_validation;
                Severity: Minor
                Found in src/Repository/Model/User.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 $needed_level is not named in camelCase.
                Open

                    public function has_access($needed_level): bool
                    {
                        if (AmpConfig::get('demo_mode')) {
                            return true;
                        }
                Severity: Minor
                Found in src/Repository/Model/User.php by phpmd

                CamelCaseParameterName

                Since: 0.2

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

                Example

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

                Source

                The parameter $user_id is not named in camelCase.
                Open

                    public static function fix_preferences($user_id): void
                    {
                        // Check default group (autoincrement starts at 1 so force it to be 0)
                        $sql        = "SELECT `id`, `name` FROM `catalog_filter_group` WHERE `name` = 'DEFAULT';";
                        $db_results = Dba::read($sql);
                Severity: Minor
                Found in src/Repository/Model/User.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_password is not named in camelCase.
                Open

                    public function update_password($new_password, $hashed_password = null): void
                    {
                        debug_event(self::class, 'Updating password', 1);
                        if (!$hashed_password) {
                            $hashed_password = hash('sha256', $new_password);
                Severity: Minor
                Found in src/Repository/Model/User.php by phpmd

                CamelCaseParameterName

                Since: 0.2

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

                Example

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

                Source

                The parameter $user_id is not named in camelCase.
                Open

                    public static function set_user_data(int $user_id, string $key, $value): void
                    {
                        Dba::write("REPLACE INTO `user_data` SET `user` = ?, `key` = ?, `value` = ?;", array($user_id, $key, $value));
                    }
                Severity: Minor
                Found in src/Repository/Model/User.php by phpmd

                CamelCaseParameterName

                Since: 0.2

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

                Example

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

                Source

                The parameter $user_id is not named in camelCase.
                Open

                    public static function get_user_data($user_id, $key = null, $default = null): array
                    {
                        $sql    = "SELECT `key`, `value` FROM `user_data` WHERE `user` = ?";
                        $params = array($user_id);
                        if ($key) {
                Severity: Minor
                Found in src/Repository/Model/User.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_state is not named in camelCase.
                Open

                    public function update_state($new_state): void
                    {
                        $sql = "UPDATE `user` SET `state` = ? WHERE `id` = ?";
                
                        debug_event(self::class, 'Updating state', 4);
                Severity: Minor
                Found in src/Repository/Model/User.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_city is not named in camelCase.
                Open

                    public function update_city($new_city): void
                    {
                        $sql = "UPDATE `user` SET `city` = ? WHERE `id` = ?";
                
                        debug_event(self::class, 'Updating city', 4);
                Severity: Minor
                Found in src/Repository/Model/User.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_email is not named in camelCase.
                Open

                    public function update_email($new_email): void
                    {
                        $sql = "UPDATE `user` SET `email` = ? WHERE `id` = ?";
                
                        debug_event(self::class, 'Updating email', 4);
                Severity: Minor
                Found in src/Repository/Model/User.php by phpmd

                CamelCaseParameterName

                Since: 0.2

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

                Example

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

                Source

                The parameter $user_id is not named in camelCase.
                Open

                    public static function get_user_catalogs($user_id, $filter = ''): array
                    {
                        if (parent::is_cached('user_catalog' . $filter, $user_id)) {
                            return parent::get_from_cache('user_catalog' . $filter, $user_id);
                        }
                Severity: Minor
                Found in src/Repository/Model/User.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_fullname is not named in camelCase.
                Open

                    public function update_fullname($new_fullname): void
                    {
                        $sql = "UPDATE `user` SET `fullname` = ? WHERE `id` = ?";
                
                        debug_event(self::class, 'Updating fullname', 4);
                Severity: Minor
                Found in src/Repository/Model/User.php by phpmd

                CamelCaseParameterName

                Since: 0.2

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

                Example

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

                Source

                The parameter $user_id is not named in camelCase.
                Open

                    public static function get_username($user_id): string
                    {
                        $users = static::getUserRepository()->getValidArray(true);
                
                        return (isset($users[$user_id]))
                Severity: Minor
                Found in src/Repository/Model/User.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 $count_type is not named in camelCase.
                Open

                    public function get_recently_played($type, $count, $offset = 0, $newest = true, $count_type = 'stream'): array
                    {
                        $ordersql = ($newest === true) ? 'DESC' : 'ASC';
                        $limit    = ($offset < 1) ? $count : $offset . "," . $count;
                
                
                Severity: Minor
                Found in src/Repository/Model/User.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_website is not named in camelCase.
                Open

                    public function update_website($new_website): void
                    {
                        $new_website = rtrim((string)$new_website, "/");
                        $sql         = "UPDATE `user` SET `website` = ? WHERE `id` = ?";
                
                
                Severity: Minor
                Found in src/Repository/Model/User.php by phpmd

                CamelCaseParameterName

                Since: 0.2

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

                Example

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

                Source

                The parameter $media_ids is not named in camelCase.
                Open

                    public static function stream_control($media_ids, ?User $user = null): bool
                    {
                        if ($user === null) {
                            $user = Core::get_global('user');
                            if (!$user instanceof User) {
                Severity: Minor
                Found in src/Repository/Model/User.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_all is not named in camelCase.
                Open

                    public function get_playlists($show_all): array
                    {
                        $results = array();
                        $sql     = ($show_all)
                            ? "SELECT `id` FROM `playlist` WHERE `user` = ? ORDER BY `name`;"
                Severity: Minor
                Found in src/Repository/Model/User.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_username is not named in camelCase.
                Open

                    public function update_username($new_username): void
                    {
                        $sql            = "UPDATE `user` SET `username` = ? WHERE `id` = ?";
                        $this->username = $new_username;
                
                
                Severity: Minor
                Found in src/Repository/Model/User.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_access is not named in camelCase.
                Open

                    public function update_access(int $new_access): bool
                    {
                        // There must always be at least one admin left if you're reducing access
                        if ($new_access < 100) {
                            $sql        = "SELECT `id` FROM `user` WHERE `access`='100' AND `id` != '$this->id'";
                Severity: Minor
                Found in src/Repository/Model/User.php by phpmd

                CamelCaseParameterName

                Since: 0.2

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

                Example

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

                Source

                The parameter $user_id is not named in camelCase.
                Open

                    public function __construct($user_id = 0)
                    {
                        if (!$user_id) {
                            return;
                        }
                Severity: Minor
                Found in src/Repository/Model/User.php by phpmd

                CamelCaseParameterName

                Since: 0.2

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

                Example

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

                Source

                The parameter $user_id is not named in camelCase.
                Open

                    private function has_info(int $user_id): array
                    {
                        if (User::is_cached('user', $user_id)) {
                            return User::get_from_cache('user', $user_id);
                        }
                Severity: Minor
                Found in src/Repository/Model/User.php by phpmd

                CamelCaseParameterName

                Since: 0.2

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

                Example

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

                Source

                The parameter $user_id is not named in camelCase.
                Open

                    public static function get_play_size($user_id): int
                    {
                        $params = array($user_id);
                        $total  = 0;
                        $sql_s  = "SELECT IFNULL(SUM(`size`)/1024/1024, 0) AS `size` FROM `object_count` LEFT JOIN `song` ON `song`.`id`=`object_count`.`object_id` AND `object_count`.`object_type` = 'song' AND `object_count`.`count_type` = 'stream' AND `object_count`.`user` = ?;";
                Severity: Minor
                Found in src/Repository/Model/User.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_fullname_public is not named in camelCase.
                Open

                    public function update_fullname_public($new_fullname_public): void
                    {
                        $sql = "UPDATE `user` SET `fullname_public` = ? WHERE `id` = ?";
                
                        debug_event(self::class, 'Updating fullname public', 4);
                Severity: Minor
                Found in src/Repository/Model/User.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 $hashed_password is not named in camelCase.
                Open

                    public function update_password($new_password, $hashed_password = null): void
                    {
                        debug_event(self::class, 'Updating password', 1);
                        if (!$hashed_password) {
                            $hashed_password = hash('sha256', $new_password);
                Severity: Minor
                Found in src/Repository/Model/User.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_filter is not named in camelCase.
                Open

                    public function update_catalog_filter_group($new_filter): void
                    {
                        $sql = "UPDATE `user` SET `catalog_filter_group` = ? WHERE `id` = ?";
                
                        debug_event(self::class, 'Updating catalog access group', 4);
                Severity: Minor
                Found in src/Repository/Model/User.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