modxcms/revolution

View on GitHub
core/model/aws/services/s3.class.php

Summary

Maintainability
F
2 wks
Test Coverage

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

<?php
/*
 * Copyright 2010-2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License").
Severity: Major
Found in core/model/aws/services/s3.class.php - About 4 days to fix

    Function authenticate has a Cognitive Complexity of 85 (exceeds 5 allowed). Consider refactoring.
    Open

        public function authenticate($bucket, $opt = null, $location = null, $redirects = 0, $nothing = null)
        {
            /*
             * Overriding or extending this class? You can pass the following "magic" keys into $opt.
             *
    Severity: Minor
    Found in core/model/aws/services/s3.class.php - About 1 day 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 authenticate has 293 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function authenticate($bucket, $opt = null, $location = null, $redirects = 0, $nothing = null)
        {
            /*
             * Overriding or extending this class? You can pass the following "magic" keys into $opt.
             *
    Severity: Major
    Found in core/model/aws/services/s3.class.php - About 1 day to fix

      AmazonS3 has 67 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class AmazonS3 extends CFRuntime
      {
          /*%******************************************************************************************%*/
          // CLASS CONSTANTS
      
      
      Severity: Major
      Found in core/model/aws/services/s3.class.php - About 1 day to fix

        Function create_mpu_object has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
        Open

            public function create_mpu_object($bucket, $filename, $opt = null)
            {
                if ($this->use_batch_flow)
                {
                    throw new S3_Exception(__FUNCTION__ . '() cannot be batch requested');
        Severity: Minor
        Found in core/model/aws/services/s3.class.php - About 5 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 create_mpu_object has 111 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function create_mpu_object($bucket, $filename, $opt = null)
            {
                if ($this->use_batch_flow)
                {
                    throw new S3_Exception(__FUNCTION__ . '() cannot be batch requested');
        Severity: Major
        Found in core/model/aws/services/s3.class.php - About 4 hrs to fix

          Method copy_object has 81 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function copy_object($source, $dest, $opt = null)
              {
                  if (!$opt) $opt = array();
                  $batch = array();
          
          
          Severity: Major
          Found in core/model/aws/services/s3.class.php - About 3 hrs to fix

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

                public function copy_object($source, $dest, $opt = null)
                {
                    if (!$opt) $opt = array();
                    $batch = array();
            
            
            Severity: Minor
            Found in core/model/aws/services/s3.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 delete_all_object_versions has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

                public function delete_all_object_versions($bucket, $pcre = null)
                {
                    if ($this->use_batch_flow)
                    {
                        // @codeCoverageIgnoreStart
            Severity: Minor
            Found in core/model/aws/services/s3.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 delete_all_object_versions has 59 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function delete_all_object_versions($bucket, $pcre = null)
                {
                    if ($this->use_batch_flow)
                    {
                        // @codeCoverageIgnoreStart
            Severity: Major
            Found in core/model/aws/services/s3.class.php - About 2 hrs to fix

              Consider simplifying this complex logical expression.
              Open

                      if (
                          ($bucket === null || $bucket === false) ||                  // Must not be null or false
                          preg_match('/[^(a-z0-9\-\.)]/', $bucket) ||                 // Must be in the lowercase Roman alphabet, period or hyphen
                          !preg_match('/^([a-z]|\d)/', $bucket) ||                    // Must start with a number or letter
                          !(strlen($bucket) >= 3 && strlen($bucket) <= 63) ||         // Must be between 3 and 63 characters long
              Severity: Critical
              Found in core/model/aws/services/s3.class.php - About 2 hrs to fix

                Method get_object_list has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function get_object_list($bucket, $opt = null)
                    {
                        if ($this->use_batch_flow)
                        {
                            throw new S3_Exception(__FUNCTION__ . '() cannot be batch requested');
                Severity: Major
                Found in core/model/aws/services/s3.class.php - About 2 hrs to fix

                  Method enable_logging has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function enable_logging($bucket, $target_bucket, $target_prefix, $opt = null)
                      {
                          // Add this to our request
                          if (!$opt) $opt = array();
                          $opt['verb'] = 'PUT';
                  Severity: Minor
                  Found in core/model/aws/services/s3.class.php - About 1 hr to fix

                    Method get_object_metadata has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function get_object_metadata($bucket, $filename, $opt = null)
                        {
                            $batch = new CFBatchRequest();
                            $this->batch($batch)->get_object_acl($bucket, $filename); // Get ACL info
                            $this->batch($batch)->get_object_headers($bucket, $filename); // Get content-type
                    Severity: Minor
                    Found in core/model/aws/services/s3.class.php - About 1 hr to fix

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

                          public function enable_logging($bucket, $target_bucket, $target_prefix, $opt = null)
                          {
                              // Add this to our request
                              if (!$opt) $opt = array();
                              $opt['verb'] = 'PUT';
                      Severity: Minor
                      Found in core/model/aws/services/s3.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 complete_multipart_upload has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function complete_multipart_upload($bucket, $filename, $upload_id, $parts, $opt = null)
                          {
                              if (!$opt) $opt = array();
                      
                              // Add this to our request
                      Severity: Minor
                      Found in core/model/aws/services/s3.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 complete_multipart_upload has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function complete_multipart_upload($bucket, $filename, $upload_id, $parts, $opt = null)
                          {
                              if (!$opt) $opt = array();
                      
                              // Add this to our request
                      Severity: Minor
                      Found in core/model/aws/services/s3.class.php - About 1 hr to fix

                        Method generate_access_policy has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function generate_access_policy($canonical_id, $canonical_name, $users)
                            {
                                $xml = simplexml_load_string($this->base_acp_xml);
                                $owner = $xml->addChild('Owner');
                                $owner->addChild('ID', $canonical_id);
                        Severity: Minor
                        Found in core/model/aws/services/s3.class.php - About 1 hr to fix

                          Method create_bucket has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function create_bucket($bucket, $region, $acl = self::ACL_PRIVATE, $opt = null)
                              {
                                  // If the bucket contains uppercase letters...
                                  if (preg_match('/[A-Z]/', $bucket))
                                  {
                          Severity: Minor
                          Found in core/model/aws/services/s3.class.php - About 1 hr to fix

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

                                public function copy_part($source, $dest, $upload_id, $part_number, $opt = null)
                                {
                                    if (!$opt) $opt = array();
                            
                                    // Add this to our request
                            Severity: Minor
                            Found in core/model/aws/services/s3.class.php - About 1 hr to fix

                              Method abort_multipart_uploads_by_date has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function abort_multipart_uploads_by_date($bucket, $when = null)
                                  {
                                      if ($this->use_batch_flow)
                                      {
                                          // @codeCoverageIgnoreStart
                              Severity: Minor
                              Found in core/model/aws/services/s3.class.php - About 1 hr to fix

                                Method initiate_multipart_upload has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function initiate_multipart_upload($bucket, $filename, $opt = null)
                                    {
                                        if (!$opt) $opt = array();
                                
                                        // Add this to our request
                                Severity: Minor
                                Found in core/model/aws/services/s3.class.php - About 1 hr to fix

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

                                      public function create_object($bucket, $filename, $opt = null)
                                      {
                                          if (!$opt) $opt = array();
                                  
                                          // Add this to our request
                                  Severity: Minor
                                  Found in core/model/aws/services/s3.class.php - About 1 hr to fix

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

                                        public function get_object_list($bucket, $opt = null)
                                        {
                                            if ($this->use_batch_flow)
                                            {
                                                throw new S3_Exception(__FUNCTION__ . '() cannot be batch requested');
                                    Severity: Minor
                                    Found in core/model/aws/services/s3.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 set_object_acl has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        public function set_object_acl($bucket, $filename, $acl = self::ACL_PRIVATE, $opt = null)
                                        {
                                            // Add this to our request
                                            if (!$opt) $opt = array();
                                            $opt['verb'] = 'PUT';
                                    Severity: Minor
                                    Found in core/model/aws/services/s3.class.php - About 1 hr to fix

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

                                          public function get_object($bucket, $filename, $opt = null)
                                          {
                                              if (!$opt) $opt = array();
                                      
                                              // Add this to our request
                                      Severity: Minor
                                      Found in core/model/aws/services/s3.class.php - About 1 hr to fix

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

                                            public function get_bucket_filesize($bucket, $friendly_format = false)
                                            {
                                                if ($this->use_batch_flow)
                                                {
                                                    throw new S3_Exception(__FUNCTION__ . '() cannot be batch requested');
                                        Severity: Minor
                                        Found in core/model/aws/services/s3.class.php - About 1 hr to fix

                                          Consider simplifying this complex logical expression.
                                          Open

                                                  if (
                                                      ($bucket === null || $bucket === false) ||                  // Must not be null or false
                                                      preg_match('/[^(a-z0-9_\-\.)]/i', $bucket) ||               // Must be in the Roman alphabet, period, hyphen or underscore
                                                      !preg_match('/^([a-z]|\d)/i', $bucket) ||                   // Must start with a number or letter
                                                      !(strlen($bucket) >= 3 && strlen($bucket) <= 255) ||        // Must be between 3 and 255 characters long
                                          Severity: Major
                                          Found in core/model/aws/services/s3.class.php - About 1 hr to fix

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

                                                public function get_object($bucket, $filename, $opt = null)
                                                {
                                                    if (!$opt) $opt = array();
                                            
                                                    // Add this to our request
                                            Severity: Minor
                                            Found in core/model/aws/services/s3.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 generate_access_policy has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                                public function generate_access_policy($canonical_id, $canonical_name, $users)
                                                {
                                                    $xml = simplexml_load_string($this->base_acp_xml);
                                                    $owner = $xml->addChild('Owner');
                                                    $owner->addChild('ID', $canonical_id);
                                            Severity: Minor
                                            Found in core/model/aws/services/s3.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 set_object_acl has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                                public function set_object_acl($bucket, $filename, $acl = self::ACL_PRIVATE, $opt = null)
                                                {
                                                    // Add this to our request
                                                    if (!$opt) $opt = array();
                                                    $opt['verb'] = 'PUT';
                                            Severity: Minor
                                            Found in core/model/aws/services/s3.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 initiate_multipart_upload has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                                public function initiate_multipart_upload($bucket, $filename, $opt = null)
                                                {
                                                    if (!$opt) $opt = array();
                                            
                                                    // Add this to our request
                                            Severity: Minor
                                            Found in core/model/aws/services/s3.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 copy_part has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                                public function copy_part($source, $dest, $upload_id, $part_number, $opt = null)
                                                {
                                                    if (!$opt) $opt = array();
                                            
                                                    // Add this to our request
                                            Severity: Minor
                                            Found in core/model/aws/services/s3.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 create_object has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                                public function create_object($bucket, $filename, $opt = null)
                                                {
                                                    if (!$opt) $opt = array();
                                            
                                                    // Add this to our request
                                            Severity: Minor
                                            Found in core/model/aws/services/s3.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

                                            Consider simplifying this complex logical expression.
                                            Open

                                                        if (
                                                            strtolower($header_key) === 'content-md5' ||
                                                            strtolower($header_key) === 'content-type' ||
                                                            strtolower($header_key) === 'date' ||
                                                            (strtolower($header_key) === 'expires' && isset($opt['preauth']) && (integer) $opt['preauth'] > 0)
                                            Severity: Major
                                            Found in core/model/aws/services/s3.class.php - About 40 mins to fix

                                              Method complete_multipart_upload has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                              Open

                                                  public function complete_multipart_upload($bucket, $filename, $upload_id, $parts, $opt = null)
                                              Severity: Minor
                                              Found in core/model/aws/services/s3.class.php - About 35 mins to fix

                                                Method authenticate has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                Open

                                                    public function authenticate($bucket, $opt = null, $location = null, $redirects = 0, $nothing = null)
                                                Severity: Minor
                                                Found in core/model/aws/services/s3.class.php - About 35 mins to fix

                                                  Method copy_part has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                  Open

                                                      public function copy_part($source, $dest, $upload_id, $part_number, $opt = null)
                                                  Severity: Minor
                                                  Found in core/model/aws/services/s3.class.php - About 35 mins to fix

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

                                                        public function create_bucket($bucket, $region, $acl = self::ACL_PRIVATE, $opt = null)
                                                        {
                                                            // If the bucket contains uppercase letters...
                                                            if (preg_match('/[A-Z]/', $bucket))
                                                            {
                                                    Severity: Minor
                                                    Found in core/model/aws/services/s3.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

                                                    Avoid too many return statements within this method.
                                                    Open

                                                                return $request->prep_request();
                                                    Severity: Major
                                                    Found in core/model/aws/services/s3.class.php - About 30 mins to fix

                                                      Avoid too many return statements within this method.
                                                      Open

                                                                  return $this->request_url;
                                                      Severity: Major
                                                      Found in core/model/aws/services/s3.class.php - About 30 mins to fix

                                                        Avoid too many return statements within this method.
                                                        Open

                                                                return $data;
                                                        Severity: Major
                                                        Found in core/model/aws/services/s3.class.php - About 30 mins to fix

                                                          Avoid too many return statements within this method.
                                                          Open

                                                                      return $handle;
                                                          Severity: Major
                                                          Found in core/model/aws/services/s3.class.php - About 30 mins to fix

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

                                                                public function get_bucket_filesize($bucket, $friendly_format = false)
                                                                {
                                                                    if ($this->use_batch_flow)
                                                                    {
                                                                        throw new S3_Exception(__FUNCTION__ . '() cannot be batch requested');
                                                            Severity: Minor
                                                            Found in core/model/aws/services/s3.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 upload_part has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                            Open

                                                                public function upload_part($bucket, $filename, $upload_id, $opt = null)
                                                                {
                                                                    if (!$opt) $opt = array();
                                                            
                                                                    // Add this to our request
                                                            Severity: Minor
                                                            Found in core/model/aws/services/s3.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 get_object_url has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                            Open

                                                                public function get_object_url($bucket, $filename, $preauth = 0, $opt = null)
                                                                {
                                                                    // Add this to our request
                                                                    if (!$opt) $opt = array();
                                                                    $opt['verb'] = isset($opt['method']) ? $opt['method'] : 'GET';
                                                            Severity: Minor
                                                            Found in core/model/aws/services/s3.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

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

                                                                        foreach ($opt['users'] as $user)
                                                                        {
                                                                            $grant = $TargetGrants->addChild('Grant');
                                                                            $grantee = $grant->addChild('Grantee');
                                                            
                                                            
                                                            Severity: Major
                                                            Found in core/model/aws/services/s3.class.php and 1 other location - About 1 day to fix
                                                            core/model/aws/services/s3.class.php on lines 1648..1690

                                                            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 252.

                                                            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

                                                                    foreach ($users as $user)
                                                                    {
                                                                        $grant = $acl->addChild('Grant');
                                                                        $grantee = $grant->addChild('Grantee');
                                                            
                                                            
                                                            Severity: Major
                                                            Found in core/model/aws/services/s3.class.php and 1 other location - About 1 day to fix
                                                            core/model/aws/services/s3.class.php on lines 1752..1794

                                                            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 252.

                                                            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 function enable_versioning($bucket, $opt = null)
                                                                {
                                                                    if (!$opt) $opt = array();
                                                            
                                                                    // Add this to our request
                                                            Severity: Major
                                                            Found in core/model/aws/services/s3.class.php and 1 other location - About 5 hrs to fix
                                                            core/model/aws/services/s3.class.php on lines 2501..2528

                                                            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 203.

                                                            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 function disable_versioning($bucket, $opt = null)
                                                                {
                                                                    if (!$opt) $opt = array();
                                                            
                                                                    // Add this to our request
                                                            Severity: Major
                                                            Found in core/model/aws/services/s3.class.php and 1 other location - About 5 hrs to fix
                                                            core/model/aws/services/s3.class.php on lines 2459..2486

                                                            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 203.

                                                            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

                                                                    if ($this->use_cache_flow)
                                                                    {
                                                                        // Generate an identifier specific to this particular set of arguments.
                                                                        $cache_id = $this->key . '_' . get_class($this) . '_' . $bucket . '_' . sha1(serialize($method_arguments));
                                                            
                                                            
                                                            Severity: Major
                                                            Found in core/model/aws/services/s3.class.php and 1 other location - About 4 hrs to fix
                                                            core/model/aws/sdk.class.php on lines 885..908

                                                            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 173.

                                                            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 function cache_callback($bucket, $opt = null, $location = null, $redirects = 0)
                                                                {
                                                                    // Disable the cache flow since it's already been handled.
                                                                    $this->use_cache_flow = false;
                                                            
                                                            
                                                            Severity: Major
                                                            Found in core/model/aws/services/s3.class.php and 1 other location - About 1 hr to fix
                                                            core/model/aws/sdk.class.php on lines 1468..1483

                                                            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 103.

                                                            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

                                                            There are no issues that match your filters.

                                                            Category
                                                            Status