pluf/supertenant

View on GitHub

Showing 4 of 4 total issues

File tenant.php has 335 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/*
 * This file is part of Pluf Framework, a simple PHP Application Framework.
 * Copyright (C) 2010-2020 Phoinex Scholars Co. (http://dpq.co.ir)
 *
Severity: Minor
Found in src6/urls-v2/tenant.php - About 4 hrs to fix

    Method get has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function get($key, $defValue)
        {
            $myTenant = Pluf_Tenant::current();
            $memKey = $key;
            if (array_key_exists($memKey, self::$inMemory)) {
    Severity: Minor
    Found in src/SuperTenant/ConfigService.php - About 1 hr to fix

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

          public static function flush()
          {
              foreach (self::$inMemory as $key => $val) {
                  if ($val['derty']) {
                      $myTenant = Pluf_Tenant::current();
      Severity: Minor
      Found in src/SuperTenant/ConfigService.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 SuperTenant_Shortcuts_CheckTenant has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      function SuperTenant_Shortcuts_CheckTenant($request, $match, $model){
          $tenant = null;
          if(isset($request->REQUEST['tenant'])){
              $tenant = Pluf_Shortcuts_GetObjectOr404('Pluf_Tenant', $request->REQUEST['tenant']);
          }else if(isset($match['tenantId'])){
      Severity: Minor
      Found in src/SuperTenant/Shortcuts.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