bizley/yii2-podium

View on GitHub

Showing 419 of 419 total issues

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

<?php if ($display === false && ($model->author_id == $loggedId || User::can(Rbac::PERM_UPDATE_POST, ['item' => $model->thread]))): ?>
<ul class="podium-action-bar list-inline">
<li>
<a href="<?= Url::to(['forum/editpoll', 'cid' => $model->thread->category_id, 'fid' => $model->thread->forum_id, 'tid' => $model->thread_id, 'pid' => $model->id]) ?>" class="btn btn-info btn-xs <?= $model->votesCount ? 'disabled text-muted' : '' ?>" data-toggle="tooltip" data-placement="top" title="<?= Yii::t('podium/view', 'Edit Poll') ?>">
<span class="glyphicon glyphicon-edit"></span>
Severity: Major
Found in src/widgets/poll/views/view.php and 1 other location - About 4 hrs to fix
src/widgets/poll/views/view.php on lines 61..74

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

<?php if ($display === false && ($model->author_id == $loggedId || User::can(Rbac::PERM_UPDATE_POST, ['item' => $model->thread]))): ?>
<ul class="podium-action-bar list-inline">
<li>
<a href="<?= Url::to(['forum/editpoll', 'cid' => $model->thread->category_id, 'fid' => $model->thread->forum_id, 'tid' => $model->thread_id, 'pid' => $model->id]) ?>" class="btn btn-info btn-xs <?= $model->votesCount ? 'disabled text-muted' : '' ?>" data-toggle="tooltip" data-placement="top" title="<?= Yii::t('podium/view', 'Edit Poll') ?>">
<span class="glyphicon glyphicon-edit"></span>
Severity: Major
Found in src/widgets/poll/views/view.php and 1 other location - About 4 hrs to fix
src/widgets/poll/views/view.php on lines 107..120

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

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

<?php
 
/**
* Podium Module
* Yii 2 Forum Module
Severity: Major
Found in src/views/account/reactivate.php and 1 other location - About 4 hrs to fix
src/views/account/reset.php on lines 1..33

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

<?php
 
/**
* Podium Module
* Yii 2 Forum Module
Severity: Major
Found in src/views/account/reset.php and 1 other location - About 4 hrs to fix
src/views/account/reactivate.php on lines 1..33

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

    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

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

      if (!($admin instanceof Role)) {
      $admin = $authManager->createRole(self::ROLE_ADMIN);
      $authManager->add($admin);
      $authManager->addChild($admin, $deleteUser);
      $authManager->addChild($admin, $promoteUser);
      Severity: Major
      Found in src/rbac/Rbac.php and 1 other location - About 3 hrs to fix
      src/rbac/Rbac.php on lines 193..206

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

      if (!($moderator instanceof Role)) {
      $moderator = $authManager->createRole(self::ROLE_MODERATOR);
      $authManager->add($moderator);
      $authManager->addChild($moderator, $updatePost);
      $authManager->addChild($moderator, $updateThread);
      Severity: Major
      Found in src/rbac/Rbac.php and 1 other location - About 3 hrs to fix
      src/rbac/Rbac.php on lines 272..285

      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

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

        protected function alterColumn($col, $type)
        {
        if (empty($col)) {
        return Yii::t('podium/flash', 'Installation aborted! Column name missing.');
        }
        Severity: Major
        Found in src/maintenance/SchemaOperation.php and 1 other location - About 3 hrs to fix
        src/maintenance/SchemaOperation.php on lines 75..91

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

        protected function addColumn($col, $type)
        {
        if (empty($col)) {
        return Yii::t('podium/flash', 'Installation aborted! Column name missing.');
        }
        Severity: Major
        Found in src/maintenance/SchemaOperation.php and 1 other location - About 3 hrs to fix
        src/maintenance/SchemaOperation.php on lines 166..182

        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

        The class UserActiveRecord has an overall complexity of 57 which is very high. The configured complexity threshold is 50.
        Open

        abstract class UserActiveRecord extends ActiveRecord implements IdentityInterface
        {
        /**
        * Statuses.
        */
        Severity: Minor
        Found in src/models/db/UserActiveRecord.php by phpmd

        The class Helper has 14 public methods. Consider refactoring Helper to keep number of public methods under 10.
        Open

        class Helper
        {
        /**
        * Prepares content for categories administration.
        * @param mixed $category
        Severity: Minor
        Found in src/helpers/Helper.php by phpmd

        The class ProfileController has an overall complexity of 52 which is very high. The configured complexity threshold is 50.
        Open

        class ProfileController extends BaseController
        {
        /**
        * @inheritdoc
        */
        Severity: Minor
        Found in src/controllers/ProfileController.php by phpmd

        The class Thread has an overall complexity of 104 which is very high. The configured complexity threshold is 50.
        Open

        class Thread extends ThreadActiveRecord
        {
        /**
        * Color classes.
        */
        Severity: Minor
        Found in src/models/Thread.php by phpmd

        The class ForumPostController has an overall complexity of 91 which is very high. The configured complexity threshold is 50.
        Open

        class ForumPostController extends ForumThreadController
        {
        /**
        * @inheritdoc
        */

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

        abstract class UserActiveRecord extends ActiveRecord implements IdentityInterface
        {
        /**
        * Statuses.
        */
        Severity: Minor
        Found in src/models/db/UserActiveRecord.php by phpmd
        Severity
        Category
        Status
        Source
        Language