rhosocial/yii2-organization

View on GitHub

Showing 63 of 816 total issues

File Organization.php has 625 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 *  _   __ __ _____ _____ ___  ____  _____
 * | | / // // ___//_  _//   ||  __||_   _|
Severity: Major
Found in Organization.php - About 1 day to fix

    Organization has 60 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Organization extends User
    {
        use SelfBlameableTrait;
    
        const TYPE_ORGANIZATION = 1;
    Severity: Major
    Found in Organization.php - About 1 day to fix

      Member has 27 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Member extends BaseBlameableModel
      {
          public $createdByAttribute = 'organization_guid';
          public $updatedByAttribute = false;
          public $hostClass = Organization::class;
      Severity: Minor
      Found in Member.php - About 3 hrs to fix

        Function addMember has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

            public function addMember(&$member)
            {
                if ($this->getIsNewRecord()) {
                    return false;
                }
        Severity: Minor
        Found in Organization.php - About 2 hrs 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

        File Member.php has 279 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        /**
         *  _   __ __ _____ _____ ___  ____  _____
         * | | / // // ___//_  _//   ||  __||_   _|
        Severity: Minor
        Found in Member.php - About 2 hrs to fix

          Method search has 66 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function search($params)
              {
                  $query = $this->query;
                  $dataProvider = new ActiveDataProvider([
                      'query' => $query,
          Severity: Major
          Found in MemberSearch.php - About 2 hrs to fix

            File UserOrganizationTrait.php has 270 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            
            /**
             *  _   __ __ _____ _____ ___  ____  _____
             * | | / // // ___//_  _//   ||  __||_   _|
            Severity: Minor
            Found in UserOrganizationTrait.php - About 2 hrs to fix

              Method search has 58 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function search($params)
                  {
                      $query = $this->query;
                      $dataProvider = new ActiveDataProvider([
                          'query' => $query,
              Severity: Major
              Found in OrganizationSearch.php - About 2 hrs to fix

                Function actionAssignSetUpOrganization has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function actionAssignSetUpOrganization($user, $limit = 1)
                    {
                        $user = $this->getUser($user);
                        $permission = new SetUpOrganization();
                        $limit = is_numeric($limit) ? (int) $limit : 1;
                Severity: Minor
                Found in console/controllers/OrganizationController.php - About 2 hrs 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 addMember has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function addMember(&$member)
                    {
                        if ($this->getIsNewRecord()) {
                            return false;
                        }
                Severity: Minor
                Found in Organization.php - About 1 hr to fix

                  Function submit has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function submit()
                      {
                          try {
                              if ($this->organization->isOrganization()) {
                                  if ($this->exclude_other_members != ($this->organization->isExcludeOtherMembers ? '1' : '0')) {
                  Severity: Minor
                  Found in forms/SettingsForm.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 actionAssignSetUpOrganization has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function actionAssignSetUpOrganization($user, $limit = 1)
                      {
                          $user = $this->getUser($user);
                          $permission = new SetUpOrganization();
                          $limit = is_numeric($limit) ? (int) $limit : 1;
                  Severity: Minor
                  Found in console/controllers/OrganizationController.php - About 1 hr to fix

                    Method actions has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function actions()
                        {
                            return [
                                'index' => [
                                    'class' => 'rhosocial\organization\web\organization\controllers\my\IndexAction',
                    Severity: Minor
                    Found in web/organization/controllers/MyController.php - About 1 hr to fix

                      Method behaviors has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function behaviors()
                          {
                              return [
                                  'access' => [
                                      'class' => AccessControl::class,
                      Severity: Minor
                      Found in web/organization/controllers/MyController.php - About 1 hr to fix

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

                            protected function prepareQuery($query = null)
                            {
                                if (!$query) {
                                    $query = $this->getQuery();
                                }
                        Severity: Minor
                        Found in OrganizationSearch.php - About 1 hr to fix

                          Method attributeHints has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function attributeHints()
                              {
                                  $topName = $this->organization->isDepartment() ? $this->organization->topOrganization->profile->name . ' (' . $this->organization->topOrganization->getID() . ')' : '';
                                  $parentName = $this->organization->isDepartment() ? $this->organization->parent->profile->name . ' (' . $this->organization->parent->getID() . ')' : '';
                                  return [
                          Severity: Minor
                          Found in forms/SettingsForm.php - About 1 hr to fix

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

                              Method behaviors has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function behaviors()
                                  {
                                      return [
                                          'access' => [
                                              'class' => AccessControl::class,
                              Severity: Minor
                              Found in web/user/controllers/OrganizationController.php - About 1 hr to fix

                                Method submit has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function submit()
                                    {
                                        try {
                                            if ($this->organization->isOrganization()) {
                                                if ($this->exclude_other_members != ($this->organization->isExcludeOtherMembers ? '1' : '0')) {
                                Severity: Minor
                                Found in forms/SettingsForm.php - About 1 hr to fix

                                  Method actionJoin has 28 lines of code (exceeds 25 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 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language