bizley/yii2-podium

View on GitHub

Showing 223 of 419 total issues

Function updateInheritedAccount has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public static function updateInheritedAccount()
    {
        if (!Podium::getInstance()->user->isGuest) {
            $userNameField = Podium::getInstance()->userNameField;
            if ($userNameField === null) {
Severity: Minor
Found in src/models/User.php - About 1 hr 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 actionDeletepoll has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
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,
Severity: Minor
Found in src/controllers/ForumController.php - About 1 hr 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 actionIgnore has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function actionIgnore($id = null)
    {
        if (Podium::getInstance()->user->isGuest) {
            return $this->redirect(['forum/index']);
        }
Severity: Minor
Found in src/controllers/MembersController.php - About 1 hr to fix

    Method podiumDelete has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function podiumDelete()
        {
            $transaction = static::getDb()->beginTransaction();
            try {
                if (!$this->delete()) {
    Severity: Minor
    Found in src/models/Post.php - About 1 hr to fix

      Method updateModeratorForMany has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function updateModeratorForMany($newForums = [], $oldForums = [])
          {
              $transaction = static::getDb()->beginTransaction();
              try {
                  $add = [];
      Severity: Minor
      Found in src/models/User.php - About 1 hr to fix

        Method nextStep has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        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->versionSteps));
        Severity: Minor
        Found in src/maintenance/Update.php - About 1 hr to fix

          Method updateWords has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function updateWords()
              {
                  try {
                      $vocabulary = [];
                      $allWords = $this->prepareWords();
          Severity: Minor
          Found in src/models/Post.php - About 1 hr to fix

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

                public function actionForum($cid = null, $id = null, $slug = null, $toggle = null)
                {
                    $filters = Yii::$app->session->get('forum-filters');
                    if (in_array(strtolower($toggle), ['new', 'edit', 'hot', 'pin', 'lock', 'all'])) {
                        if (strtolower($toggle) == 'all') {
            Severity: Minor
            Found in src/controllers/ForumController.php - About 1 hr to fix

              Method getIcon has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

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

                Function update has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function update($data)
                    {
                        $validator = new StringValidator();
                        $validator->max = 255;
                
                
                Severity: Minor
                Found in src/models/forms/ConfigForm.php - About 1 hr 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 podiumReport has a Cognitive Complexity of 10 (exceeds 5 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

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

                    public static function timeZones()
                    {
                        $timeZones = [];
                
                        $timezone_identifiers = DateTimeZone::listIdentifiers();
                Severity: Minor
                Found in src/helpers/Helper.php - About 1 hr 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 getMods has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getMods()
                    {
                        $mods = Podium::getInstance()->podiumCache->getElement('forum.moderators', $this->id);
                        if ($mods === false) {
                            $mods = [];
                Severity: Minor
                Found in src/models/Forum.php - About 1 hr 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 updateModeratorForMany has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function updateModeratorForMany($newForums = [], $oldForums = [])
                    {
                        $transaction = static::getDb()->beginTransaction();
                        try {
                            $add = [];
                Severity: Minor
                Found in src/models/User.php - About 1 hr 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 actionAdd has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function actionAdd($id = null)
                    {
                        if (!Yii::$app->request->isAjax) {
                            return $this->redirect(['forum/index']);
                        }
                Severity: Minor
                Found in src/controllers/ProfileController.php - About 1 hr 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 actionBan has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                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.'));
                Severity: Minor
                Found in src/controllers/AdminController.php - About 1 hr 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 actionLoad has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function actionLoad()
                    {
                        if (!Yii::$app->request->isAjax) {
                            return $this->redirect(['forum/index']);
                        }
                Severity: Minor
                Found in src/controllers/MessagesController.php - About 1 hr to fix

                  Method demoteTo has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function demoteTo($role)
                      {
                          $transaction = static::getDb()->beginTransaction();
                          try {
                              $this->scenario = 'role';
                  Severity: Minor
                  Found in src/models/User.php - About 1 hr to fix

                    Method notify has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public static function notify($thread)
                        {
                            if (is_numeric($thread) && $thread > 0) {
                                $forum = Podium::getInstance()->podiumConfig->get('name');
                                $email = Content::fill(Content::EMAIL_SUBSCRIPTION);
                    Severity: Minor
                    Found in src/models/Subscription.php - About 1 hr to fix

                      Method actionFriend has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function actionFriend($id = null)
                          {
                              if (Podium::getInstance()->user->isGuest) {
                                  return $this->redirect(['forum/index']);
                              }
                      Severity: Minor
                      Found in src/controllers/MembersController.php - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language