brandon14/ebay-sdk-php

View on GitHub
src/Sell/Inventory/V1/Api/InventoryItemApi.php

Summary

Maintainability
F
2 wks
Test Coverage

File InventoryItemApi.php has 1191 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/Sell/Inventory/V1/Api/InventoryItemApi.php - About 3 days to fix

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

    class InventoryItemApi
    {
        /**
         * @var ClientInterface
         */
    Severity: Minor
    Found in src/Sell/Inventory/V1/Api/InventoryItemApi.php - About 5 hrs to fix

      Function createOrReplaceInventoryItemRequest has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
      Open

          public function createOrReplaceInventoryItemRequest($content_language, $sku, $inventory_item)
          {
              // Verify the required parameter 'content_language' is set.
              if ($content_language === null || (\is_array($content_language) && count($content_language) === 0)) {
                  throw new \InvalidArgumentException('Missing the required parameter $content_language when calling createOrReplaceInventoryItem');
      Severity: Minor
      Found in src/Sell/Inventory/V1/Api/InventoryItemApi.php - About 4 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 bulkCreateOrReplaceInventoryItemRequest has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

          public function bulkCreateOrReplaceInventoryItemRequest($bulk_inventory_item)
          {
              // Verify the required parameter 'bulk_inventory_item' is set.
              if ($bulk_inventory_item === null || (\is_array($bulk_inventory_item) && count($bulk_inventory_item) === 0)) {
                  throw new \InvalidArgumentException('Missing the required parameter $bulk_inventory_item when calling bulkCreateOrReplaceInventoryItem');
      Severity: Minor
      Found in src/Sell/Inventory/V1/Api/InventoryItemApi.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 bulkUpdatePriceQuantityRequest has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

          public function bulkUpdatePriceQuantityRequest($bulk_price_quantity)
          {
              // Verify the required parameter 'bulk_price_quantity' is set.
              if ($bulk_price_quantity === null || (\is_array($bulk_price_quantity) && count($bulk_price_quantity) === 0)) {
                  throw new \InvalidArgumentException('Missing the required parameter $bulk_price_quantity when calling bulkUpdatePriceQuantity');
      Severity: Minor
      Found in src/Sell/Inventory/V1/Api/InventoryItemApi.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 bulkGetInventoryItemRequest has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

          public function bulkGetInventoryItemRequest($bulk_get_inventory_item)
          {
              // Verify the required parameter 'bulk_get_inventory_item' is set.
              if ($bulk_get_inventory_item === null || (\is_array($bulk_get_inventory_item) && count($bulk_get_inventory_item) === 0)) {
                  throw new \InvalidArgumentException('Missing the required parameter $bulk_get_inventory_item when calling bulkGetInventoryItem');
      Severity: Minor
      Found in src/Sell/Inventory/V1/Api/InventoryItemApi.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 createOrReplaceInventoryItemRequest has 79 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function createOrReplaceInventoryItemRequest($content_language, $sku, $inventory_item)
          {
              // Verify the required parameter 'content_language' is set.
              if ($content_language === null || (\is_array($content_language) && count($content_language) === 0)) {
                  throw new \InvalidArgumentException('Missing the required parameter $content_language when calling createOrReplaceInventoryItem');
      Severity: Major
      Found in src/Sell/Inventory/V1/Api/InventoryItemApi.php - About 3 hrs to fix

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

            public function createOrReplaceInventoryItemWithHttpInfo($content_language, $sku, $inventory_item)
            {
                $request = $this->createOrReplaceInventoryItemRequest($content_language, $sku, $inventory_item);
        
                try {
        Severity: Major
        Found in src/Sell/Inventory/V1/Api/InventoryItemApi.php - About 2 hrs to fix

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

              public function getInventoryItemRequest($sku)
              {
                  // Verify the required parameter 'sku' is set.
                  if ($sku === null || (\is_array($sku) && count($sku) === 0)) {
                      throw new \InvalidArgumentException('Missing the required parameter $sku when calling getInventoryItem');
          Severity: Minor
          Found in src/Sell/Inventory/V1/Api/InventoryItemApi.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 deleteInventoryItemRequest has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

              public function deleteInventoryItemRequest($sku)
              {
                  // Verify the required parameter 'sku' is set.
                  if ($sku === null || (\is_array($sku) && count($sku) === 0)) {
                      throw new \InvalidArgumentException('Missing the required parameter $sku when calling deleteInventoryItem');
          Severity: Minor
          Found in src/Sell/Inventory/V1/Api/InventoryItemApi.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 getInventoryItemsRequest has 68 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getInventoryItemsRequest($limit = null, $offset = null)
              {
                  $resourcePath = '/inventory_item';
                  $formParams = [];
                  $queryParams = [];
          Severity: Major
          Found in src/Sell/Inventory/V1/Api/InventoryItemApi.php - About 2 hrs to fix

            Method getInventoryItemRequest has 64 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getInventoryItemRequest($sku)
                {
                    // Verify the required parameter 'sku' is set.
                    if ($sku === null || (\is_array($sku) && count($sku) === 0)) {
                        throw new \InvalidArgumentException('Missing the required parameter $sku when calling getInventoryItem');
            Severity: Major
            Found in src/Sell/Inventory/V1/Api/InventoryItemApi.php - About 2 hrs to fix

              Method deleteInventoryItemRequest has 64 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function deleteInventoryItemRequest($sku)
                  {
                      // Verify the required parameter 'sku' is set.
                      if ($sku === null || (\is_array($sku) && count($sku) === 0)) {
                          throw new \InvalidArgumentException('Missing the required parameter $sku when calling deleteInventoryItem');
              Severity: Major
              Found in src/Sell/Inventory/V1/Api/InventoryItemApi.php - About 2 hrs to fix

                Method bulkCreateOrReplaceInventoryItemRequest has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function bulkCreateOrReplaceInventoryItemRequest($bulk_inventory_item)
                    {
                        // Verify the required parameter 'bulk_inventory_item' is set.
                        if ($bulk_inventory_item === null || (\is_array($bulk_inventory_item) && count($bulk_inventory_item) === 0)) {
                            throw new \InvalidArgumentException('Missing the required parameter $bulk_inventory_item when calling bulkCreateOrReplaceInventoryItem');
                Severity: Major
                Found in src/Sell/Inventory/V1/Api/InventoryItemApi.php - About 2 hrs to fix

                  Method bulkGetInventoryItemRequest has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function bulkGetInventoryItemRequest($bulk_get_inventory_item)
                      {
                          // Verify the required parameter 'bulk_get_inventory_item' is set.
                          if ($bulk_get_inventory_item === null || (\is_array($bulk_get_inventory_item) && count($bulk_get_inventory_item) === 0)) {
                              throw new \InvalidArgumentException('Missing the required parameter $bulk_get_inventory_item when calling bulkGetInventoryItem');
                  Severity: Major
                  Found in src/Sell/Inventory/V1/Api/InventoryItemApi.php - About 2 hrs to fix

                    Method bulkUpdatePriceQuantityRequest has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function bulkUpdatePriceQuantityRequest($bulk_price_quantity)
                        {
                            // Verify the required parameter 'bulk_price_quantity' is set.
                            if ($bulk_price_quantity === null || (\is_array($bulk_price_quantity) && count($bulk_price_quantity) === 0)) {
                                throw new \InvalidArgumentException('Missing the required parameter $bulk_price_quantity when calling bulkUpdatePriceQuantity');
                    Severity: Major
                    Found in src/Sell/Inventory/V1/Api/InventoryItemApi.php - About 2 hrs to fix

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

                          public function bulkGetInventoryItemWithHttpInfo($bulk_get_inventory_item)
                          {
                              $request = $this->bulkGetInventoryItemRequest($bulk_get_inventory_item);
                      
                              try {
                      Severity: Major
                      Found in src/Sell/Inventory/V1/Api/InventoryItemApi.php - About 2 hrs to fix

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

                            public function bulkUpdatePriceQuantityWithHttpInfo($bulk_price_quantity)
                            {
                                $request = $this->bulkUpdatePriceQuantityRequest($bulk_price_quantity);
                        
                                try {
                        Severity: Major
                        Found in src/Sell/Inventory/V1/Api/InventoryItemApi.php - About 2 hrs to fix

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

                              public function bulkCreateOrReplaceInventoryItemWithHttpInfo($bulk_inventory_item)
                              {
                                  $request = $this->bulkCreateOrReplaceInventoryItemRequest($bulk_inventory_item);
                          
                                  try {
                          Severity: Major
                          Found in src/Sell/Inventory/V1/Api/InventoryItemApi.php - About 2 hrs to fix

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

                                public function getInventoryItemsWithHttpInfo($limit = null, $offset = null)
                                {
                                    $request = $this->getInventoryItemsRequest($limit, $offset);
                            
                                    try {
                            Severity: Major
                            Found in src/Sell/Inventory/V1/Api/InventoryItemApi.php - About 2 hrs to fix

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

                                  public function getInventoryItemWithHttpInfo($sku)
                                  {
                                      $request = $this->getInventoryItemRequest($sku);
                              
                                      try {
                              Severity: Major
                              Found in src/Sell/Inventory/V1/Api/InventoryItemApi.php - About 2 hrs to fix

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

                                    public function getInventoryItemsRequest($limit = null, $offset = null)
                                    {
                                        $resourcePath = '/inventory_item';
                                        $formParams = [];
                                        $queryParams = [];
                                Severity: Minor
                                Found in src/Sell/Inventory/V1/Api/InventoryItemApi.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 createOrReplaceInventoryItemWithHttpInfo has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public function createOrReplaceInventoryItemWithHttpInfo($content_language, $sku, $inventory_item)
                                    {
                                        $request = $this->createOrReplaceInventoryItemRequest($content_language, $sku, $inventory_item);
                                
                                        try {
                                Severity: Minor
                                Found in src/Sell/Inventory/V1/Api/InventoryItemApi.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 bulkGetInventoryItemWithHttpInfo has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public function bulkGetInventoryItemWithHttpInfo($bulk_get_inventory_item)
                                    {
                                        $request = $this->bulkGetInventoryItemRequest($bulk_get_inventory_item);
                                
                                        try {
                                Severity: Minor
                                Found in src/Sell/Inventory/V1/Api/InventoryItemApi.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 getInventoryItemWithHttpInfo has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public function getInventoryItemWithHttpInfo($sku)
                                    {
                                        $request = $this->getInventoryItemRequest($sku);
                                
                                        try {
                                Severity: Minor
                                Found in src/Sell/Inventory/V1/Api/InventoryItemApi.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 getInventoryItemsWithHttpInfo has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public function getInventoryItemsWithHttpInfo($limit = null, $offset = null)
                                    {
                                        $request = $this->getInventoryItemsRequest($limit, $offset);
                                
                                        try {
                                Severity: Minor
                                Found in src/Sell/Inventory/V1/Api/InventoryItemApi.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 bulkUpdatePriceQuantityWithHttpInfo has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public function bulkUpdatePriceQuantityWithHttpInfo($bulk_price_quantity)
                                    {
                                        $request = $this->bulkUpdatePriceQuantityRequest($bulk_price_quantity);
                                
                                        try {
                                Severity: Minor
                                Found in src/Sell/Inventory/V1/Api/InventoryItemApi.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 bulkCreateOrReplaceInventoryItemWithHttpInfo has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public function bulkCreateOrReplaceInventoryItemWithHttpInfo($bulk_inventory_item)
                                    {
                                        $request = $this->bulkCreateOrReplaceInventoryItemRequest($bulk_inventory_item);
                                
                                        try {
                                Severity: Minor
                                Found in src/Sell/Inventory/V1/Api/InventoryItemApi.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 deleteInventoryItemWithHttpInfo has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public function deleteInventoryItemWithHttpInfo($sku)
                                    {
                                        $request = $this->deleteInventoryItemRequest($sku);
                                
                                        try {
                                Severity: Minor
                                Found in src/Sell/Inventory/V1/Api/InventoryItemApi.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

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

                                    public function getInventoryItemsRequest($limit = null, $offset = null)
                                    {
                                        $resourcePath = '/inventory_item';
                                        $formParams = [];
                                        $queryParams = [];
                                Severity: Major
                                Found in src/Sell/Inventory/V1/Api/InventoryItemApi.php and 1 other location - About 2 days to fix
                                src/Sell/Inventory/V1/Api/LocationApi.php on lines 1469..1555

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

                                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