Showing 209 of 236 total issues
Function cancelProgress
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function cancelProgress(TaskInterface $task)
{
$channel = $task->getCustomState();
if (\is_array($channel) && (\count($channel) == 2)) {
[$channel, $channelTask] = $channel;
- 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 removeSignal
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function removeSignal($signal, $listener)
{
if (!$this->signaler || !$this->signaler->count($signal))
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
Method addThread
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function addThread(callable $function, ...$args)
{
return new Kernel(
function (TaskInterface $task, CoroutineInterface $coroutine)
use ($function, $args) {
Method run
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function run()
{
if ($this->beforeFirstYield) {
$this->beforeFirstYield = false;
return ($this->coroutine instanceof \Generator)
Method response
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function response(
?string $body = null,
?int $status = null,
?string $type = 'text/html',
array ...$extra
Function elements
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function elements(...$items): array
{
$elements = [];
if (\is_iterable($items)) {
$items = isset($items[0]) && \is_array($items[0]) ? $items[0] : $items;
- 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 open
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static function open(string $path, string $flag = 'r', int $mode = \S_IRWXU, $contexts = null)
{
if (isset(self::$fileFlags[$flag])) {
if (self::isUv() && (\strpos($path, '://') === false)) {
return new Kernel(
- 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 file_get
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function file_get(string $filename)
{
$fd = yield file_open($filename, 'r');
if (\is_resource($fd)) {
if (file_meta($fd, 'wrapper_type') === 'http') {
- 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 addTimeout
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function addTimeout($task = null, float $timeout = 0.0, int $tid = null)
{
if ($this->isUv()) {
$interval = (int) \round($timeout * 1000);
$timer = \uv_timer_init($this->uv);
- 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 __construct
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct($socket = None, $timeout = 1)
{
$isSocketOrStream = (!\IS_PHP8)
? \get_resource_type($socket)
: ($socket instanceof \Socket ? 'Socket' : \get_resource_type($socket));
Method certificate
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function certificate(
string $name = null,
string $ssl_path = null,
string $ssl_file = null,
array $details = []
Method with
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function with($context = null, \Closure $as = null)
{
$task = \coroutine()->getTask(yield \current_task());
// @codeCoverageIgnoreStart
if (\is_resource($context)) {
Method throwable
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected static function throwable(\Throwable $error, CoroutineInterface $coroutine)
{
yield;
$task = $coroutine->getTask(yield \current_task());
$task->setState(
Method watch
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function watch(string $path, int $watchTask)
{
if (self::isUv()) {
return new Kernel(
function (TaskInterface $task, CoroutineInterface $coroutine) use ($path, $watchTask) {
Method setWriter
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function setWriter(callable $writer = null, $levels = self::ALL, $interval = 1, callable $formatter = null)
{
if (empty($formatter)) {
$formatter = $this->defaultFormatter;
}
Method run
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function run(?\closure $task = null, ...$argv): Futures
{
if ($this->isClosed())
throw new Closed('already closed');
Method interpolate
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function interpolate($string, array $vars)
{
if (!\preg_match_all("~\{([\w\.]+)\}~", $string, $matches, \PREG_SET_ORDER)) {
return $string;
}
Method read
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function read($handle, $size = -1)
{
if (self::isUv() && $handle instanceof \UV) {
if (\uv_is_closing($handle))
return false;
Function assertOpenSSLx509
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function assertOpenSSLx509($resource)
{
if (!\IS_PHP8) {
if (!\is_resource($resource)) {
throw new \InvalidArgumentException(\sprintf('Resource expected, got "%s"', \gettype($resource)));
- 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 contents
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static function contents($fd = null, int $size = 256, float $timeout_seconds = 0.5)
{
if (!\is_resource($fd))
return yield \value(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"