francis94c/ci-gmail

View on GitHub
libraries/GMail.php

Summary

Maintainability
B
6 hrs
Test Coverage

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

  public function getMessages(string $userId='me', array $labelIds=null,
  string $q=null, int $maxMessages=null, string $pageToken=null, bool $includeSpamTrash=false,
  $truncateAfter=null):?object
  {
    $query = [];
Severity: Minor
Found in libraries/GMail.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 getToken has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  public function getToken(string $code, string $redirectUri=null):?object
  {
    $redirectUri = $redirectUri ?? $this->redirectUri;
    $ch = curl_init(self::TOKEN_URL);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
Severity: Minor
Found in libraries/GMail.php - About 1 hr to fix

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

      public function refreshAccessToken(string $refreshToken):?object
      {
        $ch = curl_init(self::TOKEN_URL);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLINFO_HEADER_OUT, true);
    Severity: Minor
    Found in libraries/GMail.php - About 1 hr to fix

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

        public function getMessages(string $userId='me', array $labelIds=null,
        string $q=null, int $maxMessages=null, string $pageToken=null, bool $includeSpamTrash=false,
        $truncateAfter=null):?object
        {
          $query = [];
      Severity: Minor
      Found in libraries/GMail.php - About 1 hr to fix

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

          public function getMessages(string $userId='me', array $labelIds=null,
          string $q=null, int $maxMessages=null, string $pageToken=null, bool $includeSpamTrash=false,
          $truncateAfter=null):?object
        Severity: Major
        Found in libraries/GMail.php - About 50 mins to fix

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

            public function getAuthorizeUrl(string $scope, string $redirectUri=null,
            string $responseType='code', string $accessType='offline', bool $prompt=false):string
          Severity: Minor
          Found in libraries/GMail.php - About 35 mins to fix

            There are no issues that match your filters.

            Category
            Status