bizley/yii2-podium

View on GitHub

Showing 223 of 419 total issues

Function markSeen has a Cognitive Complexity of 77 (exceeds 5 allowed). Consider refactoring.
Open

    public function markSeen($updateCounters = true)
    {
        if (!Podium::getInstance()->user->isGuest) {
            $transaction = static::getDb()->beginTransaction();
            try {
Severity: Minor
Found in src/models/Post.php - About 1 day to fix

Cognitive Complexity

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

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

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

Further reading

File 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

    Function actionMoveposts has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
    Open

        public function actionMoveposts($cid = null, $fid = null, $id = null, $slug = null)
        {
            $thread = (new ThreadVerifier([
                'categoryId' => $cid,
                'forumId' => $fid,
    Severity: Minor
    Found in src/controllers/ForumPostController.php - About 1 day to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function actionForum has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
    Open

        public function actionForum()
        {
            $user = User::findMe();
            $model = Meta::find()->where(['user_id' => $user->id])->limit(1)->one();
            if (empty($model)) {
    Severity: Minor
    Found in src/controllers/ProfileController.php - About 1 day to fix

    Cognitive Complexity

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

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

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

    Further reading

    File ForumController.php has 516 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    namespace bizley\podium\controllers;
    
    use bizley\podium\db\Query;
    Severity: Major
    Found in src/controllers/ForumController.php - About 1 day to fix

      Method add has 207 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function add(DbManager $authManager)
          {
              $viewThread = $authManager->getPermission(self::PERM_VIEW_THREAD);
              if (!($viewThread instanceof Permission)) {
                  $viewThread = $authManager->createPermission(self::PERM_VIEW_THREAD);
      Severity: Major
      Found in src/rbac/Rbac.php - About 1 day to fix

        File Thread.php has 491 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        namespace bizley\podium\models;
        
        use bizley\podium\log\Log;
        Severity: Minor
        Found in src/models/Thread.php - About 7 hrs to fix

          Function actionNew has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
          Open

              public function actionNew($user = null)
              {
                  $podiumUser = User::findMe();
          
                  if (Message::tooMany($podiumUser->id)) {
          Severity: Minor
          Found in src/controllers/MessagesController.php - About 7 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

          File ForumPostController.php has 466 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
          namespace bizley\podium\controllers;
          
          use bizley\podium\filters\AccessControl;
          Severity: Minor
          Found in src/controllers/ForumPostController.php - About 7 hrs to fix

            File Post.php has 462 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            
            namespace bizley\podium\models;
            
            use bizley\podium\db\Query;
            Severity: Minor
            Found in src/models/Post.php - About 7 hrs to fix

              Function actionAdvancedSearch has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function actionAdvancedSearch()
                  {
                      $dataProvider = null;
                      $list = [];
              
              Severity: Minor
              Found in src/controllers/ForumController.php - About 6 hrs to fix

              Cognitive Complexity

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

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

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

              Further reading

              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

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

                    public function podiumThumb($up = true, $count = 0)
                    {
                        $transaction = static::getDb()->beginTransaction();
                        try {
                            $loggedId = User::loggedId();
                Severity: Minor
                Found in src/models/Post.php - About 4 hrs to fix

                Cognitive Complexity

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

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

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

                Further reading

                UserActiveRecord has 34 functions (exceeds 20 allowed). Consider refactoring.
                Open

                abstract class UserActiveRecord extends ActiveRecord implements IdentityInterface
                {
                    /**
                     * Statuses.
                     */
                Severity: Minor
                Found in src/models/db/UserActiveRecord.php - About 4 hrs to fix

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

                      public function add(DbManager $authManager)
                      {
                          $viewThread = $authManager->getPermission(self::PERM_VIEW_THREAD);
                          if (!($viewThread instanceof Permission)) {
                              $viewThread = $authManager->createPermission(self::PERM_VIEW_THREAD);
                  Severity: Minor
                  Found in src/rbac/Rbac.php - About 4 hrs to fix

                  Cognitive Complexity

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

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

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

                  Further reading

                  Method actionMoveposts has 95 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function actionMoveposts($cid = null, $fid = null, $id = null, $slug = null)
                      {
                          $thread = (new ThreadVerifier([
                              'categoryId' => $cid,
                              'forumId' => $fid,
                  Severity: Major
                  Found in src/controllers/ForumPostController.php - About 3 hrs to fix

                    Method actionPoll has 90 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function actionPoll()
                        {
                            if (!Yii::$app->request->isAjax) {
                                return $this->redirect(['forum/index']);
                            }
                    Severity: Major
                    Found in src/controllers/ForumController.php - About 3 hrs to fix

                      Function actionThumb has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function actionThumb()
                          {
                              if (!Yii::$app->request->isAjax) {
                                  return $this->redirect(['forum/index']);
                              }
                      Severity: Minor
                      Found in src/controllers/ForumPostController.php - About 3 hrs to fix

                      Cognitive Complexity

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

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

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

                      Further reading

                      File AdminForumController.php has 305 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      <?php
                      
                      namespace bizley\podium\controllers;
                      
                      use bizley\podium\filters\AccessControl;
                      Severity: Minor
                      Found in src/controllers/AdminForumController.php - About 3 hrs to fix

                        Function remove has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function remove()
                            {
                                $transaction = static::getDb()->beginTransaction();
                                try {
                                    $clearCache = false;
                        Severity: Minor
                        Found in src/models/Message.php - About 3 hrs to fix

                        Cognitive Complexity

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

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

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

                        Further reading

                        Severity
                        Category
                        Status
                        Source
                        Language