modxcms/revolution

View on GitHub
core/model/modx/transport/modtransportprovider.class.php

Summary

Maintainability
D
2 days
Test Coverage

Function latest has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

    public function latest($identifier, $constraint = '*', array $args = array()) {
        $latest = array();
        if (strpos($identifier, '-') === false) {
            /** @var modRestResponse $response */
            $response = $this->request(
Severity: Minor
Found in core/model/modx/transport/modtransportprovider.class.php - About 4 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

File modtransportprovider.class.php has 349 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/*
 * This file is part of MODX Revolution.
 *
 * Copyright (c) MODX, LLC. All Rights Reserved.
Severity: Minor
Found in core/model/modx/transport/modtransportprovider.class.php - About 4 hrs to fix

    Method find has 58 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function find(array $search = array(), array $args = array()) {
            $results = array();
    
            $where = array_merge(
                array(
    Severity: Major
    Found in core/model/modx/transport/modtransportprovider.class.php - About 2 hrs to fix

      Method latest has 53 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function latest($identifier, $constraint = '*', array $args = array()) {
              $latest = array();
              if (strpos($identifier, '-') === false) {
                  /** @var modRestResponse $response */
                  $response = $this->request(
      Severity: Major
      Found in core/model/modx/transport/modtransportprovider.class.php - About 2 hrs to fix

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

            public function transfer($signature, $target = null, array $args = array()) {
                $result = false;
                $metadata = $this->info($signature);
                if (!empty($metadata)) {
                    /** @var modTransportPackage $package */
        Severity: Minor
        Found in core/model/modx/transport/modtransportprovider.class.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 stats has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function stats(array $args = array()) {
                $stats = array(
                    'packages' => 0,
                    'downloads' => 0,
                    'topdownloaded' => array(),
        Severity: Minor
        Found in core/model/modx/transport/modtransportprovider.class.php - About 1 hr to fix

          Method transfer has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function transfer($signature, $target = null, array $args = array()) {
                  $result = false;
                  $metadata = $this->info($signature);
                  if (!empty($metadata)) {
                      /** @var modTransportPackage $package */
          Severity: Minor
          Found in core/model/modx/transport/modtransportprovider.class.php - About 1 hr to fix

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

                public function stats(array $args = array()) {
                    $stats = array(
                        'packages' => 0,
                        'downloads' => 0,
                        'topdownloaded' => array(),
            Severity: Minor
            Found in core/model/modx/transport/modtransportprovider.class.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 info has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                public function info($identifier, array $args = array()) {
                    $info = array();
                    if (strpos($identifier, '-') > 0) {
                        $response = $this->request('package', 'GET', array('signature' => $identifier));
                        if ($response) {
            Severity: Minor
            Found in core/model/modx/transport/modtransportprovider.class.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 downloadUrl has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function downloadUrl($signature, $location, array $args = array()) {
                    $url = false;
                    /** @var modRestClient $rest */
                    $rest = $this->xpdo->getService('rest','rest.modRestClient');
                    if ($rest) {
            Severity: Minor
            Found in core/model/modx/transport/modtransportprovider.class.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