PHPSocialNetwork/phpfastcache

View on GitHub

Showing 143 of 143 total issues

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

          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

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

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

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

                          public function __call(string $name, array $arguments)
                          {
                              if (\strpos($name, 'on') === 0) {
                                  $name = \substr($name, 2);
                                  if (\is_callable($arguments[0])) {
                      Severity: Minor
                      Found in lib/Phpfastcache/EventManager.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 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

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

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

                            public function setServers(array $servers): self
                            {
                                foreach ($servers as $server) {
                                    if($diff = \array_diff(['host', 'port', 'saslUser', 'saslPassword'], \array_keys($server))){
                                        throw new PhpfastcacheInvalidConfigurationException('Missing keys for memcached server: '. \implode(', ', $diff));
                        Severity: Minor
                        Found in lib/Phpfastcache/Drivers/Memcache/Config.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 setServers has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function setServers(array $servers): self
                            {
                                foreach ($servers as $server) {
                                    if($diff = \array_diff(['host', 'port', 'saslUser', 'saslPassword'], \array_keys($server))){
                                        throw new PhpfastcacheInvalidConfigurationException('Missing keys for memcached server: '. \implode(', ', $diff));
                        Severity: Minor
                        Found in lib/Phpfastcache/Drivers/Memcached/Config.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 errorHandler has a Cognitive Complexity of 9 (exceeds 5 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 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

                        Avoid variables with short names like $em. Configured minimum length is 3.
                        Open

                            public function setEventManager(EventInterface $em): ExtendedCacheItemInterface

                        Since: PHPMD 0.2

                        Detects when a field, local, or parameter has a very short name.

                        Example:

                        class Something {
                              private $q = 15; // VIOLATION - Field
                              public static function main( array $as ) { // VIOLATION - Formal
                                  $r = 20 + $this->q; // VIOLATION - Local
                                  for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                      $r += $this->q;
                                  }
                              }
                          }

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

                        Severity
                        Category
                        Status
                        Source
                        Language