bizley/yii2-podium

View on GitHub

Showing 419 of 419 total issues

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

class User extends UserActiveRecord
{
/**
* Roles.
*/
Severity: Minor
Found in src/models/User.php by phpmd

The class AdminForumController has 16 public methods. Consider refactoring AdminForumController to keep number of public methods under 10.
Open

class AdminForumController extends BaseController
{
/**
* @inheritdoc
*/

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

class User extends UserActiveRecord
{
/**
* Roles.
*/
Severity: Minor
Found in src/models/User.php by phpmd

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

class AdminForumController extends BaseController
{
/**
* @inheritdoc
*/

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

class SchemaOperation extends Component
{
const TYPE_SUCCESS = 0;
const TYPE_WARNING = 1;
const TYPE_ERROR = 2;
Severity: Minor
Found in src/maintenance/SchemaOperation.php by phpmd

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

class Post extends PostActiveRecord
{
/**
* Returns latest posts for registered users.
* @param int $limit Number of latest posts.
Severity: Minor
Found in src/models/Post.php by phpmd

The class Thread has 11 public methods. Consider refactoring Thread to keep number of public methods under 10.
Open

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

The class ForumController has 15 public methods. Consider refactoring ForumController to keep number of public methods under 10.
Open

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

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

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

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

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

    public static function roleLabel($role = null)
    {
    switch ($role) {
    case User::ROLE_ADMIN:
    $label = 'danger';
    Severity: Major
    Found in src/helpers/Helper.php and 1 other location - About 3 hrs to fix
    src/helpers/Helper.php on lines 220..237

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

    public static function statusLabel($status = null)
    {
    switch ($status) {
    case User::STATUS_ACTIVE:
    $label = 'info';
    Severity: Major
    Found in src/helpers/Helper.php and 1 other location - About 3 hrs to fix
    src/helpers/Helper.php on lines 176..193

    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

    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

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

    if ($this->isBefriendedBy($friend)) {
    if (!Podium::getInstance()->db->createCommand()->delete('{{%podium_user_friend}}', [
    'user_id' => $friend,
    'friend_id' => $this->id
    ])->execute()) {
    Severity: Major
    Found in src/models/User.php and 1 other location - About 3 hrs to fix
    src/models/User.php on lines 819..832

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

    if ($this->isIgnoredBy($member)) {
    if (!Podium::getInstance()->db->createCommand()->delete('{{%podium_user_ignore}}', [
    'user_id' => $member,
    'ignored_id' => $this->id
    ])->execute()) {
    Severity: Major
    Found in src/models/User.php and 1 other location - About 3 hrs to fix
    src/models/User.php on lines 849..862

    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

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

    protected function dropIndex($name)
    {
    if (empty($name)) {
    return Yii::t('podium/flash', 'Installation aborted! Index 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 255..272

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

    protected function dropForeign($name)
    {
    if (empty($name)) {
    return Yii::t('podium/flash', 'Installation aborted! Foreign key 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 279..296

    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
      Severity
      Category
      Status
      Source
      Language