PHPSocialNetwork/phpfastcache

View on GitHub

Showing 65 of 143 total issues

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 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

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

    protected function driverConnect(): bool
    {
        if ($this->instance instanceof CassandraSession) {
            throw new PhpfastcacheLogicException('Already connected to Couchbase server');
        }
Severity: Minor
Found in lib/Phpfastcache/Drivers/Cassandra/Driver.php - About 1 hr to fix

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

        public function getStats(): DriverStatistic
        {
            $serverStats = $this->instance->getManager()->executeCommand('phpFastCache', new Command([
                'serverStatus' => 1,
                'recordStats' => 0,
    Severity: Minor
    Found in lib/Phpfastcache/Drivers/Mongodb/Driver.php - About 1 hr to fix

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

          public function __construct(...$args)
          {
              parent::__construct(...$args);
              $array =& $this->getArray();
      
      
      Severity: Minor
      Found in lib/Phpfastcache/Config/ConfigurationOption.php - About 1 hr to fix

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

            protected function driverConnect(): bool
            {
                if ($this->instance instanceof RedisClient) {
                    throw new PhpfastcacheLogicException('Already connected to Redis server');
                }
        Severity: Minor
        Found in lib/Phpfastcache/Drivers/Redis/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

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

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

              protected function driverConnect(): bool
              {
                  if ($this->instance instanceof PredisClient) {
                      throw new PhpfastcacheLogicException('Already connected to Predis server');
                  }
          Severity: Minor
          Found in lib/Phpfastcache/Drivers/Predis/Driver.php - About 1 hr to fix

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

                protected function driverWrite(CacheItemInterface $item): bool
                {
                    /**
                     * Check for Cross-Driver type confusion
                     */
            Severity: Minor
            Found in lib/Phpfastcache/Drivers/Cassandra/Driver.php - About 1 hr to fix

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

                Function getDriverList has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function getDriverList(bool $FQCNAsKey = false): array
                    {
                        static $driverList;
                
                        if (self::getDefaultNamespacePath() === self::getNamespacePath()) {
                Severity: Minor
                Found in lib/Phpfastcache/CacheManager.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 getInstance has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function getInstance(string $driver = self::AUTOMATIC_DRIVER_CLASS, $config = null, string $instanceId = null): ExtendedCacheItemPoolInterface
                    {
                        $config = self::validateConfig($config);
                        $driver = self::standardizeDriverName($driver);
                
                
                Severity: Minor
                Found in lib/Phpfastcache/CacheManager.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 __construct has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function __construct(...$args)
                    {
                        parent::__construct(...$args);
                        $array =& $this->getArray();
                
                
                Severity: Minor
                Found in lib/Phpfastcache/Config/ConfigurationOption.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 getPhpFastCacheVersion has 31 lines of code (exceeds 25 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

                  Method driverWriteTags has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function driverWriteTags(ExtendedCacheItemInterface $item): bool
                      {
                          /**
                           * Do not attempt to write tags
                           * on tags item, it can leads
                  Severity: Minor
                  Found in lib/Phpfastcache/Core/Pool/DriverBaseTrait.php - About 1 hr to fix

                    Method htaccessGen has 29 lines of code (exceeds 25 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

                      Method driverWrite has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          protected function driverWrite(CacheItemInterface $item): bool
                          {
                              /**
                               * Check for Cross-Driver type confusion
                               */
                      Severity: Minor
                      Found in lib/Phpfastcache/Drivers/Mongodb/Driver.php - About 1 hr to fix

                        Method getInstance has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public static function getInstance(string $driver = self::AUTOMATIC_DRIVER_CLASS, $config = null, string $instanceId = null): ExtendedCacheItemPoolInterface
                            {
                                $config = self::validateConfig($config);
                                $driver = self::standardizeDriverName($driver);
                        
                        
                        Severity: Minor
                        Found in lib/Phpfastcache/CacheManager.php - About 1 hr to fix

                          Method driverConnect has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              protected function driverConnect(): bool
                              {
                                  if ($this->instance instanceof RedisClient) {
                                      throw new PhpfastcacheLogicException('Already connected to Redis server');
                                  }
                          Severity: Minor
                          Found in lib/Phpfastcache/Drivers/Redis/Driver.php - About 1 hr to fix

                            Function driverWriteTags has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public function driverWriteTags(ExtendedCacheItemInterface $item): bool
                                {
                                    /**
                                     * Do not attempt to write tags
                                     * on tags item, it can leads
                            Severity: Minor
                            Found in lib/Phpfastcache/Core/Pool/DriverBaseTrait.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