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.
*
InventoryItemApi
has 40 functions (exceeds 20 allowed). Consider refactoring. Open
class InventoryItemApi
{
/**
* @var ClientInterface
*/
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');
- Read upRead up
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');
- Read upRead up
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');
- Read upRead up
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');
- Read upRead up
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');
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 {
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');
- Read upRead up
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 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');
- Read upRead up
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 = [];
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');
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');
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');
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');
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');
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 {
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 {
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 {
Method getInventoryItemWithHttpInfo
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getInventoryItemWithHttpInfo($sku)
{
$request = $this->getInventoryItemRequest($sku);
try {
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 {
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 = [];
- Read upRead up
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 {
- Read upRead up
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 {
- Read upRead up
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 {
- Read upRead up
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 {
- Read upRead up
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 {
- Read upRead up
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 {
- Read upRead up
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 {
- Read upRead up
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 = [];
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76