bizley/yii2-podium

View on GitHub

Showing 419 of 419 total issues

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

if (preg_match('/^(forum|orum|rum|um|m)?#([0-9]+)$/', strtolower($this->receiverName), $matches)) {
$dataProvider->query->joinWith(['messageReceivers' => function($q) use ($matches) {
$q->joinWith(['receiver' => function ($q) use ($matches) {
$q->andFilterWhere(['and',
[User::tableName() . '.id' => $matches[2]],
Severity: Major
Found in src/models/MessageSearch.php and 1 other location - About 1 day to fix
src/models/MessageReceiver.php on lines 112..145

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

if (preg_match('/^(forum|orum|rum|um|m)?#([0-9]+)$/', strtolower($this->senderName), $matches)) {
$dataProvider->query->joinWith(['message' => function ($q) use ($matches) {
$q->joinWith(['sender' => function ($q) use ($matches) {
$q->andFilterWhere(['and',
[User::tableName() . '.id' => $matches[2]],
Severity: Major
Found in src/models/MessageReceiver.php and 1 other location - About 1 day to fix
src/models/MessageSearch.php on lines 71..104

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

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

    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

    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

          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

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

              [
              'class' => ActionColumn::className(),
              'template' => '{view}' . (!Podium::getInstance()->user->isGuest ? ' {pm}' : ''),
              'buttons' => [
              'view' => function($url, $model) {
              Severity: Major
              Found in src/views/members/index.php and 1 other location - About 6 hrs to fix
              src/views/members/mods.php on lines 64..82

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

              [
              'class' => ActionColumn::className(),
              'template' => '{view}' . (!Podium::getInstance()->user->isGuest ? ' {pm}' : ''),
              'buttons' => [
              'view' => function($url, $model) {
              Severity: Major
              Found in src/views/members/mods.php and 1 other location - About 6 hrs to fix
              src/views/members/index.php on lines 78..96

              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

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

                <?php if (!empty($query) && !empty($author)): ?>
                <?= Yii::t('podium/view', 'Search for {type} with "{query}" by "{author}"', ['query' => Html::encode($query), 'author' => Html::encode($author), 'type' => $typeName]) ?>
                <?php elseif (!empty($query) && empty($author)): ?>
                <?= Yii::t('podium/view', 'Search for {type} with "{query}"', ['query' => Html::encode($query), 'type' => $typeName]) ?>
                <?php elseif (empty($query) && !empty($author)): ?>
                Severity: Major
                Found in src/views/elements/search/_forum_search_topics.php and 1 other location - About 5 hrs to fix
                src/views/elements/search/_forum_search_posts.php on lines 18..26

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

                <?php if (!empty($query) && !empty($author)): ?>
                <?= Yii::t('podium/view', 'Search for {type} with "{query}" by "{author}"', ['query' => Html::encode($query), 'author' => Html::encode($author), 'type' => $typeName]) ?>
                <?php elseif (!empty($query) && empty($author)): ?>
                <?= Yii::t('podium/view', 'Search for {type} with "{query}"', ['query' => Html::encode($query), 'type' => $typeName]) ?>
                <?php elseif (empty($query) && !empty($author)): ?>
                Severity: Major
                Found in src/views/elements/search/_forum_search_posts.php and 1 other location - About 5 hrs to fix
                src/views/elements/search/_forum_search_topics.php on lines 18..26

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

                protected function sendReactivationEmail(User $user)
                {
                $forum = Podium::getInstance()->podiumConfig->get('name');
                $email = Content::fill(Content::EMAIL_REACTIVATION);
                if ($email !== false) {
                Severity: Major
                Found in src/models/forms/ReactivateForm.php and 1 other location - About 5 hrs to fix
                src/models/forms/ResetForm.php on lines 99..114

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

                protected function sendResetEmail(User $user)
                {
                $forum = Podium::getInstance()->podiumConfig->get('name');
                $email = Content::fill(Content::EMAIL_PASSWORD);
                if ($email !== false) {
                Severity: Major
                Found in src/models/forms/ResetForm.php and 1 other location - About 5 hrs to fix
                src/models/forms/ReactivateForm.php on lines 99..114
                Severity
                Category
                Status
                Source
                Language