Showing 223 of 419 total issues
Method searchPosts
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function searchPosts()
{
$query = Vocabulary::find()->select('post_id, thread_id')->joinWith(['posts.author', 'posts.thread'])->andWhere(['is not', 'post_id', null]);
if (Podium::getInstance()->user->isGuest) {
$query->joinWith(['posts.forum' => function ($q) {
Method actionRegister
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function actionRegister()
{
if ($this->module->userComponent !== true) {
$this->info(Yii::t('podium/flash', "Please use application's Register form to sign up."));
return $this->module->goPodium();
Method getDescription
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getDescription()
{
$description = Yii::t('podium/view', 'No New Posts');
$append = false;
Method prepareQuery
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function prepareQuery($query, $topics = false)
{
$field = $topics
? Thread::tableName() . '.created_at'
: Post::tableName() . '.updated_at';
Method actionReply
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function actionReply($id = null)
{
$podiumUser = User::findMe();
if (Message::tooMany($podiumUser->id)) {
Consider simplifying this complex logical expression. Open
Open
if (!is_numeric($categoryId) || $categoryId < 1
|| !is_numeric($forumId) || $forumId < 1
|| !is_numeric($threadId) || $threadId < 1
|| !is_numeric($id) || $id < 1) {
return null;
Method searchTopics
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function searchTopics()
{
$query = Thread::find();
if (Podium::getInstance()->user->isGuest) {
$query->joinWith(['forum' => function ($q) {
Method defaultContent
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function defaultContent($name = null)
{
$defaults = [
self::EMAIL_REACTIVATION => [
'topic' => Yii::t('podium/view', '{forum} account reactivation'),
Method nextStep
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function nextStep()
{
$currentStep = Yii::$app->session->get(self::SESSION_KEY, 0);
if ($currentStep === 0) {
Yii::$app->session->set(self::SESSION_STEPS, count($this->steps));
Method nextDrop
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function nextDrop()
{
$drops = $this->countDrops();
if (count($drops)) {
$currentStep = Yii::$app->session->get(self::SESSION_KEY, 0);
Method actionBan
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function actionBan($id = null)
{
$model = User::find()->where(['id' => $id])->limit(1)->one();
if (empty($model)) {
$this->error(Yii::t('podium/flash', 'Sorry! We can not find Member with this ID.'));
Method clearAfter
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function clearAfter($what)
{
$cache = new static;
switch ($what) {
Method addConfig
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function addConfig()
{
try {
$this->db->createCommand()->batchInsert(
PodiumConfig::tableName(),
Method actionShow
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function actionShow($id = null)
{
if (!is_numeric($id) || $id < 1) {
$this->error(Yii::t('podium/flash', 'Sorry! We can not find the post you are looking for.'));
return $this->redirect(['forum/index']);
Method actionRun
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function actionRun($limit = 0)
{
$version = $this->module->version;
$this->stdout("\nPodium mail queue v{$version}\n");
$this->stdout("------------------------------\n");
Method run
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function run()
{
$user = $this->user;
if (empty($user)) {
return [
Method run
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function run()
{
$user = $this->getUser(User::STATUS_REGISTERED);
if (empty($user)) {
return [
Method run
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function run()
{
$avatar = Html::img(Helper::defaultAvatar(), [
'class' => 'podium-avatar img-circle img-responsive center-block',
'alt' => Yii::t('podium/view', 'user deleted')
Method actionDelete
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function actionDelete($cid = null, $fid = null, $id = null, $slug = null)
{
$thread = (new ThreadVerifier([
'categoryId' => $cid,
'forumId' => $fid,
Function actionDeletepoll
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
public function actionDeletepoll($cid = null, $fid = null, $tid = null, $pid = null)
{
$poll = Poll::find()->joinWith('thread')->where([
Poll::tableName() . '.id' => $pid,
Poll::tableName() . '.thread_id' => $tid,
- 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"