rhosocial/yii2-organization

View on GitHub

Showing 63 of 816 total issues

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

    public function revokeRole($role)
    {
        $user = $this->memberUser;
        if (!$user) {
            throw new InvalidValueException('Invalid User');
Severity: Minor
Found in Member.php - About 1 hr to fix

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

        protected function initVisibleButtons()
        {
            if (!empty($this->visibleButtons)) {
                return;
            }
    Severity: Minor
    Found in grid/OrganizationListActionColumn.php - About 1 hr to fix

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

          public function revokeAdministrator()
          {
              $host = $this->organization;
              /* @var $host Organization */
              if ($this->isCreator()) {
      Severity: Minor
      Found in Member.php - About 1 hr to fix

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

            public function run($org)
            {
                $organization = Module::getOrganization($org);
                $user = Yii::$app->user->identity;
                static::checkAccess($organization, $user);
        Severity: Minor
        Found in web/organization/controllers/my/MemberAction.php - About 1 hr to fix

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

              public function run($id)
              {
                  $organization = Module::getOrganization($id);
                  $user = Yii::$app->user->identity;
                  static::checkAccess($organization, $user);
          Severity: Minor
          Found in web/organization/controllers/my/SettingsAction.php - About 1 hr to fix

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

                public function assignAdministrator()
                {
                    $host = $this->organization;
                    /* @var $host Organization */
                    if ($this->isCreator()) {
            Severity: Minor
            Found in Member.php - About 1 hr to fix

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

                  protected function initDefaultButtons()
                  {
                      $this->initDefaultButton('view', false);
                      $this->initDefaultButton('member', false, [
                          'title' => Yii::t('organization', 'Member'),
              Severity: Minor
              Found in grid/OrganizationListActionColumn.php - About 1 hr to fix

                Method createBaseOrganization has 8 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    protected function createBaseOrganization($name, $parent = null, $nickname = '', $gravatar_type = 0, $gravatar = '', $timezone = 'UTC', $description = '', $type = Organization::TYPE_ORGANIZATION)
                Severity: Major
                Found in UserOrganizationTrait.php - About 1 hr to fix

                  Function run has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function run($parent)
                      {
                          $model = new SetUpForm(['user' => Yii::$app->user->identity, 'parent' => $parent]);
                          if (!$model->getParent()) {
                              throw new BadRequestHttpException(Yii::t('organization', 'Parent Organization/Department Not Exist.'));
                  Severity: Minor
                  Found in web/organization/controllers/my/SetUpDepartmentAction.php - About 55 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

                  Method createOrganization has 7 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      public function createOrganization($name, $parent = null, $nickname = '', $gravatar_type = 0, $gravatar = '', $timezone = 'UTC', $description = '')
                  Severity: Major
                  Found in UserOrganizationTrait.php - About 50 mins to fix

                    Method createDepartment has 7 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        public function createDepartment($name, $parent = null, $nickname = '', $gravatar_type = 0, $gravatar = '', $timezone = 'UTC', $description = '')
                    Severity: Major
                    Found in UserOrganizationTrait.php - About 50 mins to fix

                      Method setUpDepartment has 7 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          public function setUpDepartment($name, $parent, $nickname = '', $gravatar_type = 0, $gravatar = '', $timezone = 'UTC', $description = '')
                      Severity: Major
                      Found in UserOrganizationTrait.php - About 50 mins to fix

                        Function run has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function run($parent)
                            {
                                $model = new SetUpForm(['user' => Yii::$app->user->identity, 'parent' => $parent]);
                                if (!$model->getParent()) {
                                    throw new BadRequestHttpException(Yii::t('organization', 'Parent Organization/Department Not Exist.'));
                        Severity: Minor
                        Found in web/user/controllers/organization/SetUpDepartmentAction.php - About 45 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 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function run($id)
                            {
                                $organization = Module::getOrganization($id);
                                $user = Yii::$app->user->identity;
                                static::checkAccess($organization, $user);
                        Severity: Minor
                        Found in web/organization/controllers/my/SettingsAction.php - About 45 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 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function run()
                            {
                                $user = Yii::$app->user->identity;
                                if ($user->hasReachedOrganizationLimit()) {
                                    throw new NumberOfOrganizationsExceededException();
                        Severity: Minor
                        Found in web/organization/controllers/my/SetUpOrganizationAction.php - About 45 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 revokeOrganization has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function revokeOrganization($organization, $revokeIfHasChildren = true)
                            {
                                if (!($organization instanceof $this->organizationClass))
                                {
                                    $class = $this->organizationClass;
                        Severity: Minor
                        Found in UserOrganizationTrait.php - About 45 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 initUrlCreator has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            protected function initUrlCreator()
                            {
                                if (isset($this->urlCreator)) {
                                    return;
                                }
                        Severity: Minor
                        Found in grid/OrganizationListActionColumn.php - About 45 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 actionJoin has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function actionJoin($entrance)
                            {
                                $organization = static::getOrganization($entrance);
                                $user = Yii::$app->user->identity;
                                if ($organization->creator->equals($user)) {
                        Severity: Minor
                        Found in web/organization/controllers/JoinController.php - About 45 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

                        Method setUpOrganization has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            public function setUpOrganization($name, $nickname = '', $gravatar_type = 0, $gravatar = '', $timezone = 'UTC', $description = '')
                        Severity: Minor
                        Found in UserOrganizationTrait.php - About 45 mins to fix

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

                              public function revokeRole($role)
                              {
                                  $user = $this->memberUser;
                                  if (!$user) {
                                      throw new InvalidValueException('Invalid User');
                          Severity: Minor
                          Found in Member.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

                          Severity
                          Category
                          Status
                          Source
                          Language