PHPSocialNetwork/phpfastcache

View on GitHub
lib/Phpfastcache/Core/Pool/CacheItemPoolTrait.php

Summary

Maintainability
D
2 days
Test Coverage

Function getItems has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

    public function getItems(array $keys = []): iterable
    {
        $items = [];

        /**
Severity: Minor
Found in lib/Phpfastcache/Core/Pool/CacheItemPoolTrait.php - About 4 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 CacheItemPoolTrait.php has 350 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 *
 * This file is part of Phpfastcache.
Severity: Minor
Found in lib/Phpfastcache/Core/Pool/CacheItemPoolTrait.php - About 4 hrs to fix

    Function getItem has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getItem(string $key): ExtendedCacheItemInterface
        {
            /**
             * Replace array_key_exists by isset
             * due to performance issue on huge
    Severity: Minor
    Found in lib/Phpfastcache/Core/Pool/CacheItemPoolTrait.php - About 3 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 getItems has 55 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getItems(array $keys = []): iterable
        {
            $items = [];
    
            /**
    Severity: Major
    Found in lib/Phpfastcache/Core/Pool/CacheItemPoolTrait.php - About 2 hrs to fix

      Function deleteItems has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          public function deleteItems(array $keys): bool
          {
              if (count($keys) > 1) {
                  $return = true;
                  try {
      Severity: Minor
      Found in lib/Phpfastcache/Core/Pool/CacheItemPoolTrait.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 getItem has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getItem(string $key): ExtendedCacheItemInterface
          {
              /**
               * Replace array_key_exists by isset
               * due to performance issue on huge
      Severity: Minor
      Found in lib/Phpfastcache/Core/Pool/CacheItemPoolTrait.php - About 1 hr to fix

        Method deleteItems has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function deleteItems(array $keys): bool
            {
                if (count($keys) > 1) {
                    $return = true;
                    try {
        Severity: Minor
        Found in lib/Phpfastcache/Core/Pool/CacheItemPoolTrait.php - About 1 hr to fix

          Method save has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function save(CacheItemInterface $item): bool
              {
                  $this->assertCacheItemType($item, self::getItemClass());
                  /**
                   * @var ExtendedCacheItemInterface $item
          Severity: Minor
          Found in lib/Phpfastcache/Core/Pool/CacheItemPoolTrait.php - About 1 hr to fix

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

                public function save(CacheItemInterface $item): bool
                {
                    $this->assertCacheItemType($item, self::getItemClass());
                    /**
                     * @var ExtendedCacheItemInterface $item
            Severity: Minor
            Found in lib/Phpfastcache/Core/Pool/CacheItemPoolTrait.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

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

                public function commit(): bool
                {
                    $this->eventManager->dispatch(Event::CACHE_COMMIT_ITEM, $this, new EventReferenceParameter($this->deferredList));
            
                    if (\count($this->deferredList)) {
            Severity: Minor
            Found in lib/Phpfastcache/Core/Pool/CacheItemPoolTrait.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

            There are no issues that match your filters.

            Category
            Status