Showing 72 of 153 total issues
Function updateOnlineStatus
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function updateOnlineStatus($action)
{
//Timed JS function
//fetch current user list and add update statistics
//js to Update it for a time
- 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 actionUpdatePoll
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function actionUpdatePoll($id) {
$poll = YBoardPoll::findOne($id);
if($poll === null) {
throw new NotFoundHttpException(YBoard::t('yboard', 'The requested poll 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
File _post.php
has 252 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/* @var $this ForumController */
/* @var $model YBoardPost */
/* @var $postId integer */
Method actionCreate
has 48 lines of code (exceeds 25 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.'));
Method actionQuote
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionQuote($id) {
if(!Yii::$app->user->can('app.forum.forum.quote'))
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.'));
$quoted = YBoardPost::findOne($id);
Method actionIndex
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionIndex()
{
$NumberOfTopics = YBoardSetting::find()->where(['key'=>'latest_topic'])->one();
$NumberOfReplies = YBoardSetting::find()->where(['key'=>'latest_reply'])->one();
Function actionForum
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function actionForum($id) {
$forum = $this->findModel($id);
if(Yii::$app->user->isGuest && $forum->public == 0) {
throw new ForbiddenHttpException(YBoard::t('yboard', 'You have no permission to view requested forum.'));
- 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 actionQuote
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function actionQuote($id) {
if(!Yii::$app->user->can('app.forum.forum.quote'))
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.'));
$quoted = YBoardPost::findOne($id);
- 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 actionReply
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function actionReply($id) {
if(!Yii::$app->user->can('app.forum.forum.reply'))
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 forumIsRead
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function forumIsRead($forum_id) {
if(Yii::$app->user->isGuest) {
return false;
} else {
$models = YBoardTopic::find()
- 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 actionForum
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionForum($id) {
$forum = $this->findModel($id);
if(Yii::$app->user->isGuest && $forum->public == 0) {
throw new ForbiddenHttpException(YBoard::t('yboard', 'You have no permission to view requested forum.'));
Method updateOnlineStatus
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function updateOnlineStatus($action)
{
//Timed JS function
//fetch current user list and add update statistics
//js to Update it for a time
Method actionReply
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionReply($id) {
if(!Yii::$app->user->can('app.forum.forum.reply'))
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 search
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function search($params)
{
$query = YBoardMember::find();
$dataProvider = new ActiveDataProvider([
Method actionVote
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionVote() {
if(!Yii::$app->user->can('app.forum.forum.vote'))
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.'));
$json = [];
Method actionSendReport
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionSendReport() {
if(!Yii::$app->user->can('app.forum.message.send-report'))
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.'));
$json = [];
Method actionUpdate
has 36 lines of code (exceeds 25 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.'));
}
Method actionDelete
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionDelete($id) {
if(!Yii::$app->user->can('app.forum.moderator.delete-post'))
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.'));
if(isset($_GET['id']))
Function actionVote
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function actionVote() {
if(!Yii::$app->user->can('app.forum.forum.vote'))
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.'));
$json = [];
- 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 actionDelete
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function actionDelete($id) {
if(!Yii::$app->user->can('app.forum.moderator.delete-post'))
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.'));
if(isset($_GET['id']))
- 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"