Showing 72 of 153 total issues
File ForumController.php
has 802 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace app\modules\yboard\controllers;
use Yii;
Function actionCreateTopic
has a Cognitive Complexity of 70 (exceeds 5 allowed). Consider refactoring. Open
public function actionCreateTopic()
{
if(!Yii::$app->user->can('app.forum.forum.create-topic'))
throw new ForbiddenHttpException(YBoard::t('yboard', 'You have no enough permission to access this page! If you think its a mistake, please consider reporting to us.'));
- Read upRead up
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 ModeratorController.php
has 430 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace app\modules\yboard\controllers;
use app\modules\yboard\YBoard;
File SettingController.php
has 404 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace app\modules\yboard\controllers;
use app\modules\yboard\YBoard;
File profile.php
has 378 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
use yii\helpers\Html;
use yii\helpers\Url;
use yii\widgets\DetailView;
File profile.php
has 378 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
use yii\helpers\Html;
use yii\helpers\Url;
use yii\widgets\DetailView;
Function actionChangeTopic
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
public function actionChangeTopic()
{
if(!Yii::$app->user->can('app.forum.moderator.change-topic'))
throw new ForbiddenHttpException(YBoard::t('yboard', 'You have no enough permission to access this page! If you think its a mistake, please consider reporting to us.'));
- Read upRead up
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 actionTopic
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
public function actionTopic($id, $nav = null, $postId = null) {
$topic = YBoardTopic::findOne($id);
if($topic === null) {
throw new NotFoundHttpException(YBoard::t('yboard', 'The requested topic does not exist.'));
}
- Read upRead up
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 actionTopic
has 92 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionTopic($id, $nav = null, $postId = null) {
$topic = YBoardTopic::findOne($id);
if($topic === null) {
throw new NotFoundHttpException(YBoard::t('yboard', 'The requested topic does not exist.'));
}
Method actionCreateTopic
has 92 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionCreateTopic()
{
if(!Yii::$app->user->can('app.forum.forum.create-topic'))
throw new ForbiddenHttpException(YBoard::t('yboard', 'You have no enough permission to access this page! If you think its a mistake, please consider reporting to us.'));
File yboard.js
has 313 lines of code (exceeds 250 allowed). Consider refactoring. Open
function showAppreciation(members)
{
$("#appreciated-content").html(unescape(members));
$("#dlg-appreciated").dialog('open');
Function getForumOptions
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public static function getForumOptions($isGuest, $uid) {
$return = [];
$category = YBoardForum::find()
->where(['type'=>0])
->orderBy('sort')
- Read upRead up
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
SettingController
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
class SettingController extends \yii\web\Controller
{
public $layout = "admin";
public function init()
ForumController
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class ForumController extends \yii\web\Controller
{
public $poll;
public $choiceProvider;
File ybsetting.js
has 268 lines of code (exceeds 250 allowed). Consider refactoring. Open
/** Sorting function
* @param obj HtmlElement Object
* @param url string
*/
function Sort(obj, url) {
Method actionChangeTopic
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionChangeTopic()
{
if(!Yii::$app->user->can('app.forum.moderator.change-topic'))
throw new ForbiddenHttpException(YBoard::t('yboard', 'You have no enough permission to access this page! If you think its a mistake, please consider reporting to us.'));
Method sendNotifications
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function sendNotifications($postModel)
{
$query = new \yii\db\Query;
$rows = $query->select('user_id')
->from('YBoardPost')
YBoardMember
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class YBoardMember extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
Function actionCreate
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function actionCreate()
{
if(!Yii::$app->user->can('app.forum.message.create'))
throw new ForbiddenHttpException(YBoard::t('yboard', 'You have no enough permission to access this page! If you think its a mistake, please consider reporting to us.'));
- Read upRead up
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 actionUpdate
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function actionUpdate($id) {
$post = YBoardPost::findOne($id);
if($post === null) {
throw new NotFoundException(404, YBoard::t('yboard', 'The requested post does not exist.'));
}
- Read upRead up
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"