File Hyper.php
has 522 lines of code (exceeds 250 allowed). Consider refactoring. Wontfix
<?php
declare(strict_types=1);
namespace Async\Request;
Method sendRequest
has 110 lines of code (exceeds 25 allowed). Consider refactoring. Wontfix
public function sendRequest(RequestInterface $request) // Can't use `ResponseInterface` return type, cause method contains `yield`
{
$option = self::OPTIONS;
$method = $request->getMethod();
Function sendRequest
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
public function sendRequest(RequestInterface $request) // Can't use `ResponseInterface` return type, cause method contains `yield`
{
$option = self::OPTIONS;
$method = $request->getMethod();
- 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 request
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
public function request($method, $url, $body = null, array ...$authorizeHeaderOptions): RequestInterface
{
$headerOptions = $this->optionsHeaderSplicer($authorizeHeaderOptions);
$defaultOptions = self::OPTIONS;
$defaultHeaders = self::HEADERS;
- 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
Hyper
has 25 functions (exceeds 20 allowed). Consider refactoring. Wontfix
class Hyper implements HyperInterface
{
/**
* Set of key => value pairs to include as default headers with request calls.
*
Method request
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Wontfix
public function request($method, $url, $body = null, array ...$authorizeHeaderOptions): RequestInterface
{
$headerOptions = $this->optionsHeaderSplicer($authorizeHeaderOptions);
$defaultOptions = self::OPTIONS;
$defaultHeaders = self::HEADERS;
Function authorization
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
protected function authorization(array $authorize = null): string
{
if (empty($authorize))
return '';
- 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 selectSendRequest
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function selectSendRequest(
RequestInterface $request,
int $attempts = \RETRY_ATTEMPTS,
float $timeout = \RETRY_TIMEOUT,
bool $withTimeout = false
- 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 waitController
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Wontfix
protected static function waitController()
{
/**
* Check and handle request tasks already completed before entering/executing, fetch()/wait().
*/
Method selectSendRequest
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Wontfix
public function selectSendRequest(
RequestInterface $request,
int $attempts = \RETRY_ATTEMPTS,
float $timeout = \RETRY_TIMEOUT,
bool $withTimeout = false
Method optionsHeaderSplicer
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Wontfix
protected function optionsHeaderSplicer(array ...$headersOptions): array
{
$headersOptions = $headersOptions[0];
$header['headers'] = $authorizer = $headers = $options = [];
if (isset($headersOptions[0][0])) {
Function waitController
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected static function waitController()
{
/**
* Check and handle request tasks already completed before entering/executing, fetch()/wait().
*/
- 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 optionsHeaderSplicer
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function optionsHeaderSplicer(array ...$headersOptions): array
{
$headersOptions = $headersOptions[0];
$header['headers'] = $authorizer = $headers = $options = [];
if (isset($headersOptions[0][0])) {
- 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"