PHPSocialNetwork/phpfastcache

View on GitHub

Showing 82 of 141 total issues

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

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

    public function runCRUDTests(ExtendedCacheItemPoolInterface $pool)
    {
        $this->printInfoText('Running CRUD tests on the following backend: ' . get_class($pool));
        $pool->clear();

Severity: Minor
Found in lib/Phpfastcache/Helper/TestHelper.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 47 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

    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 getItemsByTags has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getItemsByTags(array $tagNames, int $strategy = TaggableCacheItemPoolInterface::TAG_STRATEGY_ONE): array
        {
            $items = [];
            foreach (\array_unique($tagNames) as $tagName) {
                if (\is_string($tagName)) {
    Severity: Minor
    Found in lib/Phpfastcache/Core/Pool/TaggableCacheItemPoolTrait.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

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

        public static function getPhpFastCacheVersion(bool $fallbackOnChangelog = true, bool $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

    Method __construct has 41 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

      Method driverWrite has 40 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 getItem has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getItem($key)
            {
                /** @var ExtendedCacheItemPoolInterface[] $poolsToResync */
                $poolsToResync = [];
                /** @var ExtendedCacheItemInterface $item */

          Method driverConnect has 36 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

            Method driverConnect has 36 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 getStats has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function getStats(): DriverStatistic
                  {
                      $stats = new DriverStatistic();
                      $stats->setInfo(
                          sprintf(
              Severity: Minor
              Found in lib/Phpfastcache/Cluster/ClusterPoolAbstract.php - About 1 hr to fix

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

                    protected function driverConnect(): bool
                    {
                        $this->instance = new MemcachedSoftware();
                        $this->instance->setOption(MemcachedSoftware::OPT_BINARY_PROTOCOL, true);
                        $servers = $this->getConfig()->getServers();
                Severity: Minor
                Found in lib/Phpfastcache/Drivers/Memcached/Driver.php - About 1 hr to fix

                  Method getPhpFastCacheVersion has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public static function getPhpFastCacheVersion(bool $fallbackOnChangelog = true, bool $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 driverWrite has 32 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

                      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 __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 buildConnectionURI has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          protected function buildConnectionURI($databaseName = ''): string
                          {
                              $servers = $this->getConfig()->getServers();
                              $options = $this->getConfig()->getOptions();
                      
                      
                      Severity: Minor
                      Found in lib/Phpfastcache/Drivers/Mongodb/Driver.php - About 1 hr to fix

                        Method htaccessGen has 31 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
                          Severity
                          Category
                          Status
                          Source
                          Language