Showing 72 of 153 total issues
Method actionUpvote
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionUpvote() {
if(!Yii::$app->user->can('app.forum.forum.upvote'))
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 beforeAction
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function beforeAction($action)
{
if (parent::beforeAction($action)) {
//update users online information
Method attributeLabels
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function attributeLabels()
{
return [
'id' => YBoard::t('yboard', 'Member'),
'location' => YBoard::t('yboard', 'Location'),
Method actionTopic
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionTopic() {
if(!Yii::$app->user->can('app.forum.moderator.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.'));
$json = [];
Method resetLastPost
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function resetLastPost() {
$forum = YBoardForum::find()->where(['last_post_id'=>$this->id])->one();
$topic = YBoardTopic::find()->where(['last_post_id'=>$this->id])->one();
if($forum !== null) {
Function actionChangeBanPeriod
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function actionChangeBanPeriod($id)
{
if(!Yii::$app->user->can('app.forum.moderator.change-ban-period'))
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
Method actionUpdatePoll
has 27 lines of code (exceeds 25 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.'));
}
Method actionChangePost
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionChangePost()
{
if(!Yii::$app->user->can('app.forum.moderator.change-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.'));
Method actionApprovePost
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionApprovePost($id)
{
if(!Yii::$app->user->can('app.forum.moderator.approve-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.'));
Method getForumOptions
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getForumOptions($isGuest, $uid) {
$return = [];
$category = YBoardForum::find()
->where(['type'=>0])
->orderBy('sort')
Method actionChangeBanPeriod
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionChangeBanPeriod($id)
{
if(!Yii::$app->user->can('app.forum.moderator.change-ban-period'))
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 actionApproveTopic
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionApproveTopic($id)
{
if(!Yii::$app->user->can('app.forum.moderator.approve-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.'));
Function topicIsRead
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function topicIsRead($topic_id) {
if(Yii::$app->user->isGuest) {
return false;
} else {
$topicLog = YBoardLogTopic::findOne(['member_id'=>Yii::$app->user->id, 'topic_id'=>$topic_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 actionTopic
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function actionTopic() {
if(!Yii::$app->user->can('app.forum.moderator.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.'));
$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 sendNotifications
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function sendNotifications($postModel)
{
$query = new \yii\db\Query;
$rows = $query->select('user_id')
->from('YBoardPost')
- 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 actionSaveRank
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function actionSaveRank() {
if(!Yii::$app->user->can('app.forum.setting.save-rank'))
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 userTimestamp
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
static public function userTimestamp($timestamp) {
if(!is_numeric($timestamp)) //skip for unix timestamps
{
$dt = new DateTime($timestamp);
$timestamp = $dt->getTimestamp();
- 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 actionIndex
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function actionIndex()
{
$NumberOfTopics = YBoardSetting::find()->where(['key'=>'latest_topic'])->one();
$NumberOfReplies = YBoardSetting::find()->where(['key'=>'latest_reply'])->one();
- 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 actionSaveMembergroup
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function actionSaveMembergroup() {
if(!Yii::$app->user->can('app.forum.setting.save-membergroup'))
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 actionSaveSpider
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function actionSaveSpider() {
if(!Yii::$app->user->can('app.forum.setting.save-spider'))
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"