zendesk/zendesk_api_client_php

View on GitHub

Showing 30 of 41 total issues

File HttpClient.php has 280 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Zendesk\API;

/*
Severity: Minor
Found in src/Zendesk/API/HttpClient.php - About 2 hrs to fix

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

        public static function send(
            HttpClient $client,
            $endPoint,
            $options = []
        ) {
    Severity: Major
    Found in src/Zendesk/API/Http.php - About 2 hrs to fix

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

          public static function getValidSubResources()
          {
              return [
                  'apps'                      => Apps::class,
                  'activities'                => Activities::class,
      Severity: Minor
      Found in src/Zendesk/API/HttpClient.php - About 1 hr to fix

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

            public static function send(
                HttpClient $client,
                $endPoint,
                $options = []
            ) {
        Severity: Minor
        Found in src/Zendesk/API/Http.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 upload has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function upload(array $params, $routeKey = __FUNCTION__)
            {
                if (! array_key_exists('file', $params)) {
                    throw new MissingParametersException(__METHOD__, ['file']);
                }
        Severity: Minor
        Found in src/Zendesk/API/Traits/Resource/MultipartUpload.php - About 1 hr to fix

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

              public function getRoute($name, array $params = [])
              {
                  $lastChained = $this->getLatestChainedParameter([self::class]);
          
                  if ((empty($lastChained)) || ! (in_array($name, ['findAll', 'find', 'create', 'delete']))) {
          Severity: Minor
          Found in src/Zendesk/API/Resources/Core/OrganizationMemberships.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 upload has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function upload(array $params)
              {
                  if (! $this->hasKeys($params, ['file'])) {
                      throw new MissingParametersException(__METHOD__, ['file']);
                  }
          Severity: Minor
          Found in src/Zendesk/API/Resources/Core/Attachments.php - About 1 hr to fix

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

                public function __construct(
                    $subdomain,
                    $username = '',
                    $scheme = "https",
                    $hostname = "zendesk.com",
            Severity: Minor
            Found in src/Zendesk/API/HttpClient.php - About 1 hr to fix

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

                  public function getRoute($name, array $params = [])
                  {
                      $lastChained = $this->getLatestChainedParameter();
                      $params = $this->addChainedParametersToParams($params, [
                          'section_id' => Sections::class
              Severity: Minor
              Found in src/Zendesk/API/Resources/HelpCenter/Articles.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 getRoute has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function getRoute($name, array $params = [])
                  {
                      $lastChained = $this->getLatestChainedParameter([self::class]);
              
                      $chainableRoutes = ['findAll', 'find', 'create', 'delete', 'assignable'];
              Severity: Minor
              Found in src/Zendesk/API/Resources/Core/GroupMemberships.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 getRoute has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function getRoute($name, array $params = [])
                  {
                      $lastChained = $this->getLatestChainedParameter();
                      $params = $this->addChainedParametersToParams($params, [
                          'category_id' => Categories::class
              Severity: Minor
              Found in src/Zendesk/API/Resources/HelpCenter/Sections.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 updateMany has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function updateMany(array $params, $key = 'ids')
                  {
                      try {
                          $route = $this->getRoute(__FUNCTION__);
                      } catch (RouteException $e) {
              Severity: Minor
              Found in src/Zendesk/API/Traits/Resource/UpdateMany.php - About 1 hr to fix

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

                    protected function pageSize()
                    {
                        if (isset($this->pageSize)) {
                            return $this->pageSize;
                        } else if (isset($this->params['page[size]'])) {
                Severity: Minor
                Found in src/Zendesk/API/Traits/Utility/Pagination/AbstractStrategy.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 __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        $subdomain,
                        $username = '',
                        $scheme = "https",
                        $hostname = "zendesk.com",
                        $port = 443,
                Severity: Minor
                Found in src/Zendesk/API/HttpClient.php - About 45 mins to fix

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

                      public function __construct($strategy, array $options)
                      {
                          if (! in_array($strategy, self::getValidAuthStrategies())) {
                              throw new AuthException('Invalid auth strategy set, please use `'
                                                      . implode('` or `', self::getValidAuthStrategies())
                  Severity: Minor
                  Found in src/Zendesk/API/Utilities/Auth.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 upload has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function upload(array $params)
                      {
                          if (! $this->hasKeys($params, ['file'])) {
                              throw new MissingParametersException(__METHOD__, ['file']);
                          }
                  Severity: Minor
                  Found in src/Zendesk/API/Resources/Core/Attachments.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 upload has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function upload(array $params, $routeKey = __FUNCTION__)
                      {
                          if (! array_key_exists('file', $params)) {
                              throw new MissingParametersException(__METHOD__, ['file']);
                          }
                  Severity: Minor
                  Found in src/Zendesk/API/Traits/Resource/MultipartUpload.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 getMatches has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function getMatches(array $tokens, array $info = [])
                      {
                          $input = $this->getInput($tokens);
                  
                          array_shift($tokens);
                  Severity: Minor
                  Found in src/Zendesk/Console/Matchers/SubResourceMatcher.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 setDebug has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                          $lastRequestHeaders,
                          $lastRequestBody,
                          $lastResponseCode,
                          $lastResponseHeaders,
                          $lastResponseError
                  Severity: Minor
                  Found in src/Zendesk/API/HttpClient.php - About 35 mins to fix

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

                        public function getRoute($name, array $params = [])
                        {
                            $lastChained = $this->getLatestChainedParameter();
                    
                            if (empty($lastChained) || $name !== 'findAll') {
                    Severity: Minor
                    Found in src/Zendesk/API/Resources/Core/OrganizationSubscriptions.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