bizley/yii2-podium

View on GitHub

Showing 223 of 419 total issues

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

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

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

    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 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

          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

          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

          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

          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

          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

              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

              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

              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

              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 actionNew has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                public function actionNew($user = null)
                {
                $podiumUser = User::findMe();
                 
                if (Message::tooMany($podiumUser->id)) {
                Severity: Major
                Found in src/controllers/MessagesController.php - About 2 hrs to fix
                  Severity
                  Category
                  Status
                  Source
                  Language