madbob/GASdottoNG

View on GitHub
code/app/Role.php

Summary

Maintainability
C
1 day
Test Coverage

File Role.php has 299 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
Severity: Minor
Found in code/app/Role.php - About 3 hrs to fix

    Role has 23 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Role extends Model
    {
        use HasFactory, GASModel, Cachable;
    
        private $real_targets = null;
    Severity: Minor
    Found in code/app/Role.php - About 2 hrs to fix

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

          private function appliesCache()
          {
              if (is_null($this->applies_cache)) {
                  $applies_cache = [];
                  $applies_only_cache = [];
      Severity: Minor
      Found in code/app/Role.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 testApplication has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          private function testApplication($obj, $cache_type)
          {
              $this->appliesCache();
      
              $class = get_class($obj);
      Severity: Minor
      Found in code/app/Role.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 applications has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          public function applications($all = false, $exclude_trashed = false, $target_class = null)
          {
              $this->appliesCache();
      
              if ($all) {
      Severity: Minor
      Found in code/app/Role.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 printableHeader has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          public function printableHeader()
          {
              $ret = $this->printableName();
      
              $step = $this;
      Severity: Minor
      Found in code/app/Role.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 getAllClasses has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getAllClasses()
          {
              $ret = [];
              $permissions = allPermissions();
      
      
      Severity: Minor
      Found in code/app/Role.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

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

          public function attachApplication($obj)
          {
              $now = date('Y-m-d G:i:s');
      
              if (is_string($obj)) {
      Severity: Minor
      Found in code/app/Role.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

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

          public function isEnabled()
          {
              if ($this->system) {
                  foreach(systemParameters('Roles') as $ref) {
                      if ($this->identifier == $ref->identifier()) {
      Severity: Minor
      Found in code/app/Role.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

      There are no issues that match your filters.

      Category
      Status