bookboon/api-php

View on GitHub

Showing 21 of 32 total issues

Book has 38 functions (exceeds 20 allowed). Consider refactoring.
Open

abstract class Book extends Entity
{
    const _OWN_TYPE = '';

    const TYPE_AUDIO = 'audio';
Severity: Minor
Found in src/Entity/Book.php - About 5 hrs to fix

    File Book.php has 300 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    namespace Bookboon\Api\Entity;
    
    use Bookboon\Api\Bookboon;
    Severity: Minor
    Found in src/Entity/Book.php - About 3 hrs to fix

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

          protected function executeQuery(
              string $uri,
              string $type = ClientInterface::HTTP_GET,
              array $variables = [],
              string $contentType = ClientInterface::CONTENT_TYPE_JSON
      Severity: Major
      Found in src/Client/OauthClient.php - About 2 hrs to fix

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

            protected function executeQuery(
                $uri,
                $type = self::HTTP_GET,
                $variables = [],
                $contentType = self::CONTENT_TYPE_FORM
        Severity: Major
        Found in src/Client/BasicAuthClient.php - About 2 hrs to fix

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

              private function getRemoteAddress() : ?string
              {
                  $hostname = null;
          
                  if (isset($_SERVER['REMOTE_ADDR'])) {
          Severity: Minor
          Found in src/Client/Headers.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 __construct has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function __construct(
                  string $apiId,
                  string $apiSecret,
                  Headers $headers,
                  array $scopes,
          Severity: Minor
          Found in src/Client/OauthClient.php - About 1 hr to fix

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

                    string $apiId,
                    string $apiSecret,
                    Headers $headers,
                    array $scopes,
                    CacheInterface $cache = null,
            Severity: Major
            Found in src/Client/OauthClient.php - About 1 hr to fix

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

                  protected function executeQuery(
                      string $uri,
                      string $type = ClientInterface::HTTP_GET,
                      array $variables = [],
                      string $contentType = ClientInterface::CONTENT_TYPE_JSON
              Severity: Minor
              Found in src/Client/OauthClient.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 executeQuery has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function executeQuery(
                      $uri,
                      $type = self::HTTP_GET,
                      $variables = [],
                      $contentType = self::CONTENT_TYPE_FORM
              Severity: Minor
              Found in src/Client/BasicAuthClient.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 create has 8 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      string $appId,
                      string $appSecret,
                      array $scopes,
                      array $headers = [],
                      ?string $appUserId = null,
              Severity: Major
              Found in src/Bookboon.php - About 1 hr to fix

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

                        $apiId,
                        $apiSecret,
                        Headers $headers,
                        CacheInterface $cache = null,
                        $apiUri = null,
                Severity: Minor
                Found in src/Client/BasicAuthClient.php - About 45 mins to fix

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

                      public function makeRequest(
                          string $relativeUrl,
                          array $variables = [],
                          string $httpMethod = ClientInterface::HTTP_GET,
                          bool $shouldCache = true,
                  Severity: Minor
                  Found in src/Client/RequestTrait.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

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

                          Bookboon $bookboon,
                          array $bookIds = [],
                          int $limit = 5,
                          array $bookTypes = ['professional'],
                          array $params = []
                  Severity: Minor
                  Found in src/Entity/Book.php - About 35 mins to fix

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

                        public static function getBySlug(Bookboon $bookboon, string $slug, array $bookTypes = ['professional'], ?int $limit = null, ?int $seed = null) : BookboonResponse
                    Severity: Minor
                    Found in src/Entity/Frontpage.php - About 35 mins to fix

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

                              string $relativeUrl,
                              array $variables = [],
                              string $httpMethod = self::HTTP_GET,
                              bool $shouldCache = true,
                              string $contentType = self::CONTENT_TYPE_FORM
                      Severity: Minor
                      Found in src/Client/ClientInterface.php - About 35 mins to fix

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

                                Bookboon $bookboon,
                                string $query,
                                int $limit = 10,
                                int $offset = 0,
                                 array $bookTypes = ['professional']
                        Severity: Minor
                        Found in src/Entity/Book.php - About 35 mins to fix

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

                                  string $url,
                                  array $variables = [],
                                  string $httpMethod = ClientInterface::HTTP_GET,
                                  bool $shouldCache = true,
                                  string $classString = Entity::class
                          Severity: Minor
                          Found in src/Bookboon.php - About 35 mins to fix

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

                                    string $relativeUrl,
                                    array $variables = [],
                                    string $httpMethod = ClientInterface::HTTP_GET,
                                    bool $shouldCache = true,
                                    string $contentType = ClientInterface::CONTENT_TYPE_JSON
                            Severity: Minor
                            Found in src/Client/RequestTrait.php - About 35 mins to fix

                              Function recursiveBlacklist has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  private static function recursiveBlacklist(array &$categories, array $blacklistedCategoryIds) : void
                                  {
                                      $hasAlteredArray = false;
                              
                                      foreach ($categories as $key => $category) {
                              Severity: Minor
                              Found in src/Entity/Category.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

                              Function getParentRequestHeaders has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  protected function getParentRequestHeaders(): array
                                  {
                                      if (!function_exists('apache_request_headers')) {
                                          $out = [];
                              
                              
                              Severity: Minor
                              Found in src/Client/Oauth/BookboonProvider.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

                              Severity
                              Category
                              Status
                              Source
                              Language