filestack/filestack-php

View on GitHub

Showing 37 of 92 total issues

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

    public function testCollageSuccess()
    {
        $filelink = new Filelink($this->test_file_handle,
                        $this->test_api_key,
                        $this->test_security);
Severity: Minor
Found in tests/FilestackTransformTest.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 testCreatePartsIntelligentSuccess has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function testCreatePartsIntelligentSuccess()
          {
              $mock_response = new MockHttpResponse(200,
                  json_encode([
                      'filename'  => 'somefilename.jpg',
      Severity: Minor
      Found in tests/UploadProcessorTest.php - About 1 hr to fix

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

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

          Method testProcessPartsSuccess has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

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

            Method testCommitPartException has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function testCommitPartException()
                {
                    $this->expectException(FilestackException::class);
                    $this->expectExceptionCode(400);
            
            
            Severity: Minor
            Found in tests/UploadProcessorTest.php - About 1 hr to fix

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

                  protected function registerComplete($api_key, $parts_etags, $upload_data,
                                                        $metadata)
                  {
                      $data = [];
                      $this->appendData($data, 'apikey',          $api_key);
              Severity: Minor
              Found in filestack/UploadProcessor.php - About 1 hr to fix

                Method collage has 8 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    public function collage($sources, $width, $height, $store_options = [],
                        $color = 'white', $fit = 'auto', $margin = 10, $auto_rotate = false)
                Severity: Major
                Found in filestack/FilestackClient.php - About 1 hr to fix

                  Method collage has 7 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      public function collage($files, $width, $height,
                          $color = 'white', $fit = 'auto', $margin = 10, $auto_rotate = false)
                  Severity: Major
                  Found in filestack/Filelink.php - About 50 mins to fix

                    Method screenshot has 7 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        public function screenshot($url, $store_options = [],
                            $agent = 'desktop', $mode = 'all', $width = 1024, $height = 768, $delay = 0)
                    Severity: Major
                    Found in filestack/FilestackClient.php - About 50 mins to fix

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

                          public function __construct($handle, $api_key = '', $security = null,
                                                      $http_client = null, $cname = null)
                      Severity: Minor
                      Found in filestack/Filelink.php - About 35 mins to fix

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

                            protected function createTransformUrl($api_key, $type, $resource,
                                                                  $tasks_str, $security = null)
                        Severity: Minor
                        Found in filestack/mixins/TransformationMixin.php - About 35 mins to fix

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

                              public function ascii($background = 'white', $colored = false,
                                  $foreground='red', $reverse = false, $size = 100)
                          Severity: Minor
                          Found in filestack/Filelink.php - About 35 mins to fix

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

                                public function __construct($api_key, $security = null, $http_client = null,
                                    $upload_processor = null, $cname = null)
                            Severity: Minor
                            Found in filestack/FilestackClient.php - About 35 mins to fix

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

                                  protected function getSourceHeaders()
                                  {
                                      $headers = [];
                              
                                      if (!$this->user_agent_header || !$this->source_header) {
                              Severity: Minor
                              Found in filestack/mixins/CommonMixin.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 handleS3PromisesResult has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  protected function handleS3PromisesResult($s3_results)
                                  {
                                      foreach ($s3_results as $promise) {
                                          if ($promise['state'] !== 'fulfilled') {
                                              $code = HttpStatusCodes::HTTP_SERVICE_UNAVAILABLE;
                              Severity: Minor
                              Found in filestack/UploadProcessor.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 has a Cognitive Complexity of 6 (exceeds 5 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 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

                              Severity
                              Category
                              Status
                              Source
                              Language