spiritix/lada-cache

View on GitHub

Showing 12 of 59 total issues

Function getRows has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    public function getRows()
    {
        $rows = [];
        $wheres = $this->queryBuilder->wheres ?: [];

Severity: Minor
Found in src/Spiritix/LadaCache/Reflector.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

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

    private function getTableTags($tables, $rows)
    {
        $tags = [];
        $type = $this->reflector->getType();

Severity: Minor
Found in src/Spiritix/LadaCache/Tagger.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

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

    private function getTablesFromWhere(QueryBuilder $queryBuilder, &$tables) {
        if (!isset($queryBuilder->wheres)) {
            return;
        }
        $wheres = $queryBuilder->wheres ?: [];
Severity: Minor
Found in src/Spiritix/LadaCache/Reflector.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

Consider simplifying this complex logical expression.
Open

            if (($type === Reflector::QUERY_TYPE_SELECT && $isSpecific) ||
                ($type === Reflector::QUERY_TYPE_UPDATE && !$isSpecific) ||
                ($type === Reflector::QUERY_TYPE_DELETE && !$isSpecific) ||
                ($type === Reflector::QUERY_TYPE_TRUNCATE)) {

Severity: Major
Found in src/Spiritix/LadaCache/Tagger.php - About 1 hr to fix

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

        private function tablesCachable()
        {
            $tables = $this->reflector->getTables();
    
            if ($this->isInclusive()) {
    Severity: Minor
    Found in src/Spiritix/LadaCache/Manager.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

    Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            ConnectionInterface $connection,
            Grammar $grammar = null,
            Processor $processor = null,
            QueryHandler $handler,
            Model $model = null
    Severity: Minor
    Found in src/Spiritix/LadaCache/Database/QueryBuilder.php - About 35 mins to fix

      Method newPivot has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public function newPivot(Model $parent, array $attributes, $table, $exists, $using = null)
      Severity: Minor
      Found in src/Spiritix/LadaCache/Database/LadaCacheTrait.php - About 35 mins to fix

        Method endMeasuring has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public function endMeasuring($type, $hash, $tags, $sql, $parameters)
        Severity: Minor
        Found in src/Spiritix/LadaCache/Debug/CacheCollector.php - About 35 mins to fix

          Function getCompileFunction has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              private function getCompileFunction()
              {
                  switch (strtolower($this->sqlOperation)) {
                      case self::QUERY_TYPE_INSERT:
                          return 'compileInsert';
          Severity: Minor
          Found in src/Spiritix/LadaCache/Reflector.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

          Avoid too many return statements within this method.
          Open

                          return 'compileTruncate';
          Severity: Major
          Found in src/Spiritix/LadaCache/Reflector.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                            return 'compileSelect';
            Severity: Major
            Found in src/Spiritix/LadaCache/Reflector.php - About 30 mins to fix

              Function getTags has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function getTags()
                  {
                      // Get affected database and tables, add prefixes
                      $database = $this->prefix($this->reflector->getDatabase(), self::PREFIX_DATABASE);
              
              
              Severity: Minor
              Found in src/Spiritix/LadaCache/Tagger.php - About 25 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