bnomei/kirby3-sqlite-cachedriver

View on GitHub

Showing 7 of 7 total issues

File SQLiteCache.php has 279 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

declare(strict_types=1);

namespace Bnomei;
Severity: Minor
Found in classes/SQLiteCache.php - About 2 hrs to fix

    SQLiteCache has 22 functions (exceeds 20 allowed). Consider refactoring.
    Open

    final class SQLiteCache extends FileCache
    {
        public const DB_VERSION = '1';
        public const DB_FILENAME = 'sqlitecache-';
        public const DB_VALIDATE = 'sqlitecache-';
    Severity: Minor
    Found in classes/SQLiteCache.php - About 2 hrs to fix

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

          public function benchmark(int $count = 10)
          {
              $prefix = "feather-benchmark-";
              $sqlite = $this;
              $file = kirby()->cache('bnomei.sqlite-cachedriver'); // neat, right? ;-)
      Severity: Minor
      Found in classes/SQLiteCache.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 benchmark has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function benchmark(int $count = 10)
          {
              $prefix = "feather-benchmark-";
              $sqlite = $this;
              $file = kirby()->cache('bnomei.sqlite-cachedriver'); // neat, right? ;-)
      Severity: Minor
      Found in classes/SQLiteCache.php - About 1 hr to fix

        Method setOptions has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function setOptions(array $options)
            {
                $root = null;
                $cache = kirby()->cache('bnomei.sqlite-cachedriver');
                if (is_a($cache, FileCache::class)) {
        Severity: Minor
        Found in classes/SQLiteCache.php - About 1 hr to fix

          Function setOptions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              private function setOptions(array $options)
              {
                  $root = null;
                  $cache = kirby()->cache('bnomei.sqlite-cachedriver');
                  if (is_a($cache, FileCache::class)) {
          Severity: Minor
          Found in classes/SQLiteCache.php - About 45 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 retrieve has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public function retrieve(string $key): ?Value
              {
                  $key = $this->key($key);
          
                  $value = A::get($this->store, $key);
          Severity: Minor
          Found in classes/SQLiteCache.php - About 35 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

          Severity
          Category
          Status
          Source
          Language