brandon14/ebay-sdk-php

View on GitHub
src/Buy/Feed/V1/Api/FileApi.php

Summary

Maintainability
F
2 wks
Test Coverage

File FileApi.php has 617 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * This file is part of the trollandtoad/ebay-sdk-php package.
 *
Severity: Major
Found in src/Buy/Feed/V1/Api/FileApi.php - About 1 day to fix

    Method getFilesRequest has 102 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getFilesRequest($x_ebay_c_marketplace_id, $category_ids = null, $continuation_token = null, $feed_scope = null, $feed_type_id = null, $limit = null, $look_back = null)
        {
            // Verify the required parameter 'x_ebay_c_marketplace_id' is set.
            if ($x_ebay_c_marketplace_id === null || (\is_array($x_ebay_c_marketplace_id) && count($x_ebay_c_marketplace_id) === 0)) {
                throw new \InvalidArgumentException('Missing the required parameter $x_ebay_c_marketplace_id when calling getFiles');
    Severity: Major
    Found in src/Buy/Feed/V1/Api/FileApi.php - About 4 hrs to fix

      Function downloadFileRequest has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

          public function downloadFileRequest($file_id, $x_ebay_c_marketplace_id, $range = null)
          {
              // Verify the required parameter 'file_id' is set.
              if ($file_id === null || (\is_array($file_id) && count($file_id) === 0)) {
                  throw new \InvalidArgumentException('Missing the required parameter $file_id when calling downloadFile');
      Severity: Minor
      Found in src/Buy/Feed/V1/Api/FileApi.php - About 3 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 getFileRequest has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getFileRequest($file_id, $x_ebay_c_marketplace_id)
          {
              // Verify the required parameter 'file_id' is set.
              if ($file_id === null || (\is_array($file_id) && count($file_id) === 0)) {
                  throw new \InvalidArgumentException('Missing the required parameter $file_id when calling getFile');
      Severity: Minor
      Found in src/Buy/Feed/V1/Api/FileApi.php - About 3 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 downloadFileRequest has 73 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function downloadFileRequest($file_id, $x_ebay_c_marketplace_id, $range = null)
          {
              // Verify the required parameter 'file_id' is set.
              if ($file_id === null || (\is_array($file_id) && count($file_id) === 0)) {
                  throw new \InvalidArgumentException('Missing the required parameter $file_id when calling downloadFile');
      Severity: Major
      Found in src/Buy/Feed/V1/Api/FileApi.php - About 2 hrs to fix

        Method downloadFileWithHttpInfo has 72 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function downloadFileWithHttpInfo($file_id, $x_ebay_c_marketplace_id, $range = null)
            {
                $request = $this->downloadFileRequest($file_id, $x_ebay_c_marketplace_id, $range);
        
                try {
        Severity: Major
        Found in src/Buy/Feed/V1/Api/FileApi.php - About 2 hrs to fix

          Method getFileRequest has 70 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getFileRequest($file_id, $x_ebay_c_marketplace_id)
              {
                  // Verify the required parameter 'file_id' is set.
                  if ($file_id === null || (\is_array($file_id) && count($file_id) === 0)) {
                      throw new \InvalidArgumentException('Missing the required parameter $file_id when calling getFile');
          Severity: Major
          Found in src/Buy/Feed/V1/Api/FileApi.php - About 2 hrs to fix

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

                public function getFilesRequest($x_ebay_c_marketplace_id, $category_ids = null, $continuation_token = null, $feed_scope = null, $feed_type_id = null, $limit = null, $look_back = null)
                {
                    // Verify the required parameter 'x_ebay_c_marketplace_id' is set.
                    if ($x_ebay_c_marketplace_id === null || (\is_array($x_ebay_c_marketplace_id) && count($x_ebay_c_marketplace_id) === 0)) {
                        throw new \InvalidArgumentException('Missing the required parameter $x_ebay_c_marketplace_id when calling getFiles');
            Severity: Minor
            Found in src/Buy/Feed/V1/Api/FileApi.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 getFileWithHttpInfo has 53 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getFileWithHttpInfo($file_id, $x_ebay_c_marketplace_id)
                {
                    $request = $this->getFileRequest($file_id, $x_ebay_c_marketplace_id);
            
                    try {
            Severity: Major
            Found in src/Buy/Feed/V1/Api/FileApi.php - About 2 hrs to fix

              Method getFilesWithHttpInfo has 53 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function getFilesWithHttpInfo($x_ebay_c_marketplace_id, $category_ids = null, $continuation_token = null, $feed_scope = null, $feed_type_id = null, $limit = null, $look_back = null)
                  {
                      $request = $this->getFilesRequest($x_ebay_c_marketplace_id, $category_ids, $continuation_token, $feed_scope, $feed_type_id, $limit, $look_back);
              
                      try {
              Severity: Major
              Found in src/Buy/Feed/V1/Api/FileApi.php - About 2 hrs to fix

                Function downloadFileWithHttpInfo has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function downloadFileWithHttpInfo($file_id, $x_ebay_c_marketplace_id, $range = null)
                    {
                        $request = $this->downloadFileRequest($file_id, $x_ebay_c_marketplace_id, $range);
                
                        try {
                Severity: Minor
                Found in src/Buy/Feed/V1/Api/FileApi.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 getFilesWithHttpInfo has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getFilesWithHttpInfo($x_ebay_c_marketplace_id, $category_ids = null, $continuation_token = null, $feed_scope = null, $feed_type_id = null, $limit = null, $look_back = null)
                    {
                        $request = $this->getFilesRequest($x_ebay_c_marketplace_id, $category_ids, $continuation_token, $feed_scope, $feed_type_id, $limit, $look_back);
                
                        try {
                Severity: Minor
                Found in src/Buy/Feed/V1/Api/FileApi.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 getFileWithHttpInfo has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getFileWithHttpInfo($file_id, $x_ebay_c_marketplace_id)
                    {
                        $request = $this->getFileRequest($file_id, $x_ebay_c_marketplace_id);
                
                        try {
                Severity: Minor
                Found in src/Buy/Feed/V1/Api/FileApi.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 getFilesAsyncWithHttpInfo has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    public function getFilesAsyncWithHttpInfo($x_ebay_c_marketplace_id, $category_ids = null, $continuation_token = null, $feed_scope = null, $feed_type_id = null, $limit = null, $look_back = null)
                Severity: Major
                Found in src/Buy/Feed/V1/Api/FileApi.php - About 50 mins to fix

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

                      public function getFilesRequest($x_ebay_c_marketplace_id, $category_ids = null, $continuation_token = null, $feed_scope = null, $feed_type_id = null, $limit = null, $look_back = null)
                  Severity: Major
                  Found in src/Buy/Feed/V1/Api/FileApi.php - About 50 mins to fix

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

                        public function getFilesAsync($x_ebay_c_marketplace_id, $category_ids = null, $continuation_token = null, $feed_scope = null, $feed_type_id = null, $limit = null, $look_back = null)
                    Severity: Major
                    Found in src/Buy/Feed/V1/Api/FileApi.php - About 50 mins to fix

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

                          public function getFilesWithHttpInfo($x_ebay_c_marketplace_id, $category_ids = null, $continuation_token = null, $feed_scope = null, $feed_type_id = null, $limit = null, $look_back = null)
                      Severity: Major
                      Found in src/Buy/Feed/V1/Api/FileApi.php - About 50 mins to fix

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

                            public function getFiles($x_ebay_c_marketplace_id, $category_ids = null, $continuation_token = null, $feed_scope = null, $feed_type_id = null, $limit = null, $look_back = null)
                        Severity: Major
                        Found in src/Buy/Feed/V1/Api/FileApi.php - About 50 mins to fix

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

                              public function getFilesWithHttpInfo($x_ebay_c_marketplace_id, $category_ids = null, $continuation_token = null, $feed_scope = null, $feed_type_id = null, $limit = null, $look_back = null)
                              {
                                  $request = $this->getFilesRequest($x_ebay_c_marketplace_id, $category_ids, $continuation_token, $feed_scope, $feed_type_id, $limit, $look_back);
                          
                                  try {
                          Severity: Major
                          Found in src/Buy/Feed/V1/Api/FileApi.php and 1 other location - About 3 days to fix
                          src/Sell/Marketing/V1/Api/PromotionApi.php on lines 507..572

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

                          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 5 locations. Consider refactoring.
                          Open

                              public function getFileRequest($file_id, $x_ebay_c_marketplace_id)
                              {
                                  // Verify the required parameter 'file_id' is set.
                                  if ($file_id === null || (\is_array($file_id) && count($file_id) === 0)) {
                                      throw new \InvalidArgumentException('Missing the required parameter $file_id when calling getFile');
                          Severity: Major
                          Found in src/Buy/Feed/V1/Api/FileApi.php and 4 other locations - About 2 days to fix
                          src/Buy/Deal/V1/Api/EventApi.php on lines 318..410
                          src/Buy/OfferBeta/V1/Api/BiddingApi.php on lines 318..410
                          src/Buy/Order/V2/Api/GuestCheckoutSessionApi.php on lines 589..681
                          src/Commerce/Charity/V1/Api/CharityOrgApi.php on lines 318..410

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

                          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 getFilesAsyncWithHttpInfo($x_ebay_c_marketplace_id, $category_ids = null, $continuation_token = null, $feed_scope = null, $feed_type_id = null, $limit = null, $look_back = null)
                              {
                                  $returnType = '\TNT\Ebay\Buy\Feed\V1\Model\FileMetadataSearchResponse';
                                  $request = $this->getFilesRequest($x_ebay_c_marketplace_id, $category_ids, $continuation_token, $feed_scope, $feed_type_id, $limit, $look_back);
                          
                          
                          Severity: Major
                          Found in src/Buy/Feed/V1/Api/FileApi.php and 1 other location - About 1 day to fix
                          src/Sell/Marketing/V1/Api/PromotionApi.php on lines 614..642

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

                          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 9 locations. Consider refactoring.
                          Open

                              public function downloadFileAsyncWithHttpInfo($file_id, $x_ebay_c_marketplace_id, $range = null)
                              {
                                  $returnType = 'object';
                                  $request = $this->downloadFileRequest($file_id, $x_ebay_c_marketplace_id, $range);
                          
                          
                          Severity: Major
                          Found in src/Buy/Feed/V1/Api/FileApi.php and 8 other locations - About 7 hrs to fix
                          src/Buy/Browse/V1/Api/ItemApi.php on lines 282..310
                          src/Buy/OfferBeta/V1/Api/BiddingApi.php on lines 542..570
                          src/Buy/Order/V2/Api/GuestCheckoutSessionApi.php on lines 282..310
                          src/Buy/Order/V2/Api/GuestCheckoutSessionApi.php on lines 1075..1103
                          src/Buy/Order/V2/Api/GuestCheckoutSessionApi.php on lines 1346..1374
                          src/Buy/Order/V2/Api/GuestCheckoutSessionApi.php on lines 1617..1645
                          src/Buy/Order/V2/Api/GuestCheckoutSessionApi.php on lines 1888..1916
                          src/Sell/Marketing/V1/Api/AdGroupApi.php on lines 1386..1414

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

                          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 getFilesAsync($x_ebay_c_marketplace_id, $category_ids = null, $continuation_token = null, $feed_scope = null, $feed_type_id = null, $limit = null, $look_back = null)
                              {
                                  return $this->getFilesAsyncWithHttpInfo($x_ebay_c_marketplace_id, $category_ids, $continuation_token, $feed_scope, $feed_type_id, $limit, $look_back)
                                      ->then(
                                          function ($response) {
                          Severity: Major
                          Found in src/Buy/Feed/V1/Api/FileApi.php and 1 other location - About 1 hr to fix
                          src/Sell/Marketing/V1/Api/PromotionApi.php on lines 589..597

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

                          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 getFiles($x_ebay_c_marketplace_id, $category_ids = null, $continuation_token = null, $feed_scope = null, $feed_type_id = null, $limit = null, $look_back = null)
                              {
                                  [$response] = $this->getFilesWithHttpInfo($x_ebay_c_marketplace_id, $category_ids, $continuation_token, $feed_scope, $feed_type_id, $limit, $look_back);
                          
                                  return $response;
                          Severity: Minor
                          Found in src/Buy/Feed/V1/Api/FileApi.php and 1 other location - About 1 hr to fix
                          src/Sell/Marketing/V1/Api/PromotionApi.php on lines 484..489

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

                          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