bizley/yii2-podium

View on GitHub

Showing 223 of 419 total issues

Method search has 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function search($params)
    {
        $subquery = (new Query())
                    ->select(['m2.replyto'])
                    ->from(['m1' => Message::tableName()])
Severity: Major
Found in src/models/MessageSearch.php - About 2 hrs to fix

    Method podiumNew has 61 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function podiumNew()
        {
            $transaction = static::getDb()->beginTransaction();
            try {
                if (!$this->save()) {
    Severity: Major
    Found in src/models/Thread.php - About 2 hrs to fix

      Method actionPost has 61 lines of code (exceeds 25 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: Major
      Found in src/controllers/ForumPostController.php - About 2 hrs to fix

        Function podiumNew has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

            public function podiumNew($previous = null)
            {
                $transaction = static::getDb()->beginTransaction();
                try {
                    $id = null;
        Severity: Minor
        Found in src/models/Post.php - About 2 hrs to fix

        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

        SchemaOperation has 22 functions (exceeds 20 allowed). Consider refactoring.
        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 - About 2 hrs to fix

          Method podiumNew has 58 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function podiumNew($previous = null)
              {
                  $transaction = static::getDb()->beginTransaction();
                  try {
                      $id = null;
          Severity: Major
          Found in src/models/Post.php - About 2 hrs to fix

            Function actionMods has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                public function actionMods($id = null)
                {
                    $mod = null;
                    $moderators = User::find()->where(['role' => User::ROLE_MODERATOR])->indexBy('id')->all();
                    if (is_numeric($id) && $id > 0) {
            Severity: Minor
            Found in src/controllers/AdminController.php - About 2 hrs to fix

            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 actionEditpoll has 56 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function actionEditpoll($cid = null, $fid = null, $tid = null, $pid = null)
                {
                    $poll = Poll::find()->joinWith('thread')->where([
                        Poll::tableName() . '.id' => $pid,
                        Poll::tableName() . '.thread_id' => $tid,
            Severity: Major
            Found in src/controllers/ForumController.php - About 2 hrs to fix

              Method actionMove has 56 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function actionMove($cid = null, $fid = null, $id = null, $slug = null)
                  {
                      $thread = (new ThreadVerifier([
                          'categoryId' => $cid,
                          'forumId' => $fid,
              Severity: Major
              Found in src/controllers/ForumThreadController.php - About 2 hrs to fix

                Method behaviors has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function behaviors()
                    {
                        return [
                            'access' => [
                                'class' => AccessControl::className(),
                Severity: Major
                Found in src/controllers/ForumController.php - About 2 hrs to fix

                  Method remove has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function remove()
                      {
                          $transaction = static::getDb()->beginTransaction();
                          try {
                              $clearCache = false;
                  Severity: Major
                  Found in src/models/Message.php - About 2 hrs to fix

                    Function actionEdit has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function actionEdit($cid = null, $fid = null, $tid = null, $pid = null)
                        {
                            $post = Post::verify($cid, $fid, $tid, $pid);
                            if (empty($post)) {
                                $this->error(Yii::t('podium/flash', 'Sorry! We can not find the post you are looking for.'));
                    Severity: Minor
                    Found in src/controllers/ForumPostController.php - About 2 hrs to fix

                    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 actionDeletepost has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function actionDeletepost($cid = null, $fid = null, $tid = null, $pid = null)
                        {
                            $post = Post::verify($cid, $fid, $tid, $pid);
                            if (empty($post)) {
                                $this->error(Yii::t('podium/flash', 'Sorry! We can not find the post you are looking for.'));
                    Severity: Minor
                    Found in src/controllers/ForumPostController.php - About 2 hrs to fix

                    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 getIcon has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function getIcon()
                        {
                            $icon   = self::ICON_NO_NEW;
                            $append = false;
                    
                    Severity: Minor
                    Found in src/models/Thread.php - About 2 hrs to fix

                    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 ProfileController.php has 252 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/ProfileController.php - About 2 hrs to fix

                      Method podiumThumb has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function podiumThumb($up = true, $count = 0)
                          {
                              $transaction = static::getDb()->beginTransaction();
                              try {
                                  $loggedId = User::loggedId();
                      Severity: Major
                      Found in src/models/Post.php - About 2 hrs to fix

                        Method actionAdvancedSearch has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function actionAdvancedSearch()
                            {
                                $dataProvider = null;
                                $list = [];
                        
                        Severity: Minor
                        Found in src/controllers/ForumController.php - About 2 hrs to fix

                          Method actionForum has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function actionForum()
                              {
                                  $user = User::findMe();
                                  $model = Meta::find()->where(['user_id' => $user->id])->limit(1)->one();
                                  if (empty($model)) {
                          Severity: Minor
                          Found in src/controllers/ProfileController.php - About 1 hr to fix

                            Method podiumReport has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function podiumReport($post = null)
                                {
                                    try {
                                        if (empty($post)) {
                                            throw new Exception('Reported post missing');
                            Severity: Minor
                            Found in src/models/Message.php - About 1 hr to fix

                              Method actionEdit has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function actionEdit($cid = null, $fid = null, $tid = null, $pid = null)
                                  {
                                      $post = Post::verify($cid, $fid, $tid, $pid);
                                      if (empty($post)) {
                                          $this->error(Yii::t('podium/flash', 'Sorry! We can not find the post you are looking for.'));
                              Severity: Minor
                              Found in src/controllers/ForumPostController.php - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language