modxcms/revolution

View on GitHub
core/xpdo/transport/xpdotransport.class.php

Summary

Maintainability
F
4 days
Test Coverage

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

<?php
/*
 * Copyright 2010-2015 by MODX, LLC.
 *
 * This file is part of xPDO.
Severity: Major
Found in core/xpdo/transport/xpdotransport.class.php - About 1 day to fix

    xPDOTransport has 27 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class xPDOTransport {
        /**#@+
         * Attributes of the package that can be used to control behavior.
         * @var string
         */
    Severity: Minor
    Found in core/xpdo/transport/xpdotransport.class.php - About 3 hrs to fix

      Function _pack has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function _pack(& $xpdo, $filename, $path, $source) {
              $packed = false;
              $packResults = false;
              $errors = array();
              if ($xpdo->getOption(xPDOTransport::ARCHIVE_WITH, null, 0) != xPDOTransport::ARCHIVE_WITH_PCLZIP && class_exists('ZipArchive', true) && $xpdo->loadClass('compression.xPDOZip', XPDO_CORE_PATH, true, true)) {
      Severity: Minor
      Found in core/xpdo/transport/xpdotransport.class.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 install has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          public function install($options= array ()) {
              $installed= false;
              $saved = array();
              $this->_preserved = array();
              if (!is_array($options)) {
      Severity: Minor
      Found in core/xpdo/transport/xpdotransport.class.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 retrieve has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function retrieve(& $xpdo, $source, $target, $state= xPDOTransport::STATE_PACKED) {
              $instance= null;
              $signature = basename($source, '.transport.zip');
              if (file_exists($source)) {
                  if (is_writable($target)) {
      Severity: Minor
      Found in core/xpdo/transport/xpdotransport.class.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

      Method satisfies has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function satisfies($version, $constraint) {
              $satisfied = false;
              $constraint = trim($constraint);
              if (substr($constraint, 0, 1) === '~') {
                  $requirement = substr($constraint, 1);
      Severity: Minor
      Found in core/xpdo/transport/xpdotransport.class.php - About 1 hr to fix

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

            public function uninstall($options = array ()) {
                $processed = array();
                if (!is_array($options)) {
                    $options= array(xPDOTransport::PACKAGE_ACTION => xPDOTransport::ACTION_UNINSTALL);
                } elseif (!isset($options[xPDOTransport::PACKAGE_ACTION])) {
        Severity: Minor
        Found in core/xpdo/transport/xpdotransport.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 retrieve has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function retrieve(& $xpdo, $source, $target, $state= xPDOTransport::STATE_PACKED) {
                $instance= null;
                $signature = basename($source, '.transport.zip');
                if (file_exists($source)) {
                    if (is_writable($target)) {
        Severity: Minor
        Found in core/xpdo/transport/xpdotransport.class.php - About 1 hr to fix

          Function satisfies has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function satisfies($version, $constraint) {
                  $satisfied = false;
                  $constraint = trim($constraint);
                  if (substr($constraint, 0, 1) === '~') {
                      $requirement = substr($constraint, 1);
          Severity: Minor
          Found in core/xpdo/transport/xpdotransport.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 _pack has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function _pack(& $xpdo, $filename, $path, $source) {
                  $packed = false;
                  $packResults = false;
                  $errors = array();
                  if ($xpdo->getOption(xPDOTransport::ARCHIVE_WITH, null, 0) != xPDOTransport::ARCHIVE_WITH_PCLZIP && class_exists('ZipArchive', true) && $xpdo->loadClass('compression.xPDOZip', XPDO_CORE_PATH, true, true)) {
          Severity: Minor
          Found in core/xpdo/transport/xpdotransport.class.php - About 1 hr to fix

            Function put has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                public function put($artifact, $attributes = array ()) {
                    $added= false;
                    if (!empty($artifact)) {
                        $vehiclePackage = isset($attributes['vehicle_package']) ? $attributes['vehicle_package'] : '';
                        $vehiclePackagePath = isset($attributes['vehicle_package_path']) ? $attributes['vehicle_package_path'] : '';
            Severity: Minor
            Found in core/xpdo/transport/xpdotransport.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 install has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function install($options= array ()) {
                    $installed= false;
                    $saved = array();
                    $this->_preserved = array();
                    if (!is_array($options)) {
            Severity: Minor
            Found in core/xpdo/transport/xpdotransport.class.php - About 1 hr to fix

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

                  public function get($objFile, $options= array ()) {
                      $vehicle = null;
                      $objFile = $this->path . $this->signature . '/' . $objFile;
                      $vehiclePackage = isset($options['vehicle_package']) ? $options['vehicle_package'] : '';
                      $vehiclePackagePath = isset($options['vehicle_package_path']) ? $options['vehicle_package_path'] : '';
              Severity: Minor
              Found in core/xpdo/transport/xpdotransport.class.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 writeManifest has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function writeManifest() {
                      $written = false;
                      if (!empty ($this->vehicles)) {
                          if (!empty($this->attributes['setup-options']) && is_array($this->attributes['setup-options'])) {
                              $cacheManager = $this->xpdo->getCacheManager();
              Severity: Minor
              Found in core/xpdo/transport/xpdotransport.class.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 parseSignature has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function parseSignature($signature) {
                      $exploded = explode('-', $signature);
                      $name = current($exploded);
                      $version = '';
                      $part = next($exploded);
              Severity: Minor
              Found in core/xpdo/transport/xpdotransport.class.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 checkPlatformDependencies has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function checkPlatformDependencies($dependencies) {
                      if (is_array($dependencies)) {
                          foreach ($dependencies as $depName => $depRequire) {
                              switch ($depName) {
                                  case 'php':
              Severity: Minor
              Found in core/xpdo/transport/xpdotransport.class.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 _unpack has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function _unpack(& $xpdo, $from, $to) {
                      $resources = false;
                      if ($xpdo->getOption(xPDOTransport::ARCHIVE_WITH, null, 0) != xPDOTransport::ARCHIVE_WITH_PCLZIP && class_exists('ZipArchive', true) && $xpdo->loadClass('compression.xPDOZip', XPDO_CORE_PATH, true, true)) {
                          $archive = new xPDOZip($xpdo, $from);
                          if ($archive) {
              Severity: Minor
              Found in core/xpdo/transport/xpdotransport.class.php - About 45 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 writePreserved has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function writePreserved() {
                      $written = false;
                      if (!empty($this->_preserved)) {
                          $content = var_export($this->_preserved, true);
                          $cacheManager = $this->xpdo->getCacheManager();
              Severity: Minor
              Found in core/xpdo/transport/xpdotransport.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 unpack has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function unpack(& $xpdo, $from, $to, $state = xPDOTransport::STATE_PACKED) {
                      $manifest= null;
                      if ($state !== xPDOTransport::STATE_UNPACKED) {
                          $resources = xPDOTransport::_unpack($xpdo, $from, $to);
                      } else {
              Severity: Minor
              Found in core/xpdo/transport/xpdotransport.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

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

                  protected static function _convertManifestVer1_0($manifestVehicles) {
                      $manifest = array();
                      foreach ($manifestVehicles as $vClass => $vehicles) {
                          foreach ($vehicles as $vKey => $vehicle) {
                              $entry = array(
              Severity: Minor
              Found in core/xpdo/transport/xpdotransport.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