yiisoft/yii2

View on GitHub

Showing 787 of 2,467 total issues

Method pbkdf2 has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function pbkdf2($algo, $password, $salt, $iterations, $length = 0)
Severity: Minor
Found in framework/base/Security.php - About 35 mins to fix

    Method setFormatterIntAttribute has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        private function setFormatterIntAttribute($formatter, $attribute, $value, $source, $alternative)
    Severity: Minor
    Found in framework/i18n/Formatter.php - About 35 mins to fix

      Method setFormatterTextAttribute has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          private function setFormatterTextAttribute($formatter, $attribute, $value, $source, $alternative)
      Severity: Minor
      Found in framework/i18n/Formatter.php - About 35 mins to fix

        Method renderPageButton has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            protected function renderPageButton($label, $page, $class, $disabled, $active)
        Severity: Minor
        Found in framework/widgets/LinkPager.php - About 35 mins to fix

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

              protected function getCacheFile($normalizedKey)
              {
                  $cacheKey = $normalizedKey;
          
                  if ($this->keyPrefix !== '') {
          Severity: Minor
          Found in framework/caching/FileCache.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 generateReusableHash has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function generateReusableHash()
              {
                  $clone = clone $this;
                  $clone->data = null; // https://github.com/yiisoft/yii2/issues/3052
          
          
          Severity: Minor
          Found in framework/caching/Dependency.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 checkAccessRecursive has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function checkAccessRecursive($user, $itemName, $params, $assignments)
              {
                  if (($item = $this->getItem($itemName)) === null) {
                      return false;
                  }
          Severity: Minor
          Found in framework/rbac/DbManager.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 getUserIdsByRole has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getUserIdsByRole($roleName)
              {
                  $result = [];
                  foreach ($this->assignments as $userID => $assignments) {
                      foreach ($assignments as $userAssignment) {
          Severity: Minor
          Found in framework/rbac/PhpManager.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 init has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public function init()
              {
                  parent::init();
                  if ($this->enableCoreCommands) {
                      foreach ($this->coreCommands() as $id => $command) {
          Severity: Minor
          Found in framework/console/Application.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 detectAttributeTypes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function detectAttributeTypes()
              {
                  $attributeTypes = [];
                  foreach ($this->owner->getValidators() as $validator) {
                      $type = null;
          Severity: Minor
          Found in framework/behaviors/AttributeTypecastBehavior.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 insertResponseCookieCollectionIntoData has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              private function insertResponseCookieCollectionIntoData(Response $response, array &$data)
              {
                  if ($this->cacheCookies === false) {
                      return;
                  }
          Severity: Minor
          Found in framework/filters/PageCache.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 addMemcachedServers has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function addMemcachedServers($cache, $servers)
              {
                  $existingServers = [];
                  if ($this->persistentId !== null) {
                      foreach ($cache->getServerList() as $s) {
          Severity: Minor
          Found in framework/caching/MemCache.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 getSuggestedAlternatives has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getSuggestedAlternatives()
              {
                  $help = $this->application->createController('help');
                  if ($help === false || $this->command === '') {
                      return [];
          Severity: Minor
          Found in framework/console/UnknownCommandException.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 typecastValue has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function typecastValue($value, $type)
              {
                  if (is_scalar($type)) {
                      if (is_object($value) && method_exists($value, '__toString')) {
                          $value = $value->__toString();
          Severity: Minor
          Found in framework/behaviors/AttributeTypecastBehavior.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 insertResponseHeaderCollectionIntoData has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              private function insertResponseHeaderCollectionIntoData(Response $response, array &$data)
              {
                  if ($this->cacheHeaders === false) {
                      return;
                  }
          Severity: Minor
          Found in framework/filters/PageCache.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 filterPath has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function filterPath($path, $options)
              {
                  if (isset($options['filter'])) {
                      $result = call_user_func($options['filter'], $path);
                      if (is_bool($result)) {
          Severity: Minor
          Found in framework/helpers/BaseFileHelper.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 matchBasename has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              private static function matchBasename($baseName, $pattern, $firstWildcard, $flags)
              {
                  if ($firstWildcard === false) {
                      if ($pattern === $baseName) {
                          return true;
          Severity: Minor
          Found in framework/helpers/BaseFileHelper.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 calculateTimings has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public function calculateTimings($messages)
              {
                  $timings = [];
                  $stack = [];
          
          
          Severity: Minor
          Found in framework/log/Logger.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 buildExpressionsFrom has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              private function buildExpressionsFrom(ExpressionInterface $condition, &$params = [])
              {
                  $parts = [];
                  foreach ($condition->getExpressions() as $condition) {
                      if (is_array($condition)) {
          Severity: Minor
          Found in framework/db/conditions/ConjunctionConditionBuilder.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 ensureScheme has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function ensureScheme($url, $scheme)
              {
                  if (static::isRelative($url) || !is_string($scheme)) {
                      return $url;
                  }
          Severity: Minor
          Found in framework/helpers/BaseUrl.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