bizley/yii2-podium

View on GitHub
src/models/User.php

Summary

Maintainability
F
4 days
Test Coverage

File User.php has 625 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace bizley\podium\models;

use bizley\podium\db\Query;
Severity: Major
Found in src/models/User.php - About 1 day to fix

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

    class User extends UserActiveRecord
    {
        /**
         * Roles.
         */
    Severity: Minor
    Found in src/models/User.php - About 5 hrs to fix

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

      class User extends UserActiveRecord
      {
          /**
           * Roles.
           */
      Severity: Minor
      Found in src/models/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 an overall complexity of 137 which is very high. The configured complexity threshold is 50.
      Open

      class User extends UserActiveRecord
      {
          /**
           * Roles.
           */
      Severity: Minor
      Found in src/models/User.php by phpmd

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

          public static function updateInheritedAccount()
          {
              if (!Podium::getInstance()->user->isGuest) {
                  $userNameField = Podium::getInstance()->userNameField;
                  if ($userNameField === null) {
      Severity: Minor
      Found in src/models/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 updateModeratorForMany has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function updateModeratorForMany($newForums = [], $oldForums = [])
          {
              $transaction = static::getDb()->beginTransaction();
              try {
                  $add = [];
      Severity: Minor
      Found in src/models/User.php - About 1 hr to fix

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

        class User extends UserActiveRecord
        {
            /**
             * Roles.
             */
        Severity: Minor
        Found in src/models/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 updateModeratorForMany has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            public function updateModeratorForMany($newForums = [], $oldForums = [])
            {
                $transaction = static::getDb()->beginTransaction();
                try {
                    $add = [];
        Severity: Minor
        Found in src/models/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 demoteTo has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function demoteTo($role)
            {
                $transaction = static::getDb()->beginTransaction();
                try {
                    $this->scenario = 'role';
        Severity: Minor
        Found in src/models/User.php - About 1 hr to fix

          Function can has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function can($permissionName, $params = [], $allowCaching = true)
              {
                  if (Podium::getInstance()->userComponent === true) {
                      return Podium::getInstance()->user->can($permissionName, $params, $allowCaching);
                  }
          Severity: Minor
          Found in src/models/User.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 updateIgnore has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public function updateIgnore($member)
              {
                  try {
                      if ($this->isIgnoredBy($member)) {
                          if (!Podium::getInstance()->db->createCommand()->delete('{{%podium_user_ignore}}', [
          Severity: Minor
          Found in src/models/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

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

              public function activate()
              {
                  if ($this->status == self::STATUS_REGISTERED) {
                      $transaction = static::getDb()->beginTransaction();
                      try {
          Severity: Minor
          Found in src/models/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

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

              public function updateFriend($friend)
              {
                  try {
                      if ($this->isBefriendedBy($friend)) {
                          if (!Podium::getInstance()->db->createCommand()->delete('{{%podium_user_friend}}', [
          Severity: Minor
          Found in src/models/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

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

              public static function createInheritedAccount()
              {
                  if (!Podium::getInstance()->user->isGuest) {
                      $transaction = static::getDb()->beginTransaction();
                      try {
          Severity: Minor
          Found in src/models/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

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

              public static function getMembersList($query = null)
              {
                  if (null === $query || !is_string($query)) {
                      return Json::encode(['results' => []]);
                  }
          Severity: Minor
          Found in src/models/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

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

              public static function friendsList()
              {
                  if (Podium::getInstance()->user->isGuest) {
                      return null;
                  }
          Severity: Minor
          Found in src/models/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 false;
          Severity: Major
          Found in src/models/User.php - About 30 mins to fix

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

                protected function generateUsername()
                {
                    $userNameField = Podium::getInstance()->userNameField;
                    if ($userNameField !== null) {
                        if (empty(Podium::getInstance()->user->identity->$userNameField)) {
            Severity: Minor
            Found in src/models/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 demoteTo has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                public function demoteTo($role)
                {
                    $transaction = static::getDb()->beginTransaction();
                    try {
                        $this->scenario = 'role';
            Severity: Minor
            Found in src/models/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 updateModeratorForMany() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10.
            Open

                public function updateModeratorForMany($newForums = [], $oldForums = [])
                {
                    $transaction = static::getDb()->beginTransaction();
                    try {
                        $add = [];
            Severity: Minor
            Found in src/models/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 24. Consider to reduce the number of dependencies under 13.
            Open

            class User extends UserActiveRecord
            {
                /**
                 * Roles.
                 */
            Severity: Minor
            Found in src/models/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 getPodiumTag has a boolean flag argument $simple, which is a certain sign of a Single Responsibility Principle violation.
            Open

                public function getPodiumTag($simple = false)
            Severity: Minor
            Found in src/models/User.php by phpmd

            BooleanArgumentFlag

            Since: 1.4.0

            A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

            Example

            class Foo {
                public function bar($flag = true) {
                }
            }

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

            The method can has a boolean flag argument $allowCaching, which is a certain sign of a Single Responsibility Principle violation.
            Open

                public static function can($permissionName, $params = [], $allowCaching = true)
            Severity: Minor
            Found in src/models/User.php by phpmd

            BooleanArgumentFlag

            Since: 1.4.0

            A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

            Example

            class Foo {
                public function bar($flag = true) {
                }
            }

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

            Avoid unused private fields such as '$_access'.
            Open

                private $_access = [];
            Severity: Minor
            Found in src/models/User.php by phpmd

            UnusedPrivateField

            Since: 0.2

            Detects when a private field is declared and/or assigned a value, but not used.

            Example

            class Something
            {
                private static $FOO = 2; // Unused
                private $i = 5; // Unused
                private $j = 6;
                public function addOne()
                {
                    return $this->j++;
                }
            }

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

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

                        if ($this->isIgnoredBy($member)) {
                            if (!Podium::getInstance()->db->createCommand()->delete('{{%podium_user_ignore}}', [
                                    'user_id' => $member,
                                    'ignored_id' => $this->id
                                ])->execute()) {
            Severity: Major
            Found in src/models/User.php and 1 other location - About 3 hrs to fix
            src/models/User.php on lines 849..862

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 144.

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

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

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

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

            Refactorings

            Further Reading

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

                        if ($this->isBefriendedBy($friend)) {
                            if (!Podium::getInstance()->db->createCommand()->delete('{{%podium_user_friend}}', [
                                    'user_id' => $friend,
                                    'friend_id' => $this->id
                                ])->execute()) {
            Severity: Major
            Found in src/models/User.php and 1 other location - About 3 hrs to fix
            src/models/User.php on lines 819..832

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 144.

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

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

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

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

            Refactorings

            Further Reading

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

                public function getNewMessagesCount()
                {
                    $cache = Podium::getInstance()->podiumCache->getElement('user.newmessages', $this->id);
                    if ($cache === false) {
                        $cache = (new Query())->from(MessageReceiver::tableName())->where([
            Severity: Major
            Found in src/models/User.php and 1 other location - About 1 hr to fix
            src/models/User.php on lines 317..328

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 112.

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

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

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

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

            Refactorings

            Further Reading

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

                public function getSubscriptionsCount()
                {
                    $cache = Podium::getInstance()->podiumCache->getElement('user.subscriptions', $this->id);
                    if ($cache === false) {
                        $cache = (new Query)->from(Subscription::tableName())->where([
            Severity: Major
            Found in src/models/User.php and 1 other location - About 1 hr to fix
            src/models/User.php on lines 186..197

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 112.

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

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

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

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

            Refactorings

            Further Reading

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

                public static function findPostsCount($id)
                {
                    $cache = Podium::getInstance()->podiumCache->getElement('user.postscount', $id);
                    if ($cache === false) {
                        $cache = (new Query)->from(Post::tableName())->where(['author_id' => $id])->count();
            Severity: Major
            Found in src/models/User.php and 1 other location - About 1 hr to fix
            src/models/User.php on lines 265..273

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 102.

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

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

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

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

            Refactorings

            Further Reading

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

                public static function findThreadsCount($id)
                {
                    $cache = Podium::getInstance()->podiumCache->getElement('user.threadscount', $id);
                    if ($cache === false) {
                        $cache = (new Query)->from(Thread::tableName())->where(['author_id' => $id])->count();
            Severity: Major
            Found in src/models/User.php and 1 other location - About 1 hr to fix
            src/models/User.php on lines 241..249

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 102.

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

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

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

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

            Refactorings

            Further Reading

            The parameter $user_id is not named in camelCase.
            Open

                public function isIgnoring($user_id)
                {
                    if ((new Query)->select('id')->from('{{%podium_user_ignore}}')->where([
                            'user_id' => $this->id,
                            'ignored_id' => $user_id
            Severity: Minor
            Found in src/models/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 variable $user_id is not named in camelCase.
            Open

                public function isIgnoring($user_id)
                {
                    if ((new Query)->select('id')->from('{{%podium_user_ignore}}')->where([
                            'user_id' => $this->id,
                            'ignored_id' => $user_id
            Severity: Minor
            Found in src/models/User.php by phpmd

            CamelCaseVariableName

            Since: 0.2

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

            Example

            class ClassName {
                public function doSomething() {
                    $data_module = new DataModule();
                }
            }

            Source

            There are no issues that match your filters.

            Category
            Status