filestack/filestack-php

View on GitHub

Showing 37 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

                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

                    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

                      Method createParts has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          protected function createParts($api_key, $metadata, $upload_data)
                          {
                              $parts = [];
                              $max_part_size = FilestackConfig::UPLOAD_PART_SIZE;
                              $max_chunk_size = FilestackConfig::UPLOAD_CHUNK_SIZE;
                      Severity: Major
                      Found in filestack/UploadProcessor.php - About 2 hrs to fix

                        Function createParts has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                        Open

                            protected function createParts($api_key, $metadata, $upload_data)
                            {
                                $parts = [];
                                $max_part_size = FilestackConfig::UPLOAD_PART_SIZE;
                                $max_chunk_size = FilestackConfig::UPLOAD_CHUNK_SIZE;
                        Severity: Minor
                        Found in filestack/UploadProcessor.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 processChunks has 44 lines of code (exceeds 25 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 1 hr to fix

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

                              public function upload($filepath, $options = [])
                              {
                                  if (!file_exists($filepath)) {
                                      throw new FilestackException("File not found", 400);
                                  }
                          Severity: Minor
                          Found in filestack/FilestackClient.php - About 1 hr to fix

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

                                public function testProcessChunks()
                                {
                                    $mock_response1 = new MockHttpResponse(408,  '{"error": "timed out"}');
                                    $mock_response2 = new MockHttpResponse(504,  '{"error": "Gateway timed out"}');
                                    $mock_response3 = new MockHttpResponse(200,
                            Severity: Minor
                            Found in tests/UploadProcessorTest.php - About 1 hr to fix

                              Method testCollageSuccess has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function testCollageSuccess()
                                  {
                                      $mock_response = new MockHttpResponse(
                                          200,
                                          '{"url": "http://cdn.filestackcontent.com/somehandle",'.
                              Severity: Minor
                              Found in tests/FilestackClientTest.php - About 1 hr to fix

                                Method testUploadIntelligentSuccess has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function testUploadIntelligentSuccess()
                                    {
                                        $mock_response_202 = new MockHttpResponse(202,  '{accepted: true}');
                                        $mock_response = new MockHttpResponse(200,
                                            json_encode([
                                Severity: Minor
                                Found in tests/FilestackClientTest.php - About 1 hr to fix

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

                                      public function testUploadSuccessWithOptions()
                                      {
                                          $test_headers = ['ETag' =>['some-etag']];
                                          $mock_response = new MockHttpResponse(200,
                                              json_encode([
                                  Severity: Minor
                                  Found in tests/FilestackClientTest.php - About 1 hr to fix

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

                                        public function testconvertVideoSuccess()
                                        {
                                            $mock_response = new MockHttpResponse(
                                                200,
                                                '{"uuid" : "some_uuid", "conversion_url": "http://someurl.com/handle"}'
                                    Severity: Minor
                                    Found in tests/FilestackClientTest.php - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language