yiisoft/yii2

View on GitHub

Showing 787 of 2,467 total issues

Avoid too many return statements within this method.
Open

                    return Yii::t('yii', '{nFormatted} PB', $params, $this->language);
Severity: Major
Found in framework/i18n/Formatter.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                        return Yii::t('yii', '{nFormatted} {n, plural, =1{byte} other{bytes}}', $params, $this->language);
    Severity: Major
    Found in framework/i18n/Formatter.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                          return Yii::t('yii', '{nFormatted} {n, plural, =1{megabyte} other{megabytes}}', $params, $this->language);
      Severity: Major
      Found in framework/i18n/Formatter.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                        return $source;
        Severity: Major
        Found in framework/i18n/I18N.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return $this->_content;
          Severity: Major
          Found in framework/widgets/FragmentCache.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return $this->translations[$category] = $this->translations['*'] = Yii::createObject($source);
            Severity: Major
            Found in framework/i18n/I18N.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                                  return Yii::t('yii', '{nFormatted} kB', $params, $this->language);
              Severity: Major
              Found in framework/i18n/Formatter.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                        return Html::tag($tag, Yii::$app->getI18n()->format($summaryContent, [
                            'begin' => $begin,
                            'end' => $end,
                            'count' => $count,
                            'totalCount' => $totalCount,
                Severity: Major
                Found in framework/widgets/BaseListView.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                                      return Yii::t('yii', '{nFormatted} GB', $params, $this->language);
                  Severity: Major
                  Found in framework/i18n/Formatter.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                        return Yii::t('yii', '{nFormatted} TB', $params, $this->language);
                    Severity: Major
                    Found in framework/i18n/Formatter.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                          return Yii::t('yii', '{nFormatted} {n, plural, =1{gibibyte} other{gibibytes}}', $params, $this->language);
                      Severity: Major
                      Found in framework/i18n/Formatter.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                            return Yii::t('yii', '{nFormatted} MB', $params, $this->language);
                        Severity: Major
                        Found in framework/i18n/Formatter.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                              return Yii::t('yii', '{nFormatted} {n, plural, =1{pebibyte} other{pebibytes}}', $params, $this->language);
                          Severity: Major
                          Found in framework/i18n/Formatter.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                                return Yii::t('yii', '{nFormatted} {n, plural, =1{kilobyte} other{kilobytes}}', $params, $this->language);
                            Severity: Major
                            Found in framework/i18n/Formatter.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                                  return Yii::t('yii', '{nFormatted} {n, plural, =1{petabyte} other{petabytes}}', $params, $this->language);
                              Severity: Major
                              Found in framework/i18n/Formatter.php - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                                return false;
                                Severity: Major
                                Found in framework/widgets/BaseListView.php - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                                      return Yii::t('yii', '{nFormatted} {n, plural, =1{tebibyte} other{tebibytes}}', $params, $this->language);
                                  Severity: Major
                                  Found in framework/i18n/Formatter.php - About 30 mins to fix

                                    Avoid too many return statements within this method.
                                    Open

                                                        return Yii::t('yii', '{nFormatted} {n, plural, =1{terabyte} other{terabytes}}', $params, $this->language);
                                    Severity: Major
                                    Found in framework/i18n/Formatter.php - About 30 mins to fix

                                      Function addChild has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          public function addChild($parent, $child)
                                          {
                                              if (!isset($this->items[$parent->name], $this->items[$child->name])) {
                                                  throw new InvalidArgumentException("Either '{$parent->name}' or '{$child->name}' does not exist.");
                                              }
                                      Severity: Minor
                                      Found in framework/rbac/PhpManager.php - About 25 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 getInheritedPermissionsByUser has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          protected function getInheritedPermissionsByUser($userId)
                                          {
                                              $assignments = $this->getAssignments($userId);
                                              $result = [];
                                              foreach (array_keys($assignments) as $roleName) {
                                      Severity: Minor
                                      Found in framework/rbac/PhpManager.php - About 25 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