filestack/filestack-php

View on GitHub

Showing 91 of 92 total issues

File FilestackClientTest.php has 779 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
namespace Filestack\Tests;

use Filestack\FilestackClient;
use Filestack\FilestackSecurity;
Severity: Major
Found in tests/FilestackClientTest.php - About 1 day to fix

    File FilestackTransformTest.php has 753 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    namespace Filestack\Tests;
    
    use Filestack\FilestackConfig;
    use Filestack\Filelink;
    Severity: Major
    Found in tests/FilestackTransformTest.php - About 1 day to fix

      Filelink has 52 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Filelink
      {
          use Mixins\CommonMixin;
          use Mixins\TransformationMixin;
      
      
      Severity: Major
      Found in filestack/Filelink.php - About 7 hrs to fix

        File Filelink.php has 403 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        namespace Filestack;
        
        use GuzzleHttp\Client;
        use Filestack\FilestackConfig;
        Severity: Minor
        Found in filestack/Filelink.php - About 5 hrs to fix

          File UploadProcessorTest.php has 391 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          namespace Filestack\Tests;
          
          use Filestack\FilestackConfig;
          use Filestack\UploadProcessor;
          Severity: Minor
          Found in tests/UploadProcessorTest.php - About 5 hrs to fix

            FilestackTransformTest has 40 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class FilestackTransformTest extends BaseTest
            {
                /**
                 * Test debugging a transformation url of a chained call
                 */
            Severity: Minor
            Found in tests/FilestackTransformTest.php - About 5 hrs to fix

              FilestackClientTest has 38 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class FilestackClientTest extends BaseTest
              {
                  /**
                   * Test initializing FilestackClient with an API Key
                   */
              Severity: Minor
              Found in tests/FilestackClientTest.php - About 5 hrs to fix

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

                    public function testPartialBlurSuccess()
                    {
                        $filelink = new Filelink($this->test_file_handle,
                                        $this->test_api_key,
                                        $this->test_security);
                Severity: Major
                Found in tests/FilestackTransformTest.php and 1 other location - About 4 hrs to fix
                tests/FilestackTransformTest.php on lines 671..696

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

                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 testPartialPixelateSuccess()
                    {
                        $filelink = new Filelink($this->test_file_handle,
                                        $this->test_api_key,
                                        $this->test_security);
                Severity: Major
                Found in tests/FilestackTransformTest.php and 1 other location - About 4 hrs to fix
                tests/FilestackTransformTest.php on lines 641..666

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

                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

                File FilelinkTest.php has 350 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                namespace Filestack\Tests;
                
                use Filestack\Filelink;
                use Filestack\FilestackSecurity;
                Severity: Minor
                Found in tests/FilelinkTest.php - About 4 hrs to fix

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

                  <?php
                  namespace Filestack;
                  
                  use Filestack\FilestackConfig;
                  use Filestack\HttpStatusCodes;
                  Severity: Minor
                  Found in filestack/UploadProcessor.php - About 4 hrs to fix

                    The class UploadProcessor has an overall complexity of 52 which is very high. The configured complexity threshold is 50.
                    Open

                    class UploadProcessor
                    {
                        use Mixins\CommonMixin;
                    
                        public $api_key;
                    Severity: Minor
                    Found in filestack/UploadProcessor.php by phpmd

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

                        public function testTransformationFailed()
                        {
                            $mock_response = new MockHttpResponse(
                                403,
                                'Forbidden, Missing credentials'
                    Severity: Major
                    Found in tests/FilestackTransformTest.php and 1 other location - About 2 hrs to fix
                    tests/FilestackTransformTest.php on lines 117..138

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

                    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 testTransformInvalidTaskThrowsException()
                        {
                            $mock_response = new MockHttpResponse(
                                400,
                                'Invalid transformation task'
                    Severity: Major
                    Found in tests/FilestackTransformTest.php and 1 other location - About 2 hrs to fix
                    tests/FilestackTransformTest.php on lines 91..112

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

                    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 testOverwriteSuccess()
                        {
                            $mock_response = new MockHttpResponse(
                                200,
                                json_encode([
                    Severity: Major
                    Found in tests/FilestackClientTest.php and 1 other location - About 2 hrs to fix
                    tests/FilestackClientTest.php on lines 872..896

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

                    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 testOverwriteUrlSuccess()
                        {
                            $mock_response = new MockHttpResponse(
                                200,
                                json_encode([
                    Severity: Major
                    Found in tests/FilestackClientTest.php and 1 other location - About 2 hrs to fix
                    tests/FilestackClientTest.php on lines 816..839

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

                    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

                    FilelinkTest has 23 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    class FilelinkTest extends BaseTest
                    {
                        /**
                         * Test initializing Filelink intialized with handle and API Key
                         */
                    Severity: Minor
                    Found in tests/FilelinkTest.php - About 2 hrs to fix

                      Function processChunks has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                      Open

                          protected function processChunks($part, $chunks)
                          {
                              $upload_url = $this->getCustomUrl(FilestackConfig::UPLOAD_URL) . '/multipart/upload';
                              $max_retries = FilestackConfig::MAX_RETRIES;
                      
                      
                      Severity: Minor
                      Found in filestack/UploadProcessor.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

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

                          public function testPolaroidSuccess()
                          {
                              $filelink = new Filelink($this->test_file_handle,
                                              $this->test_api_key,
                                              $this->test_security);
                      Severity: Major
                      Found in tests/FilestackTransformTest.php and 1 other location - About 2 hrs to fix
                      tests/FilestackTransformTest.php on lines 350..372

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

                      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 testBorderSuccess()
                          {
                              $filelink = new Filelink($this->test_file_handle,
                                              $this->test_api_key,
                                              $this->test_security);
                      Severity: Major
                      Found in tests/FilestackTransformTest.php and 1 other location - About 2 hrs to fix
                      tests/FilestackTransformTest.php on lines 725..747

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

                      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

                      Severity
                      Category
                      Status
                      Source
                      Language