Showing 8 of 8 total issues
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 = [];
- Read upRead up
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 build_url_query
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function build_url_query(array $params, bool $urlEncode=true):?string {
if ($params == null) return null;
$queryString = '?';
foreach($params as $key => $val) {
if (is_array($val)) {
- Read upRead up
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);
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);
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 = [];
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
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
Function __invoke
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function __invoke(string $url, array $header=[], array $body=null):array {
if ($body != null) $body = json_encode($body);
$ch = curl_init($url);
- Read upRead up
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"