Showing 33 of 33 total issues

Method Tenant_Shortcuts_generateCurrentTenantObjectType has 398 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function Tenant_Shortcuts_generateCurrentTenantObjectType()
{
    // tenant
    $Tenant_Tenant = null;
    $Tenant_Configuration = null;
Severity: Major
Found in src/Tenant/Shortcuts.php - About 1 day to fix

    File Shortcuts.php has 436 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    use GraphQL\Type\Definition\ObjectType;
    use GraphQL\Type\Definition\Type;
    
    function Tenant_Shortcuts_GetMainTenant()
    Severity: Minor
    Found in src/Tenant/Shortcuts.php - About 6 hrs to fix

      Method init has 100 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function init()
          {
              $this->_a['verbose'] = 'tenant_spas';
              $this->_a['table'] = 'tenant_spas';
              $this->_a['cols'] = array(
      Severity: Major
      Found in src/Tenant/SPA.php - About 4 hrs to fix

        Method init has 94 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function init()
            {
                $this->_a['table'] = 'tenants';
                $this->_a['multitenant'] = false;
                $this->_a['mapped'] = true;
        Severity: Major
        Found in src/Tenant/Tenant.php - About 3 hrs to fix

          Method init has 77 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function init()
              {
                  $this->_a['table'] = 'tenant_invoices';
                  $this->_a['verbose'] = 'Tenant Invoice';
                  $this->_a['cols'] = array(
          Severity: Major
          Found in src/Tenant/Invoice.php - About 3 hrs to fix

            Method init has 69 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function init()
                {
                    $this->_a['table'] = 'tenant_resources';
                    $this->_a['cols'] = array(
                        // Identifier
            Severity: Major
            Found in src/Tenant/Resource.php - About 2 hrs to fix

              Method init has 59 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function init()
                  {
                      $this->_a['table'] = 'tenant_tickets';
                      $this->_a['verbose'] = 'Tenant Tickets';
                      $this->_a['cols'] = array(
              Severity: Major
              Found in src/Tenant/Ticket.php - About 2 hrs to fix

                Method init has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function init()
                    {
                        $this->_a['table'] = 'tenant_comments';
                        $this->_a['verbose'] = 'Tenant Comment';
                        $this->_a['cols'] = array(
                Severity: Major
                Found in src/Tenant/Comment.php - About 2 hrs to fix

                  Method init has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function init()
                      {
                          $this->_a['table'] = 'tenant_settings';
                          $this->_a['verbose'] = 'Tenant Setting';
                          $this->_a['cols'] = array(
                  Severity: Major
                  Found in src/Tenant/Setting.php - About 2 hrs to fix

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                        public static function removeOwner($request, $match)
                        {
                            $tenant = self::getSubTenant($match['tenantId'], $request->tenant->id);
                            if (isset($match['ownerId'])) {
                                $ownerId = $match['ownerId'];
                    Severity: Major
                    Found in src/Tenant/Views.php and 1 other location - About 2 hrs to fix
                    src/Tenant/Views.php on lines 270..281

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 124.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                        public static function addOwner($request, $match)
                        {
                            $tenant = self::getSubTenant($match['tenantId'], $request->tenant->id);
                            if (isset($match['ownerId'])) {
                                $ownerId = $match['ownerId'];
                    Severity: Major
                    Found in src/Tenant/Views.php and 1 other location - About 2 hrs to fix
                    src/Tenant/Views.php on lines 283..294

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 124.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Method init has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        function init()
                        {
                            $this->_a['table'] = 'tenant_configurations';
                            $this->_a['verbose'] = 'Tenant Configuration';
                    //         $this->_a['multitenant'] = false;
                    Severity: Minor
                    Found in src/Tenant/Configuration.php - About 1 hr to fix

                      Method init has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          function init()
                          {
                              $this->_a['verbose'] = 'Tenant_Owner';
                              $this->_a['table'] = 'user_accounts';
                              $this->_a['mapped'] = true;
                      Severity: Minor
                      Found in src/Tenant/Owner.php - About 1 hr to fix

                        Function process_request has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                        Open

                            function process_request(Pluf_HTTP_Request &$request)
                            {
                                if (! $request->isGet()) {
                                    return false;
                                }
                        Severity: Minor
                        Found in src/Tenant/Middleware/ResourceAccess.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 process_request has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            function process_request(Pluf_HTTP_Request &$request)
                            {
                                if (! $request->isGet()) {
                                    return false;
                                }
                        Severity: Minor
                        Found in src/Tenant/Middleware/ResourceAccess.php - About 1 hr to fix

                          Method initiateTenant has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public static function initiateTenant($tenant)
                              {
                                  // Init the Tenant
                                  $m = new Pluf_Migration();
                                  $m->init($tenant);
                          Severity: Minor
                          Found in src/Tenant/Service.php - About 1 hr to fix

                            Method process_request has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                function process_request(Pluf_HTTP_Request &$request)
                                {
                                    if (! $request->isGet()) {
                                        return false;
                                    }
                            Severity: Minor
                            Found in src/Tenant/Middleware/DefaultSpaRedirect.php - About 1 hr to fix

                              Method payment has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public static function payment($request, $match)
                                  {
                                      $invoice = Pluf_Shortcuts_GetObjectOr404('Tenant_Invoice', $match['modelId']);
                              
                                      $user = $request->user;
                              Severity: Minor
                              Found in src/Tenant/Views/Invoice.php - About 1 hr to fix

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

                                    function process_request(Pluf_HTTP_Request &$request)
                                    {
                                        if (! $request->isGet()) {
                                            return false;
                                        }
                                Severity: Minor
                                Found in src/Tenant/Middleware/DefaultSpaRedirect.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 updateFromFile has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public static function updateFromFile($spa, $path, $deleteFile = false)
                                    {
                                        // Temp folder
                                        $key = 'spa-' . md5(microtime() . rand(0, 123456789));
                                        $dir = Pluf_Tenant::storagePath() . '/spa/' . $key;
                                Severity: Minor
                                Found in src/Tenant/SpaService.php - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language