Showing 180 of 236 total issues
Function gather
has a Cognitive Complexity of 158 (exceeds 5 allowed). Consider refactoring. Open
public static function gather(...$taskId)
{
return new Kernel(
function (TaskInterface $task, CoroutineInterface $coroutine) use ($taskId) {
$gatherCount = self::$gatherCount;
- 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 execute
has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring. Open
public function execute($isReturn = false)
{
while (!$this->taskQueue->isEmpty()) {
/** @var TaskInterface|FiberInterface */
$task = $this->taskQueue->dequeue();
- 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
File Networks.php
has 529 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Async;
Function client
has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring. Open
public static function client($uri = null, OptionsInterface $context = null)
{
[$parts, $uri, $ip,] = yield net_getaddrinfo((string)$uri);
$isSSL = \in_array($parts['scheme'], ['https', 'wss', 'tls', 'ssl']) || $parts['port'] === 443
|| ($context instanceof SSLContext);
- 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 getaddrinfo
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
function getaddrinfo($host = null, ?string $service = null, array $hints = [])
{
$address = $host;
$uri = (empty($host) || $host === 'localhost') ? 0 : $host;
$ip = null;
- 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 join
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
public function join()
{
$coroutine = \coroutine();
try {
// We wait for no-one. Tasks get cancelled on 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
File Sockets.php
has 384 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Async\Network;
Function asyncWith
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
public static function asyncWith($context = null, $object = null, array $options = [])
{
$di = $options;
if (\is_object($object) && !$object instanceof ContextInterface) {
$inject = $di = $object;
- 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
File Logger.php
has 355 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Async;
Sockets
has 33 functions (exceeds 20 allowed). Consider refactoring. Open
class Sockets extends Context implements SocketsInterface
{
/**
* Hints for **AddressInfo**, a `addrinfo` structure used by the `socket_addrinfo_lookup()` function to hold host address information.
*
Function create
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
public static function create(\Generator $gen)
{
$stack = new \SplStack;
$exception = null;
- 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
File Task.php
has 329 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Async;
Fiber
has 29 functions (exceeds 20 allowed). Consider refactoring. Open
final class Fiber implements FiberInterface
{
/**
* @var TaskInterface|FiberInterface|null
*/
Logger
has 29 functions (exceeds 20 allowed). Consider refactoring. Open
final class Logger extends AsyncLogger implements AsyncLoggerInterface
{
private static $levels = [
self::DEBUG => LogLevel::DEBUG,
self::INFO => LogLevel::INFO,
Function adding
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
public function adding(?\closure $future = null, ?string $include = null, ...$args): FutureInterface
{
$defined = Globals::get();
if (!\is_callable($future) && !$future instanceof FutureInterface) {
- 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
Lists
has 28 functions (exceeds 20 allowed). Consider refactoring. Open
final class Lists implements ListsIterator
{
/**
* @var array
*/
Dict
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
final class Dict implements DictIterator
{
/**
* @var array
*/
Function cancelTask
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public static function cancelTask($tid = 0, $customState = null, string $errorMessage = 'Invalid task ID!', bool $type = false)
{
return new Kernel(
function (TaskInterface $task, CoroutineInterface $coroutine) use ($tid, $customState, $errorMessage, $type) {
$cancelTask = $coroutine->getTask($tid);
- 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 __destruct
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public function __destruct()
{
if ($this->destructed) {
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
File SocketMessage.php
has 293 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Async;