superdesk/contentapi-sdk-php

View on GitHub

Showing 13 of 13 total issues

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

class RequestParameters
{
    const DEFAULT_PAGE = 1;
    const DEFAULT_MAX_RESULTS = 25;

Severity: Minor
Found in src/Superdesk/ContentApiSdk/Api/Request/RequestParameters.php - About 2 hrs to fix

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

    class ContentApiSdk
    {
        /**
         * Items endpoint
         */
    Severity: Minor
    Found in src/Superdesk/ContentApiSdk/ContentApiSdk.php - About 2 hrs to fix

      Function getAssociationsFromPackage has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getAssociationsFromPackage(Package $package)
          {
              $associations = new stdClass();
      
              if (property_exists($package, 'associations')) {
      Severity: Minor
      Found in src/Superdesk/ContentApiSdk/ContentApiSdk.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 parseHttpHeaders has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          private function parseHttpHeaders($headerString)
          {
              $headers = array();
              $key = '';
      
      
      Severity: Minor
      Found in src/Superdesk/ContentApiSdk/Client/CurlClient.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 processRawBody has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          private function processRawBody()
          {
              switch ($this->contentType) {
                  case self::CONTENT_TYPE_JSON:
      
      
      Severity: Minor
      Found in src/Superdesk/ContentApiSdk/Api/Response.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 processRawBody has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function processRawBody()
          {
              switch ($this->contentType) {
                  case self::CONTENT_TYPE_JSON:
      
      
      Severity: Minor
      Found in src/Superdesk/ContentApiSdk/Api/Response.php - About 1 hr to fix

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

            public function makeCall(
                $url,
                array $headers = array(),
                array $options = array(),
                $method = 'GET',
        Severity: Minor
        Found in src/Superdesk/ContentApiSdk/Client/CurlClient.php - About 1 hr to fix

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

              public function getAuthenticationTokens()
              {
                  try {
                      $response = $this->client->makeCall(
                          $this->getAuthenticationUrl(),

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

                public function __construct(
                    $hostname = null,
                    $uri = null,
                    RequestParameters $parameters = null,
                    $port = null,
            Severity: Minor
            Found in src/Superdesk/ContentApiSdk/Api/Request.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 __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    $hostname = null,
                    $uri = null,
                    RequestParameters $parameters = null,
                    $port = null,
                    $protocol = null
            Severity: Minor
            Found in src/Superdesk/ContentApiSdk/Api/Request.php - About 35 mins to fix

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

                      $url,
                      array $headers = array(),
                      array $options = array(),
                      $method = 'GET',
                      $content = null
              Severity: Minor
              Found in src/Superdesk/ContentApiSdk/Client/ClientInterface.php - About 35 mins to fix

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

                        $url,
                        array $headers = array(),
                        array $options = array(),
                        $method = 'GET',
                        $content = null
                Severity: Minor
                Found in src/Superdesk/ContentApiSdk/Client/CurlClient.php - About 35 mins to fix

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

                      public function getAuthenticationTokens()
                      {
                          try {
                              $response = $this->client->makeCall(
                                  $this->getAuthenticationUrl(),

                  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