ryanwinchester/hubspot-php

View on GitHub

Showing 23 of 23 total issues

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

<?php

namespace SevenShores\Hubspot\Endpoints;

/**
Severity: Major
Found in src/Endpoints/Products.php and 1 other location - About 2 days to fix
src/Endpoints/LineItems.php on lines 1..195

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

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

<?php

namespace SevenShores\Hubspot\Endpoints;

/**
Severity: Major
Found in src/Endpoints/LineItems.php and 1 other location - About 2 days to fix
src/Endpoints/Products.php on lines 1..195

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

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

Response has 23 functions (exceeds 20 allowed). Consider refactoring.
Open

class Response implements ResponseInterface, ArrayAccess
{
    /**
     * @var mixed
     */
Severity: Minor
Found in src/Http/Response.php - About 2 hrs to fix

    Contacts has 21 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Contacts extends Endpoint
    {
        /**
         * Create a new contact.
         *
    Severity: Minor
    Found in src/Endpoints/Contacts.php - About 2 hrs to fix

      Function build_query_string has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          function build_query_string(array $params = [], $encoding = PHP_QUERY_RFC3986): string
          {
              if (empty($params)) {
                  return '';
              }
      Severity: Minor
      Found in src/helpers.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 createOrUpdate has 9 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              $appId,
              $eventTypeId,
              $id,
              $objectId = null,
              $email = null,
      Severity: Major
      Found in src/Endpoints/Timeline.php - About 1 hr to fix

        Function request has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            public function request(string $method, string $endpoint, array $options = [], $query_string = null, bool $requires_auth = true)
            {
                if ($requires_auth && empty($this->key)) {
                    throw new InvalidArgument('You must provide a Hubspot api key or token.');
                }
        Severity: Minor
        Found in src/Http/Client.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 updateEventTypeProperty has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                $appId,
                $eventTypeId,
                $eventTypePropertyId,
                $name,
                $label,
        Severity: Major
        Found in src/Endpoints/Timeline.php - About 50 mins to fix

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

                  $appId,
                  $eventTypeId,
                  $name,
                  $label,
                  $propertyType,
          Severity: Major
          Found in src/Endpoints/Timeline.php - About 50 mins to fix

            Method updateTable has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                public function updateTable($tableId, string $name, array $columns = [], bool $draft = false, bool $published = true, bool $useForPages = false)
            Severity: Minor
            Found in src/Endpoints/HubDB.php - About 45 mins to fix

              Method upload has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      $file,
                      array $options = [],
                      string $folderPath = '/',
                      string $fileName = null,
                      string $folderId = null,
              Severity: Minor
              Found in src/Endpoints/Files.php - About 45 mins to fix

                Method updateEventType has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        $appId,
                        $eventTypeId,
                        $name = null,
                        $headerTemplate = null,
                        $detailTemplate = null,
                Severity: Minor
                Found in src/Endpoints/Timeline.php - About 45 mins to fix

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

                          string $breakdown_by,
                          string $time_period,
                          string $start,
                          string $end,
                          array $params = []
                  Severity: Minor
                  Found in src/Endpoints/Analytics.php - About 35 mins to fix

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

                            $importStartedAt,
                            int $pageNumber,
                            array $messages,
                            string $storeId,
                            string $objectType
                    Severity: Minor
                    Found in src/Endpoints/EcommerceBridge.php - About 35 mins to fix

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

                          public function request(string $method, string $endpoint, array $options = [], $query_string = null, bool $requires_auth = true)
                      Severity: Minor
                      Found in src/Http/Client.php - About 35 mins to fix

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

                                string $content_type,
                                string $time_period,
                                string $start,
                                string $end,
                                array $params = []
                        Severity: Minor
                        Found in src/Endpoints/Analytics.php - About 35 mins to fix

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

                              public function updateRow($tableId, $rowId, array $values, string $name = null, string $path = null)
                          Severity: Minor
                          Found in src/Endpoints/HubDB.php - About 35 mins to fix

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

                                    string $object_type,
                                    string $time_period,
                                    string $start,
                                    string $end,
                                    array $params = []
                            Severity: Minor
                            Found in src/Endpoints/Analytics.php - About 35 mins to fix

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

                                      $importStartedAt,
                                      int $pageCount,
                                      int $itemCount,
                                      string $storeId,
                                      string $objectType
                              Severity: Minor
                              Found in src/Endpoints/EcommerceBridge.php - About 35 mins to fix

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

                                    public function updateCell($tableId, $rowId, $cellId, array $values, bool $draft = false)
                                Severity: Minor
                                Found in src/Endpoints/HubDB.php - About 35 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language