plugins/user/modules/yf_register.class.php

Summary

Maintainability
C
1 day
Test Coverage

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

    public function confirm()
    {
        // Send registration confirmation email
        if ( ! $this->CONFIRM_REGISTER) {
            return tpl()->parse('@object/confirm_messages', ['msg' => 'confirm_not_needed']);
Severity: Minor
Found in plugins/user/modules/yf_register.class.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 confirm has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function confirm()
    {
        // Send registration confirmation email
        if ( ! $this->CONFIRM_REGISTER) {
            return tpl()->parse('@object/confirm_messages', ['msg' => 'confirm_not_needed']);
Severity: Minor
Found in plugins/user/modules/yf_register.class.php - About 1 hr to fix

    Method resend_code has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function resend_code()
        {
            if ( ! empty($_POST['email'])) {
                $user_info = db()->query_fetch('SELECT * FROM ' . db('user') . ' WHERE email="' . _es($_POST['email']) . '"');
                if (empty($user_info)) {
    Severity: Minor
    Found in plugins/user/modules/yf_register.class.php - About 1 hr to fix

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

          public function resend_code()
          {
              if ( ! empty($_POST['email'])) {
                  $user_info = db()->query_fetch('SELECT * FROM ' . db('user') . ' WHERE email="' . _es($_POST['email']) . '"');
                  if (empty($user_info)) {
      Severity: Minor
      Found in plugins/user/modules/yf_register.class.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 show has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function show()
          {
              $validate_rules = [
                  '__form_id__' => 'register_form',
                  'login' => ['trim|required|min_length[2]|max_length[12]|ajax_is_unique[user.login]|xss_clean', function ($in) {
      Severity: Minor
      Found in plugins/user/modules/yf_register.class.php - About 1 hr to fix

        Avoid too many return statements within this method.
        Open

                    return tpl()->parse('@object/confirm_messages', ['msg' => 'confirm_success']);
        Severity: Major
        Found in plugins/user/modules/yf_register.class.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return $body;
          Severity: Major
          Found in plugins/user/modules/yf_register.class.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                    return tpl()->parse('@object/resend_code', $replace);
            Severity: Major
            Found in plugins/user/modules/yf_register.class.php - About 30 mins to fix

              There are no issues that match your filters.

              Category
              Status