PHPSocialNetwork/phpfastcache

View on GitHub

Showing 64 of 142 total issues

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

    public function getItem($key)
    {
        if (\is_string($key)) {
            /**
             * Replace array_key_exists by isset
Severity: Minor
Found in lib/Phpfastcache/Core/Pool/CacheItemPoolTrait.php - About 7 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

Function getPath has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
Open

    public function getPath($readonly = false): string
    {
        /**
         * Get the base system temporary directory
         */
Severity: Minor
Found in lib/Phpfastcache/Core/Pool/IO/IOHelperTrait.php - About 6 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

ActOnAll has 44 functions (exceeds 20 allowed). Consider refactoring.
Open

class ActOnAll
{
    /**
     * @var ExtendedCacheItemPoolInterface[]
     */
Severity: Minor
Found in lib/Phpfastcache/Helper/ActOnAll.php - About 6 hrs to fix

    Function findClasses has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
    Open

        protected static function findClasses(string $path): array
        {
            $contents = \file_get_contents($path);
            $tokens = \token_get_all($contents);
            $classes = [];
    Severity: Minor
    Found in lib/Phpfastcache/Util/ClassNamespaceResolverTrait.php - About 5 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 CacheManager.php has 327 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     *
     * This file is part of phpFastCache.
     *
    Severity: Minor
    Found in lib/Phpfastcache/CacheManager.php - About 3 hrs to fix

      ConfigurationOption has 31 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class ConfigurationOption extends ArrayObject implements ConfigurationOptionInterface
      {
          /**
           * @var bool
           */
      Severity: Minor
      Found in lib/Phpfastcache/Config/ConfigurationOption.php - About 3 hrs to fix

        File ExtendedCacheItemPoolTrait.php has 302 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        /**
         *
         * This file is part of phpFastCache.
         *
        Severity: Minor
        Found in lib/Phpfastcache/Core/Pool/ExtendedCacheItemPoolTrait.php - About 3 hrs to fix

          CacheManager has 25 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class CacheManager
          {
              const AUTOMATIC_DRIVER_CLASS = 'Auto';
              const CORE_DRIVER_NAMESPACE = 'Phpfastcache\Drivers\\';
          
          
          Severity: Minor
          Found in lib/Phpfastcache/CacheManager.php - About 2 hrs to fix

            Function createClassMap has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

                protected static function createClassMap($dir): array
                {
                    if (\is_string($dir)) {
                        $dir = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($dir));
                    }
            Severity: Minor
            Found in lib/Phpfastcache/Util/ClassNamespaceResolverTrait.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 61 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getItem($key)
                {
                    if (\is_string($key)) {
                        /**
                         * Replace array_key_exists by isset
            Severity: Major
            Found in lib/Phpfastcache/Core/Pool/CacheItemPoolTrait.php - About 2 hrs to fix

              Method getPath has 55 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function getPath($readonly = false): string
                  {
                      /**
                       * Get the base system temporary directory
                       */
              Severity: Major
              Found in lib/Phpfastcache/Core/Pool/IO/IOHelperTrait.php - About 2 hrs to fix

                Method findClasses has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected static function findClasses(string $path): array
                    {
                        $contents = \file_get_contents($path);
                        $tokens = \token_get_all($contents);
                        $classes = [];
                Severity: Major
                Found in lib/Phpfastcache/Util/ClassNamespaceResolverTrait.php - About 2 hrs to fix

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

                      protected function driverConnect(): bool
                      {
                          $this->instance = new MemcachedSoftware();
                          $this->instance->setOption(\Memcached::OPT_BINARY_PROTOCOL, true);
                          $servers = $this->getConfig()->getServers();
                  Severity: Minor
                  Found in lib/Phpfastcache/Drivers/Memcached/Driver.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

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

                      protected function driverConnect(): bool
                      {
                          $this->instance = new MemcacheSoftware();
                          $servers = $this->getConfig()->getServers();
                  
                  
                  Severity: Minor
                  Found in lib/Phpfastcache/Drivers/Memcache/Driver.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

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

                      public static function rrmdir(string $source, bool $removeOnlyChildren = false): bool
                      {
                          if (empty($source) || \file_exists($source) === false) {
                              return false;
                          }
                  Severity: Minor
                  Found in lib/Phpfastcache/Util/Directory.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 indexing has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function indexing($keyword)
                      {
                          if ($this->indexing == null) {
                              $tableCreated = false;
                              if (!\file_exists($this->SqliteDir . '/indexing')) {
                  Severity: Minor
                  Found in lib/Phpfastcache/Drivers/Sqlite/Driver.php - About 1 hr to fix

                    Method errorHandler has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function errorHandler(int $errno, string $errstr, string $errfile, int $errline)
                        {
                            $errorType = '';
                    
                            switch ($errno) {
                    Severity: Minor
                    Found in lib/Phpfastcache/Helper/TestHelper.php - About 1 hr to fix

                      Function getPhpFastCacheVersion has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public static function getPhpFastCacheVersion($fallbackOnChangelog = true, $cacheable = true): string
                          {
                              /**
                               * Cache the version statically to improve
                               * performances on multiple calls
                      Severity: Minor
                      Found in lib/Phpfastcache/Api.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

                      Function indexing has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function indexing($keyword)
                          {
                              if ($this->indexing == null) {
                                  $tableCreated = false;
                                  if (!\file_exists($this->SqliteDir . '/indexing')) {
                      Severity: Minor
                      Found in lib/Phpfastcache/Drivers/Sqlite/Driver.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

                      Function htaccessGen has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                      Open

                          protected function htaccessGen($path, $create = true)
                          {
                              if ($create === true) {
                                  if (!\is_writable($path)) {
                                      try {
                      Severity: Minor
                      Found in lib/Phpfastcache/Core/Pool/IO/IOHelperTrait.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

                      Severity
                      Category
                      Status
                      Source
                      Language