brandon14/ebay-sdk-php

View on GitHub
src/Sell/Account/V1/Api/CustomPolicyApi.php

Summary

Maintainability
F
1 wk
Test Coverage

File CustomPolicyApi.php has 708 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/Account/V1/Api/CustomPolicyApi.php - About 1 day to fix

    Function updateCustomPolicyRequest has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
    Open

        public function updateCustomPolicyRequest($custom_policy_id, $x_ebay_c_marketplace_id, $custom_policy_request)
        {
            // Verify the required parameter 'custom_policy_id' is set.
            if ($custom_policy_id === null || (\is_array($custom_policy_id) && count($custom_policy_id) === 0)) {
                throw new \InvalidArgumentException('Missing the required parameter $custom_policy_id when calling updateCustomPolicy');
    Severity: Minor
    Found in src/Sell/Account/V1/Api/CustomPolicyApi.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 createCustomPolicyRequest has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

        public function createCustomPolicyRequest($x_ebay_c_marketplace_id, $custom_policy_create_request)
        {
            // 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 createCustomPolicy');
    Severity: Minor
    Found in src/Sell/Account/V1/Api/CustomPolicyApi.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 getCustomPolicyRequest has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getCustomPolicyRequest($custom_policy_id, $x_ebay_c_marketplace_id)
        {
            // Verify the required parameter 'custom_policy_id' is set.
            if ($custom_policy_id === null || (\is_array($custom_policy_id) && count($custom_policy_id) === 0)) {
                throw new \InvalidArgumentException('Missing the required parameter $custom_policy_id when calling getCustomPolicy');
    Severity: Minor
    Found in src/Sell/Account/V1/Api/CustomPolicyApi.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 updateCustomPolicyRequest has 82 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function updateCustomPolicyRequest($custom_policy_id, $x_ebay_c_marketplace_id, $custom_policy_request)
        {
            // Verify the required parameter 'custom_policy_id' is set.
            if ($custom_policy_id === null || (\is_array($custom_policy_id) && count($custom_policy_id) === 0)) {
                throw new \InvalidArgumentException('Missing the required parameter $custom_policy_id when calling updateCustomPolicy');
    Severity: Major
    Found in src/Sell/Account/V1/Api/CustomPolicyApi.php - About 3 hrs to fix

      Method getCustomPolicyRequest has 73 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

        Function getCustomPoliciesRequest has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getCustomPoliciesRequest($x_ebay_c_marketplace_id, $policy_types = 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 getCustomPolicies');
        Severity: Minor
        Found in src/Sell/Account/V1/Api/CustomPolicyApi.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 createCustomPolicyRequest has 72 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function createCustomPolicyRequest($x_ebay_c_marketplace_id, $custom_policy_create_request)
            {
                // 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 createCustomPolicy');
        Severity: Major
        Found in src/Sell/Account/V1/Api/CustomPolicyApi.php - About 2 hrs to fix

          CustomPolicyApi has 25 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class CustomPolicyApi
          {
              /**
               * @var ClientInterface
               */
          Severity: Minor
          Found in src/Sell/Account/V1/Api/CustomPolicyApi.php - About 2 hrs to fix

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

                public function getCustomPoliciesRequest($x_ebay_c_marketplace_id, $policy_types = 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 getCustomPolicies');
            Severity: Major
            Found in src/Sell/Account/V1/Api/CustomPolicyApi.php - About 2 hrs to fix

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

                  public function getCustomPoliciesWithHttpInfo($x_ebay_c_marketplace_id, $policy_types = null)
                  {
                      $request = $this->getCustomPoliciesRequest($x_ebay_c_marketplace_id, $policy_types);
              
                      try {
              Severity: Major
              Found in src/Sell/Account/V1/Api/CustomPolicyApi.php - About 2 hrs to fix

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

                    public function getCustomPolicyWithHttpInfo($custom_policy_id, $x_ebay_c_marketplace_id)
                    {
                        $request = $this->getCustomPolicyRequest($custom_policy_id, $x_ebay_c_marketplace_id);
                
                        try {
                Severity: Major
                Found in src/Sell/Account/V1/Api/CustomPolicyApi.php - About 2 hrs to fix

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

                      public function createCustomPolicyWithHttpInfo($x_ebay_c_marketplace_id, $custom_policy_create_request)
                      {
                          $request = $this->createCustomPolicyRequest($x_ebay_c_marketplace_id, $custom_policy_create_request);
                  
                          try {
                  Severity: Major
                  Found in src/Sell/Account/V1/Api/CustomPolicyApi.php - About 2 hrs to fix

                    Function createCustomPolicyWithHttpInfo has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function createCustomPolicyWithHttpInfo($x_ebay_c_marketplace_id, $custom_policy_create_request)
                        {
                            $request = $this->createCustomPolicyRequest($x_ebay_c_marketplace_id, $custom_policy_create_request);
                    
                            try {
                    Severity: Minor
                    Found in src/Sell/Account/V1/Api/CustomPolicyApi.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 getCustomPoliciesWithHttpInfo has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function getCustomPoliciesWithHttpInfo($x_ebay_c_marketplace_id, $policy_types = null)
                        {
                            $request = $this->getCustomPoliciesRequest($x_ebay_c_marketplace_id, $policy_types);
                    
                            try {
                    Severity: Minor
                    Found in src/Sell/Account/V1/Api/CustomPolicyApi.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 getCustomPolicyWithHttpInfo has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function getCustomPolicyWithHttpInfo($custom_policy_id, $x_ebay_c_marketplace_id)
                        {
                            $request = $this->getCustomPolicyRequest($custom_policy_id, $x_ebay_c_marketplace_id);
                    
                            try {
                    Severity: Minor
                    Found in src/Sell/Account/V1/Api/CustomPolicyApi.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 updateCustomPolicyWithHttpInfo has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function updateCustomPolicyWithHttpInfo($custom_policy_id, $x_ebay_c_marketplace_id, $custom_policy_request)
                        {
                            $request = $this->updateCustomPolicyRequest($custom_policy_id, $x_ebay_c_marketplace_id, $custom_policy_request);
                    
                            try {
                    Severity: Minor
                    Found in src/Sell/Account/V1/Api/CustomPolicyApi.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 getCustomPoliciesRequest($x_ebay_c_marketplace_id, $policy_types = 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 getCustomPolicies');
                    Severity: Major
                    Found in src/Sell/Account/V1/Api/CustomPolicyApi.php and 1 other location - About 2 days to fix
                    src/Sell/Account/V1/Api/AdvertisingEligibilityApi.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 558.

                    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 updateCustomPolicyWithHttpInfo($custom_policy_id, $x_ebay_c_marketplace_id, $custom_policy_request)
                        {
                            $request = $this->updateCustomPolicyRequest($custom_policy_id, $x_ebay_c_marketplace_id, $custom_policy_request);
                    
                            try {
                    Severity: Major
                    Found in src/Sell/Account/V1/Api/CustomPolicyApi.php and 4 other locations - About 1 day to fix
                    src/Sell/Account/V1/Api/SalesTaxApi.php on lines 181..211
                    src/Sell/Marketing/V1/Api/AdApi.php on lines 4184..4214
                    src/Sell/Marketing/V1/Api/AdGroupApi.php on lines 1563..1593
                    src/Sell/Marketing/V1/Api/KeywordApi.php on lines 1546..1576

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

                    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 updateCustomPolicyAsyncWithHttpInfo($custom_policy_id, $x_ebay_c_marketplace_id, $custom_policy_request)
                        {
                            $returnType = '';
                            $request = $this->updateCustomPolicyRequest($custom_policy_id, $x_ebay_c_marketplace_id, $custom_policy_request);
                    
                    
                    Severity: Major
                    Found in src/Sell/Account/V1/Api/CustomPolicyApi.php and 4 other locations - About 5 hrs to fix
                    src/Sell/Account/V1/Api/SalesTaxApi.php on lines 245..263
                    src/Sell/Marketing/V1/Api/AdApi.php on lines 4248..4266
                    src/Sell/Marketing/V1/Api/AdGroupApi.php on lines 1627..1645
                    src/Sell/Marketing/V1/Api/KeywordApi.php on lines 1610..1628

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

                    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