EvilFreelancer/bookeo-api-php

View on GitHub

Showing 19 of 19 total issues

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

    public function resources(int $itemsPerPage = 50, string $pageNavigationToken = null, int $pageNumber = 1): QueryInterface
    {
        if (!empty($itemsPerPage)) {
            $this->appendToQuery('itemsPerPage', $itemsPerPage);
        }
Severity: Major
Found in src/Endpoints/Settings.php and 1 other location - About 2 hrs to fix
src/Endpoints/Subaccounts.php on lines 71..91

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

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 all(int $itemsPerPage = 100, string $pageNavigationToken = null, int $pageNumber = 1): QueryInterface
    {
        if (!empty($itemsPerPage)) {
            $this->appendToQuery('itemsPerPage', $itemsPerPage);
        }
Severity: Major
Found in src/Endpoints/Subaccounts.php and 1 other location - About 2 hrs to fix
src/Endpoints/Settings.php on lines 153..173

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

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

Method all has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function all(
        int $itemsPerPage = 50,
        string $pageNavigationToken = null,
        int $pageNumber = 1,
        string $startTime = null,
Severity: Minor
Found in src/Endpoints/Bookings.php - About 1 hr to fix

    Method all has 11 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            int $itemsPerPage = 50,
            string $pageNavigationToken = null,
            int $pageNumber = 1,
            string $startTime = null,
            string $endTime = null,
    Severity: Major
    Found in src/Endpoints/Bookings.php - About 1 hr to fix

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

          public function allowed(): array
          {
              return [
                  'bookingNumber'               => 'string',             // The unique booking number. Always treat as string [read-only],
                  'eventId'                     => 'string',             // When the booking is for a product of type fixed or fixedCourse, this is the id of the slot (see /availability/slots). Note that for fixedCourse, Bookeo always returns the eventId of the first class in a course, even if the customer is enrolled starting from a later class. In this case, firstCourseEnrolledEvent will be set.,
      Severity: Minor
      Found in src/Models/Booking.php - About 1 hr to fix

        Function all has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            public function all(
                int $itemsPerPage = 50,
                string $pageNavigationToken = null,
                int $pageNumber = 1,
                string $startTime = null,
        Severity: Minor
        Found in src/Endpoints/Bookings.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 __invoke has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            public function __invoke(
                string $productId = null,
                string $startTime = null,
                string $endTime = null,
                int $itemsPerPage = 50,
        Severity: Minor
        Found in src/Endpoints/Availability/Slots.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 __invoke has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function __invoke(
                string $productId = null,
                string $startTime = null,
                string $endTime = null,
                int $itemsPerPage = 50,
        Severity: Minor
        Found in src/Endpoints/Availability/Slots.php - About 1 hr to fix

          Method all has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function all(
                  string $searchText = null,
                  string $searchField = null,
                  string $createdSince = null,
                  bool $currentMembers = true,
          Severity: Minor
          Found in src/Endpoints/Customers.php - About 1 hr to fix

            Method all has 8 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    string $searchText = null,
                    string $searchField = null,
                    string $createdSince = null,
                    bool $currentMembers = true,
                    bool $currentNonMembers = true,
            Severity: Major
            Found in src/Endpoints/Customers.php - About 1 hr to fix

              Function repeatRequest has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function repeatRequest($type, $url, $params): ?ResponseInterface
                  {
                      $type = strtoupper($type);
              
                      for ($i = 1; $i < $this->config->get('tries'); $i++) {
              Severity: Minor
              Found in src/HttpTrait.php - About 55 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

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

                      Booking $create,
                      string $previousHoldId = null,
                      bool $notifyUsers = null,
                      bool $notifyCustomer = null,
                      bool $sendCustomerReminders = null,
              Severity: Major
              Found in src/Endpoints/Bookings.php - About 50 mins to fix

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

                        bool $notifyUsers = null,
                        bool $notifyCustomer = null,
                        bool $applyCancellationPolicy = null,
                        bool $trackInCustomerHistory = null,
                        bool $cancelRemainingSeries = null,
                Severity: Minor
                Found in src/Endpoints/Bookings.php - About 45 mins to fix

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

                          string $productId = null,
                          string $startTime = null,
                          string $endTime = null,
                          int $itemsPerPage = 50,
                          string $pageNavigationToken = null,
                  Severity: Minor
                  Found in src/Endpoints/Availability/Slots.php - About 45 mins to fix

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

                            string $beginDate = null,
                            string $endDate = null,
                            bool $expandParticipants = false,
                            int $itemsPerPage = 50,
                            string $pageNavigationToken = null,
                    Severity: Minor
                    Found in src/Endpoints/Customers.php - About 45 mins to fix

                      Function all has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function all(
                              string $searchText = null,
                              string $searchField = null,
                              string $createdSince = null,
                              bool $currentMembers = true,
                      Severity: Minor
                      Found in src/Endpoints/Customers.php - About 45 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

                      Function bookings has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function bookings(
                              string $beginDate = null,
                              string $endDate = null,
                              bool $expandParticipants = false,
                              int $itemsPerPage = 50,
                      Severity: Minor
                      Found in src/Endpoints/Customers.php - About 25 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

                      Function create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function create(
                              Booking $create,
                              string $previousHoldId = null,
                              bool $notifyUsers = null,
                              bool $notifyCustomer = null,
                      Severity: Minor
                      Found in src/Endpoints/Bookings.php - About 25 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

                      Function delete has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function delete(
                              bool $notifyUsers = null,
                              bool $notifyCustomer = null,
                              bool $applyCancellationPolicy = null,
                              bool $trackInCustomerHistory = null,
                      Severity: Minor
                      Found in src/Endpoints/Bookings.php - About 25 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

                      Severity
                      Category
                      Status
                      Source
                      Language