PHPSocialNetwork/phpfastcache

View on GitHub

Showing 142 of 142 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

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

    public static function getAutoClass(ConfigurationOption $config): string
    {
        static $autoDriver;

        if ($autoDriver === null) {
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 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

Avoid excessively long variable names like $defaultFileNameHashFunction. Keep variable name length under 20.
Open

    protected $defaultFileNameHashFunction = 'md5';

Since: PHPMD 0.2

Detects when a field, formal or local variable is declared with a long name.

Example:

class Something {
      protected $reallyLongIntName = -3; // VIOLATION - Field
      public static function main( array $argumentsList[] ) { // VIOLATION - Formal
          $otherReallyLongName = -5; // VIOLATION - Local
          for ($interestingIntIndex = 0; // VIOLATION - For
               $interestingIntIndex < 10;
               $interestingIntIndex++ ) {
          }
      }
  }

Source: http://phpmd.org/rules/naming.txt

Avoid excessively long variable names like $limitedMemoryByObject. Keep variable name length under 20.
Open

    protected $limitedMemoryByObject = 4096;

Since: PHPMD 0.2

Detects when a field, formal or local variable is declared with a long name.

Example:

class Something {
      protected $reallyLongIntName = -3; // VIOLATION - Field
      public static function main( array $argumentsList[] ) { // VIOLATION - Formal
          $otherReallyLongName = -5; // VIOLATION - Local
          for ($interestingIntIndex = 0; // VIOLATION - For
               $interestingIntIndex < 10;
               $interestingIntIndex++ ) {
          }
      }
  }

Source: http://phpmd.org/rules/naming.txt

Avoid excessively long variable names like $defaultKeyHashFunction. Keep variable name length under 20.
Open

    public function setDefaultKeyHashFunction($defaultKeyHashFunction): self

Since: PHPMD 0.2

Detects when a field, formal or local variable is declared with a long name.

Example:

class Something {
      protected $reallyLongIntName = -3; // VIOLATION - Field
      public static function main( array $argumentsList[] ) { // VIOLATION - Formal
          $otherReallyLongName = -5; // VIOLATION - Local
          for ($interestingIntIndex = 0; // VIOLATION - For
               $interestingIntIndex < 10;
               $interestingIntIndex++ ) {
          }
      }
  }

Source: http://phpmd.org/rules/naming.txt

Avoid excessively long variable names like $secureFileManipulation. Keep variable name length under 20.
Open

    public function setSecureFileManipulation(bool $secureFileManipulation): self

Since: PHPMD 0.2

Detects when a field, formal or local variable is declared with a long name.

Example:

class Something {
      protected $reallyLongIntName = -3; // VIOLATION - Field
      public static function main( array $argumentsList[] ) { // VIOLATION - Formal
          $otherReallyLongName = -5; // VIOLATION - Local
          for ($interestingIntIndex = 0; // VIOLATION - For
               $interestingIntIndex < 10;
               $interestingIntIndex++ ) {
          }
      }
  }

Source: http://phpmd.org/rules/naming.txt

Avoid excessively long variable names like $limitedMemoryByObject. Keep variable name length under 20.
Open

    public function setLimitedMemoryByObject(int $limitedMemoryByObject): self

Since: PHPMD 0.2

Detects when a field, formal or local variable is declared with a long name.

Example:

class Something {
      protected $reallyLongIntName = -3; // VIOLATION - Field
      public static function main( array $argumentsList[] ) { // VIOLATION - Formal
          $otherReallyLongName = -5; // VIOLATION - Local
          for ($interestingIntIndex = 0; // VIOLATION - For
               $interestingIntIndex < 10;
               $interestingIntIndex++ ) {
          }
      }
  }

Source: http://phpmd.org/rules/naming.txt

Avoid excessively long variable names like $array_filter_recursive. Keep variable name length under 20.
Open

        $array_filter_recursive = function ($array, callable $callback = null) use (&$array_filter_recursive) {

Since: PHPMD 0.2

Detects when a field, formal or local variable is declared with a long name.

Example:

class Something {
      protected $reallyLongIntName = -3; // VIOLATION - Field
      public static function main( array $argumentsList[] ) { // VIOLATION - Formal
          $otherReallyLongName = -5; // VIOLATION - Local
          for ($interestingIntIndex = 0; // VIOLATION - For
               $interestingIntIndex < 10;
               $interestingIntIndex++ ) {
          }
      }
  }

Source: http://phpmd.org/rules/naming.txt

Avoid excessively long variable names like $internalCacheInstance. Keep variable name length under 20.
Open

    protected $internalCacheInstance;

Since: PHPMD 0.2

Detects when a field, formal or local variable is declared with a long name.

Example:

class Something {
      protected $reallyLongIntName = -3; // VIOLATION - Field
      public static function main( array $argumentsList[] ) { // VIOLATION - Formal
          $otherReallyLongName = -5; // VIOLATION - Local
          for ($interestingIntIndex = 0; // VIOLATION - For
               $interestingIntIndex < 10;
               $interestingIntIndex++ ) {
          }
      }
  }

Source: http://phpmd.org/rules/naming.txt

Avoid excessively long variable names like $defaultKeyHashFunction. Keep variable name length under 20.
Open

    protected $defaultKeyHashFunction = 'md5';

Since: PHPMD 0.2

Detects when a field, formal or local variable is declared with a long name.

Example:

class Something {
      protected $reallyLongIntName = -3; // VIOLATION - Field
      public static function main( array $argumentsList[] ) { // VIOLATION - Formal
          $otherReallyLongName = -5; // VIOLATION - Local
          for ($interestingIntIndex = 0; // VIOLATION - For
               $interestingIntIndex < 10;
               $interestingIntIndex++ ) {
          }
      }
  }

Source: http://phpmd.org/rules/naming.txt

Avoid excessively long variable names like $defaultFileNameHashFunction. Keep variable name length under 20.
Open

    public function setDefaultFileNameHashFunction($defaultFileNameHashFunction): self

Since: PHPMD 0.2

Detects when a field, formal or local variable is declared with a long name.

Example:

class Something {
      protected $reallyLongIntName = -3; // VIOLATION - Field
      public static function main( array $argumentsList[] ) { // VIOLATION - Formal
          $otherReallyLongName = -5; // VIOLATION - Local
          for ($interestingIntIndex = 0; // VIOLATION - For
               $interestingIntIndex < 10;
               $interestingIntIndex++ ) {
          }
      }
  }

Source: http://phpmd.org/rules/naming.txt

Avoid excessively long variable names like $secureFileManipulation. Keep variable name length under 20.
Open

    protected function writefile($file, $data, $secureFileManipulation = false): bool

Since: PHPMD 0.2

Detects when a field, formal or local variable is declared with a long name.

Example:

class Something {
      protected $reallyLongIntName = -3; // VIOLATION - Field
      public static function main( array $argumentsList[] ) { // VIOLATION - Formal
          $otherReallyLongName = -5; // VIOLATION - Local
          for ($interestingIntIndex = 0; // VIOLATION - For
               $interestingIntIndex < 10;
               $interestingIntIndex++ ) {
          }
      }
  }

Source: http://phpmd.org/rules/naming.txt

Avoid excessively long variable names like $cacheSlamsSpendSeconds. Keep variable name length under 20.
Open

                $cacheSlamsSpendSeconds = 0;

Since: PHPMD 0.2

Detects when a field, formal or local variable is declared with a long name.

Example:

class Something {
      protected $reallyLongIntName = -3; // VIOLATION - Field
      public static function main( array $argumentsList[] ) { // VIOLATION - Formal
          $otherReallyLongName = -5; // VIOLATION - Local
          for ($interestingIntIndex = 0; // VIOLATION - For
               $interestingIntIndex < 10;
               $interestingIntIndex++ ) {
          }
      }
  }

Source: http://phpmd.org/rules/naming.txt

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
          Severity
          Category
          Status
          Source
          Language