bizley/yii2-podium

View on GitHub

Showing 223 of 419 total issues

Function actionDeleteposts has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function actionDeleteposts($cid = null, $fid = null, $id = null, $slug = null)
    {
        $thread = (new ThreadVerifier([
            'categoryId' => $cid,
            'forumId' => $fid,
Severity: Minor
Found in src/controllers/ForumPostController.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 actionReply has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function actionReply($id = null)
    {
        $podiumUser = User::findMe();

        if (Message::tooMany($podiumUser->id)) {
Severity: Minor
Found in src/controllers/MessagesController.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 reformRun has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    protected function reformRun($componentInfo, $model, $log, $view)
    {
        if ($this->module->userComponent !== true) {
            $this->info($componentInfo);
            return $this->module->goPodium();
Severity: Minor
Found in src/controllers/AccountController.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 actionNewThread has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function actionNewThread($cid = null, $fid = null)
    {
        if (!User::can(Rbac::PERM_CREATE_THREAD)) {
            $this->error(Yii::t('podium/flash', 'Sorry! You do not have the required permission to perform this action.'));
            return $this->redirect(['forum/index']);
Severity: Minor
Found in src/controllers/ForumThreadController.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 maintenanceCheck has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function maintenanceCheck($action, $warnings)
    {
        if ($this->module->podiumConfig->get('maintenance_mode') != '1') {
            return false;
        }
Severity: Minor
Found in src/controllers/BaseController.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 send has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

    Method process has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function process($email, $fromName, $fromEmail, $maxAttempts)
        {
            try {
                if ($this->send($email, $fromName, $fromEmail)) {
                    $this
    Severity: Minor
    Found in src/console/QueueController.php - About 1 hr to fix

      Method actionSortCategory has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

        Method actionMods has 37 lines of code (exceeds 25 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 1 hr to fix

          Method podiumEdit has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

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

            Method lastActive has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function lastActive()
                {
                    $last = Podium::getInstance()->podiumCache->get('forum.lastactive');
                    if ($last === false) {
                        $time = time() - 15 * 60;
            Severity: Minor
            Found in src/models/Activity.php - About 1 hr to fix

              Method init has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function init()
                  {
                      parent::init();
                      try {
                          if (!empty($this->module->accessChecker)) {
              Severity: Minor
              Found in src/controllers/BaseController.php - About 1 hr to fix

                Method run has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function run()
                    {
                        $url = Yii::$app->request->getUrl();
                
                        $out = '';
                Severity: Minor
                Found in src/widgets/Readers.php - About 1 hr to fix

                  Method addAdmin has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function addAdmin()
                      {
                          if ($this->module->userComponent !== true) {
                              return $this->addInheritedAdmin();
                          }
                  Severity: Minor
                  Found in src/maintenance/Installation.php - About 1 hr to fix

                    Function set has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function set($name, $value)
                        {
                            try {
                                if (is_string($name) && (is_string($value) || $value === null)) {
                                    if ($value === null) {
                    Severity: Minor
                    Found in src/PodiumConfig.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 podiumDelete has a Cognitive Complexity of 12 (exceeds 5 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

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

                        public static function tooMany($userId)
                        {
                            $sessionKey = 'messages.' . $userId;
                            if (Yii::$app->session->has($sessionKey)) {
                                $sentAlready = explode('|', Yii::$app->session->get($sessionKey));
                    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 actionEditpoll has a Cognitive Complexity of 12 (exceeds 5 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: 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

                    Function matchRole has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function matchRole($user)
                        {
                            if (empty($this->roles)) {
                                return true;
                            }
                    Severity: Minor
                    Found in src/filters/PodiumRoleRule.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 upgradeCheck has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function upgradeCheck($warnings)
                        {
                            if (!User::can(Rbac::ROLE_ADMIN)) {
                                return false;
                            }
                    Severity: Minor
                    Found in src/controllers/BaseController.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

                    Severity
                    Category
                    Status
                    Source
                    Language