bizley/yii2-podium

View on GitHub

Showing 419 of 419 total issues

Function createInheritedAccount has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function createInheritedAccount()
    {
        if (!Podium::getInstance()->user->isGuest) {
            $transaction = static::getDb()->beginTransaction();
            try {
Severity: Minor
Found in src/models/User.php - About 35 mins 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 friendsList has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function friendsList()
    {
        if (Podium::getInstance()->user->isGuest) {
            return null;
        }
Severity: Minor
Found in src/models/User.php - About 35 mins 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 compareVersions has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function compareVersions($a, $b)
    {
        $versionPos = max(count($a), count($b));
        while (count($a) < $versionPos) {
            $a[] = 0;
Severity: Minor
Found in src/helpers/Helper.php - About 35 mins 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 searchPosts has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
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) {
Severity: Minor
Found in src/models/forms/SearchForm.php - About 35 mins 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 actionReport has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function actionReport($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 35 mins 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 getMembersList has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getMembersList($query = null)
    {
        if (null === $query || !is_string($query)) {
            return Json::encode(['results' => []]);
        }
Severity: Minor
Found in src/models/User.php - About 35 mins 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 activate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function activate()
    {
        if ($this->status == self::STATUS_REGISTERED) {
            $transaction = static::getDb()->beginTransaction();
            try {
Severity: Minor
Found in src/models/User.php - About 35 mins 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 updateIgnore has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function updateIgnore($member)
    {
        try {
            if ($this->isIgnoredBy($member)) {
                if (!Podium::getInstance()->db->createCommand()->delete('{{%podium_user_ignore}}', [
Severity: Minor
Found in src/models/User.php - About 35 mins 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 updateFriend has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function updateFriend($friend)
    {
        try {
            if ($this->isBefriendedBy($friend)) {
                if (!Podium::getInstance()->db->createCommand()->delete('{{%podium_user_friend}}', [
Severity: Minor
Found in src/models/User.php - About 35 mins 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 run has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
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')
Severity: Minor
Found in src/widgets/Avatar.php - About 35 mins 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 run has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function run()
    {
        $url = Yii::$app->request->getUrl();

        $out = '';
Severity: Minor
Found in src/widgets/Readers.php - About 35 mins 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 actionSettings has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function actionSettings()
    {
        $model = new ConfigForm();
        $data = Yii::$app->request->post('ConfigForm');
        if ($data) {
Severity: Minor
Found in src/controllers/AdminForumController.php - About 35 mins 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

Avoid too many return statements within this method.
Open

                    return Json::encode($data);
Severity: Major
Found in src/controllers/ForumController.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

            return Json::encode($data);
    Severity: Major
    Found in src/controllers/ForumController.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

              return false;
      Severity: Major
      Found in src/models/User.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                        return $this->module->goPodium();
        Severity: Major
        Found in src/controllers/AccountController.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return [
                      false,
                      Yii::t('podium/flash', 'The password reset link has been sent to your e-mail address.'),
                      true
                  ];
          Severity: Major
          Found in src/models/forms/ResetForm.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                    return $this->controller->redirect(['admin/members']);
            Severity: Major
            Found in src/actions/AdminAction.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                                  return $this->redirect(['forum/thread',
                                      'cid' => $poll->thread->forum->category->id,
                                      'fid' => $poll->thread->forum->id,
                                      'id' => $poll->thread->id,
                                      'slug' => $poll->thread->slug
              Severity: Major
              Found in src/controllers/ForumController.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                        return false;
                Severity: Major
                Found in src/filters/PodiumRoleRule.php - About 30 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language