bizley/yii2-podium

View on GitHub

Showing 223 of 419 total issues

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

    public function actionPost($cid = null, $fid = null, $tid = null, $pid = null)
    {
        $thread = Thread::find()->where([
                'id' => $tid,
                'category_id' => $cid,
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

Function podiumMovePostsTo has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    public function podiumMovePostsTo($target = null, $posts = [], $name = null, $forum = null)
    {
        $transaction = static::getDb()->beginTransaction();
        try {
            if ($target == 0) {
Severity: Minor
Found in src/models/Thread.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 Installation.php has 290 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace bizley\podium\maintenance;

use bizley\podium\models\Content;
Severity: Minor
Found in src/maintenance/Installation.php - About 2 hrs to fix

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

        public function init()
        {
            parent::init();
            try {
                if (!empty($this->module->accessChecker)) {
    Severity: Minor
    Found in src/controllers/BaseController.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

    Method actionThumb has 72 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

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

      Method markSeen has 71 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

        Method podiumMovePostsTo has 69 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function podiumMovePostsTo($target = null, $posts = [], $name = null, $forum = null)
            {
                $transaction = static::getDb()->beginTransaction();
                try {
                    if ($target == 0) {
        Severity: Major
        Found in src/models/Thread.php - About 2 hrs to fix

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

              public function export()
              {
                  $tableName = Podium::getInstance()->db->quoteTableName($this->logTable);
                  $sql = "INSERT INTO $tableName ([[level]], [[category]], [[log_time]], [[ip]], [[message]], [[model]], [[user]])
                          VALUES (:level, :category, :log_time, :ip, :message, :model, :user)";
          Severity: Minor
          Found in src/log/DbTarget.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 podiumEdit has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

              public function podiumEdit()
              {
                  $transaction = static::getDb()->beginTransaction();
                  try {
                      if (!$this->save()) {
          Severity: Minor
          Found in src/models/Poll.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 actionDetails has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

              public function actionDetails()
              {
                  $model = User::findMe();
                  if (empty($model)) {
                      return $this->redirect(['account/login']);
          Severity: Minor
          Found in src/controllers/ProfileController.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 prepareQuery has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function prepareQuery($query, $topics = false)
              {
                  $field = $topics
                          ? Thread::tableName() . '.created_at'
                          : Post::tableName() . '.updated_at';
          Severity: Minor
          Found in src/models/forms/SearchForm.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 actionMove has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

              public function actionMove($cid = null, $fid = null, $id = null, $slug = null)
              {
                  $thread = (new ThreadVerifier([
                      'categoryId' => $cid,
                      'forumId' => $fid,
          Severity: Minor
          Found in src/controllers/ForumThreadController.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

          Method search has 68 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function search($params)
              {
                  $subquery = (new Query())
                              ->select(['m2.replyto'])
                              ->from(['m1' => Message::tableName()])
          Severity: Major
          Found in src/models/MessageReceiver.php - About 2 hrs to fix

            File SchemaOperation.php has 279 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            
            namespace bizley\podium\maintenance;
            
            use bizley\podium\Podium;
            Severity: Minor
            Found in src/maintenance/SchemaOperation.php - About 2 hrs to fix

              Function notify has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function notify($thread)
                  {
                      if (is_numeric($thread) && $thread > 0) {
                          $forum = Podium::getInstance()->podiumConfig->get('name');
                          $email = Content::fill(Content::EMAIL_SUBSCRIPTION);
              Severity: Minor
              Found in src/models/Subscription.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 actionPoll has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function actionPoll()
                  {
                      if (!Yii::$app->request->isAjax) {
                          return $this->redirect(['forum/index']);
                      }
              Severity: Minor
              Found in src/controllers/ForumController.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 getDescription has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function getDescription()
                  {
                      $description = Yii::t('podium/view', 'No New Posts');
                      $append = false;
              
              Severity: Minor
              Found in src/models/Thread.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 actionLoad has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function actionLoad()
                  {
                      if (!Yii::$app->request->isAjax) {
                          return $this->redirect(['forum/index']);
                      }
              Severity: Minor
              Found in src/controllers/MessagesController.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

              Method behaviors has 64 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function behaviors()
                  {
                      return [
                          'access' => [
                              'class' => AccessControl::className(),
              Severity: Major
              Found in src/controllers/AdminController.php - About 2 hrs to fix

                Method search has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function search($params)
                    {
                        $subquery = (new Query())
                                    ->select(['m2.replyto'])
                                    ->from(['m1' => Message::tableName()])
                Severity: Major
                Found in src/models/MessageSearch.php - About 2 hrs to fix
                  Severity
                  Category
                  Status
                  Source
                  Language